Hi Yuriy -

Why let your own brain sweat, when others have done the sweating for you ?? 

Try the following code:

== MapBasic Code ==

Declare Sub DoMiCmd Lib "miex.dll" (ByVal DispId As integer, cmd as string)
Declare Sub Main

sub main

  Dim Cmd as string
  Dim DispId as integer

  Cmd = "Note (""Pigs may fly and horses may sing !!"")"
  DispId = systeminfo(17) '17 == SYS_INFO_APPIDISPATCH 

  call DoMiCmd (DispId, Cmd)

end sub


== Delphi Code ==

library MiEx;

uses
  comobj,
  sysutils;

Procedure DoMiCmd(DispatchId: IDispatch; Cmd: Pchar); stdcall;

var

  Mi : Variant;

begin

  Mi := DispatchID;
  Mi.do (strPas(cmd));

end;

exports DoMiCmd;

begin
end.

Some caveats:

- There is sometimes a problem with MapInfo loosing focus when you are 
submitting commands to the MapInfo com object from your Delphi code. If you 
find a solution for this, please send my a note

- If you are going to use the MiMapGen COM object in MapInfo, use it with 
extreme care. It is very VERY unstable (and has been that since day one in MI 
ver. 4.1 !!). Example: When you free/destroy the MiMapGen object after use in 
the Delphi code, MapInfo explodes. So if you find a method to free a MiMapGen 
object after use in the Delphi program without MapInfo explodes in your face, 
please let me know. See: 

http://spatialnews.geocomm.com/community/lists/viewmessage.phtml?id=26108

Regards, and good luck with your Delphi/MI/COM programming.

Bo Thomsen
GeoConsult I/S
Denmark


-----Oprindelig meddelelse-----
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af [EMAIL PROTECTED]
Sendt: 2. december 2005 08:25
Til: [email protected]
Emne: Re: [MI-L] dll for mapbasic programm

HI All!




I solve my proble myself. Some nights with books: com, ole, activeX -
and, o luck, it's starts to work.

If you interesting in my decision ask me.




With best regards,

  Yuriy Fedorinov

St.Petersburg, Russia




###########################################

????????? ????????? F-Secure Anti-Virus for Microsoft Exchange.
????????? ??????? ?? ??????????.
_______________________________________________
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