Try some of this:

***DELPHI code

library COWIlib2;

uses
  SysUtils,
  Classes,
  COWI2AboutBox,
  Forms;



//
========================================================================
=====
// *** This procedure creates an instance of the aboutbox screen
function ShowAboutBox(hWnd: THandle; pstr: pchar): boolean; stdcall;
begin
  Result := True;
  Application.Handle := hWnd;
  try
    //if FormCOWIAboutbox = nil then begin
      FormCOWIAboutbox := TFormCOWIAboutbox.Create(Application);    //
Object is free by pressing ok
      FormCOWIAboutbox.SetAboutName(pstr);
      FormCOWIAboutbox.Show;
    //end;
  except
    Result := False
  end;
end;

//
========================================================================
=====
// *** GetVersionInfo
function GetVersionInfo: pchar; stdcall;
begin
  Result := 'Version 1.0';
end;

//
========================================================================
=====
// *** Exports
Exports ShowAboutBox,
        GetVersionInfo;

//
========================================================================
=====
// *** Initialization
begin
end. 

****MapBasic code:

Declare Sub ShowAboutBox Lib "COWIlib2.DLL" (ByVal Handle as Integer,
ByVal str As String)
Declare Function GetFocus Lib "User32"() as Integer

Sub AboutIt
  Dim iHwnd as Integer

  iHwnd = GetFocus()
  'iHwnd = SystemInfo(SYS_INFO_MDICLIENTWND)  will also work...

  Call ShowAboutBox(Handle,"Version 1.0")
End Sub



HTH

Jakob Lanstorp
Software Consultant
Geographical Information & IT 

COWI A/S
Odensevej 95
DK-5260 Odense S

Tel  +45 6311 4900
Fax  +45 6311 4949
Mob  +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Yuriy
Fedorinov
Sent: Thursday, December 01, 2005 3:43 PM
To: [email protected]
Subject: [MI-L] dll for mapbasic programm]

From: <[EMAIL PROTECTED]>

I write dll with Delphi to work with some Mapbasic application. When i
call this dll rom mb application I want to "connect" with the same
instance of Mapinfo that calls my dll. There is
SystemInfo(SYS_INFO_APPDISPATCH) function in MapBasic, but i can't
understand how to work with this function results.

May be problem is in speciality of building dll, or in my unability to
convert integer value to variant or interface variable to start working
with Mapinfo.


Dll has, for example, 2 procedures:


procedure ConnectToMI(Ipointer: integer); stdcall; export; begin

  // MI - global dll variant variable to communicate with Mapinfo

  MI:= IDispatch(Pointer(Ipointer))

end;


function TestConnect : integer; stdcall; export;

begin

  // test function returning number of opened tables

  try

    Result:= MI.Eval('NumTables()')

  except

    Result:= -1;

  end;

end;


-- MapBasic usage of dll procedures

First:

  call ConnectToMI(SystemInfo(SYS_INFO_APPDISPATCH))

Second:

  Note "Number of opened tables: " + TestConnect()


Hope to "Mapinfo community" help.

With best regards,

  Yuriy Fedorinov

Russia, St.Petersburg
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to