www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - help: sendmessage function

reply llee <llee_member pathlink.com> writes:
I'm trying to call the SendMessage function as defined in the windows api.
Unfortunately every attempt to call it results in an error.
Initially I tried calling the function directly assuming that it would have been
imported into my applications namespace after: 
" import std.c.windows.windows; "
this failed. So I tried:
" extern (Windows) void SendMessage (HWND, uint, WPARAM, LPARAM); "
this got the problem past the compiler, but generated an error during linkage.
At this stage I'm open for alternatives.
I'm trying to update a client window after my program processes WM_CHAR
messages. I was trying to use the SendMessage function to trigger WM_PAINT
events. 
Any help would be appreciated.
thanks, 
lee
Mar 05 2006
parent reply John C <johnch_atms hotmail.com> writes:
llee wrote:
 I'm trying to call the SendMessage function as defined in the windows api.
Because there's no such function. It's SendMessageA (the SDK headers define SendMessage as a macro).
 Unfortunately every attempt to call it results in an error.
 Initially I tried calling the function directly assuming that it would have
been
 imported into my applications namespace after: 
 " import std.c.windows.windows; "
 this failed. So I tried:
 " extern (Windows) void SendMessage (HWND, uint, WPARAM, LPARAM); "
Try this extern(Windows) LRESULT SendMessageA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); or for the Unicode version use extern(Windows) LRESULT SendMessageW(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
 this got the problem past the compiler, but generated an error during linkage.
 At this stage I'm open for alternatives.
 I'm trying to update a client window after my program processes WM_CHAR
 messages. I was trying to use the SendMessage function to trigger WM_PAINT
 events. 
 Any help would be appreciated.
 thanks, 
 lee
 
 
 
Mar 05 2006
parent Hasan Aljudy <hasan.aljudy gmail.com> writes:
John C wrote:
 llee wrote:
 
 I'm trying to call the SendMessage function as defined in the windows 
 api.
Because there's no such function. It's SendMessageA (the SDK headers define SendMessage as a macro).
 Unfortunately every attempt to call it results in an error.
 Initially I tried calling the function directly assuming that it would 
 have been
 imported into my applications namespace after: " import 
 std.c.windows.windows; "
 this failed. So I tried:
 " extern (Windows) void SendMessage (HWND, uint, WPARAM, LPARAM); "
Try this extern(Windows) LRESULT SendMessageA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); or for the Unicode version use extern(Windows) LRESULT SendMessageW(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
and/or version( unicode ) { alias SendMessageW SendMessage; } else { aliasm SendMessageA SendMessage; }
 this got the problem past the compiler, but generated an error during 
 linkage.
 At this stage I'm open for alternatives.
 I'm trying to update a client window after my program processes WM_CHAR
 messages. I was trying to use the SendMessage function to trigger 
 WM_PAINT
 events. Any help would be appreciated.
 thanks, lee
Mar 05 2006