hi

I'm developping an application using Mi as Ole automation server with delphi
I'd like to allow the Pline or polyline node modification BUT i don't want
the user to suppress node
so The solution i think about is to capture keystroke event before they are
sent to the map window.
to do so i use the following code.



function keycapture( code : longint; Wparam : wparam; Lparam : lparam) :
lresult;stdcall;


var
Hookid : longin;
    threadid : longint;
    iinstance : longint;
    winid : longint
    ires : longint;
   v : variant;

begin

v := Createoleobject('MapInfo.Application');

...

ires := v.do ('map from casiers');
// get the window id of the mapinfo map
winid := v.eval('WindowInfo(0,12)');
       threadid :=getwindowThreadprocessid(winid, @ires);
       iinstance := getwindowlongA(winid, GWL_HINSTANCE);
       setlasterror(0);
       // WH_KEYBOARD
       hookid := setwindowshookex(WH_KEYBOARD,
keycapture,iinstance,threadid);


...
end;

function keycapture( code : longint; Wparam : dword; Lparam : dword) :
Lresult;
begin
if(code < 0) then
else begin
   if(code = HC_action) then begin
       if(wparam = VK_DELETE) then begin
          beep;
       end;
   end;
end;
  result := callnexthookex(hookid,code, wparam,lparam)
end;


This code works fine BUT when the user use the keyboard in the map window,
MapInfo CRASHES !!
before the procedure keycapture beiing executed.

Any ideas ??


if i use the
     setwindowlong(winid,GWL_WNDPROC, longint(@wndprocx));
windows send me The erro number 5 : Access denied

Why ??


Thanks a lot

bye




------------------------------------
Mauclaire Xavier
STRATEGIS S.A.
[EMAIL PROTECTED]
------------------------------------



----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to