Re: [Dev-C++] Static members for callbacks
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Abhijit S. <mu...@gm...> - 2002-07-29 06:51:37
|
> > You can't use non-static methods for windows callbacks (like in
> > CreateThread(), SetWindowsHookEx()) which need you to suppply
> > a call-back
> > function.
>
>
> This is too Win32 to me. What do you mean by call-back function. Can you
> provide a small concrete example?
Basically, typedef function_pointer call_back;
For example, in CreateThread(), the args are:
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes, // address of thread security
attributes
DWORD dwStackSize, // initial thread stack size, in bytes
LPTHREAD_START_ROUTINE lpStartAddress, // address of thread function
LPVOID lpParameter, // argument for new thread
DWORD dwCreationFlags, // creation flags
LPDWORD lpThreadId // address of returned thread identifier
);
Here, LPTHREAD_START_ROUTINE should be a function pointer to a 32-bit
returning (void *) accepting function, as in
DWORD my_thread_proc(void *some_arg);
where DWORD is, on Win32, unsigned long.
PS: Sorry for a double-post of the previous message. I thought it hadn't got
through,
so I reposted it, after which I received the original message... I guess the
list server is acting up...
|