|
Prev: Setting color for SysDateTimePick32 control?
Next: Progress Bar couldn't take windows messages.
From: gw7rib on 11 Jun 2008 16:39 On 10 Jun, 00:51, Kevin Michael Vail <ke...(a)vaildc.net> wrote: > At one point in my code, I have: > > VOID CALLBACK _cbSendMessageCallback(HWND h, UINT m, ULONG_PTR pcb, > LRESULT res) > { > ... > > } > > Later, I have: > > HWND h = ...; > UINT m = ...; > WPARAM w = ...; > LPARAM l = ...; > > RETVAL = SendMessageCallback(h, m, w, l, _cbSendMessageCallback, > (ULONG_PTR)cb); > > where 'cb' is a pointer that I want to pass to the message callback > function. > > When this compiles, it gives me a warning message: > > Ex.c(1024) : warning C4133: 'function' : incompatible types - from 'void > (__stdcall *)(HWND,UINT,ULONG_PTR,LRESULT)' to 'SENDASYNCPROC' > > But in Winuser.h, SENDASYNCPROC is typedef'ed as: > > typedef VOID (CALLBACK* SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT); > > which is I believe exactly how I've declared _cbSendMessageCallback! I think I had a warning once about types, and got rid of it by using a typedef which was in fact identical to the type I had used previously. I can only assume that they are trying to encourage you to use their types instead of your own. Have you tried declaring your function directly in terms of SENDASYNCPROC? Hope that is of some help. Paul.
From: Kevin Michael Vail on 11 Jun 2008 17:05 In article <49a7064c-fab3-49a6-b176-8eb701f45f35(a)z66g2000hsc.googlegroups.com>, gw7rib(a)aol.com wrote: [snipped] > > (__stdcall *)(HWND,UINT,ULONG_PTR,LRESULT)' to 'SENDASYNCPROC' > > > > But in Winuser.h, SENDASYNCPROC is typedef'ed as: > > > > typedef VOID (CALLBACK* SENDASYNCPROC)(HWND, UINT, ULONG_PTR, LRESULT); > > > > which is I believe exactly how I've declared _cbSendMessageCallback! > > I think I had a warning once about types, and got rid of it by using a > typedef which was in fact identical to the type I had used previously. > I can only assume that they are trying to encourage you to use their > types instead of your own. Have you tried declaring your function > directly in terms of SENDASYNCPROC? It turned out to be that STRICT was not defined, although I thought it was. Apparently FARPROC wasn't close enough to a SENDASYNCPROC under the other options the compiler was using... -- Kevin Michael Vail | Dogbert: That's circular reasoning. kevin(a)vaildc.net � | Dilbert: I prefer to think of it as no loose ends.
|
Pages: 1 Prev: Setting color for SysDateTimePick32 control? Next: Progress Bar couldn't take windows messages. |