discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] (Win32) On adding custom windows message to the NSRunLoop


From: Fred Kiefer
Subject: Re: [Q] (Win32) On adding custom windows message to the NSRunLoop
Date: Fri, 15 Jun 2012 13:08:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

On 14.06.2012 09:29, Sungjin Chun wrote:
I want to use 3rd party dll with GNUstep but struck with a problem;
the dll needs a
window handle(HANDLE) for its event processing, for example, if I want
to receive
realtime event notification, I have to write this kind of code;

in WinMain function I have to use following windows message loop

HANDLE hwnd = CreateWindow(.../* ordinary window creation */);
while (GetMessage(...)) {
   TranslateMessage(...);
   DispatchMessage(...);
}

On other part, I have to register
XXX_registerEventHandler(hwnd, WM_USER + MY_EVENT_ID);

then, the dll emits windows message event WM_USER + MY_EVENT_ID so that
I can handle the data in WndProc(which is lpfnWndProc for hwnd).

Now my question is that I can get handle of a window from NSWindow>>nativeHandle
method, but how can I register event handler(NSRunLoop, right?) for
WM_USER + MY_EVENT_ID?

Thanks in advance and sorry for my poor english.

Currently there is no direct way to do this properly with GNUstep. At the moment we ignore all Windows events that we don't handle. The code for this in in back win32/Win32Server.m. What we could do here is turn all events with a number bigger than WM_USER into NSApplicationDefined events and pass on the event number in data1. But where would you handle that event? Either in the application class or in a specific window. I am not sure about NSApplicationDefined events being passed down to the control.

If you want do it your way, you can get the native handle from an NSWindow by calling the windowNumber method on the window. Just cast the returned value to a handle.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]