Hello, Jakob Lanstorp!
Thanks for advice, but I want to do some operation from dll like
MIServer.Eval('some mapbasic command')
MIServer.Do('some mapbasic command')
I want to work with Mapinfo application that call my dll like with Com-object
using com-interfaces
I can't use GetActiveOleObject('Mapinfo.Application') from my dll because there
is no warranty that only one instance of mapinfo.application is running now.
I think, and this write in Mapinfo documentation, than for solving my problem
need to use SystemInfo(SYS_INFO_APPDISPATCH) function,
SystemInfo(SYS_INFO_APPDISPATCH) description from Mapinfo KnowlegeBase:
" The return value from this function is an unmarshalled pointer to an instance
of MapInfo's OLE Automation IDispatch interface. As such, it must only be used
as an IDispatch pointer from within the same process space as the executing
MapInfo executable. It is intended to be used to invoke MapInfo Automation
methods from a DLL called by an executing MapBasic application."
Question is HOW????
May be I need write some code
PIDispatch = SystemInfo(SYS_INFO_APPDISPATCH) // get from Mapbasic application
library ...
var
vMIServer: variant // global dll variable
procedure MIConnect(PIDispatch: integer);stdcall;
begin
MIUnknown:= IUnknown(Pointer(PIDispatch));
MIUnknown.QueryInterface(DMapinfo, vMIServer); // DMapinfo - disp interfase
from Mapinfo Type Library
end;
I can't spend a lot of time to find solution for my question and hope to help
with my Mapinfo-L friends.
JL> Try some of this:
JL> ***DELPHI code
JL> library COWIlib2;
JL> uses
JL> SysUtils,
JL> Classes,
JL> COWI2AboutBox,
JL> Forms;
JL> //
JL>
JL> ========================================================================
JL> =====
JL> // *** This procedure creates an instance of the aboutbox screen
JL> function ShowAboutBox(hWnd: THandle; pstr: pchar): boolean; stdcall;
JL> begin
JL> Result := True;
JL> Application.Handle := hWnd;
JL> try
JL> //if FormCOWIAboutbox = nil then begin
JL> FormCOWIAboutbox :=
JL> TFormCOWIAboutbox.Create(Application); //
JL> Object is free by pressing ok
JL> FormCOWIAboutbox.SetAboutName(pstr);
JL> FormCOWIAboutbox.Show;
JL> //end;
JL> except
JL> Result := False
JL> end;
JL> end;
With best regards,
Yuriy Fedorinov
Russia, St.Petersburg
###########################################
Сообщение проверено F-Secure Anti-Virus for Microsoft Exchange.
Известных вирусов не обнаружено.
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l