Skip to main content
gamedev.net
🔒 Locked

SendMessage and image question

Started by malpass Sep 10, 2003 at 11:36 AM 2 replies 350+ views
Original Post
malpass
malpass
I''m using C# and imported the SendMessage function, it works cuz I use it in other progs so theres no prob there. I want to use BM_SETIMAGE to set an image for a hWnd, the hWnd is also correct cuz I have used a WM_CLOSE on it to test it. I tryed:
int BM_SETIMAGE = 0x00F7;

[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);

SendMessage(hWnd,BM_SETIMAGE,0,(int)myImage.GetHbitmap());
 
but it didnt work
Colin Jeanne
Colin Jeanne
quote:
MSDN: BM_SETIMAGE
wParam
Specifies the type of image to associate with the button. This parameter can be one of the following values:
IMAGE_BITMAP
IMAGE_ICON




Colin Jeanne | Invader''s Realm
Mastaba
Mastaba
quote:
Original post by Anonymous Poster
the problem is that he has SendMessage's wParam defined as an int, when it should be a short.


Incorrect. That was the case in Windows 3.1 and earlier. Since then WPARAM has been defined as an unsigned int, at least when _WIN64 is not defined. The 64 bit variations of Windows go with an unsigned __int64 instead.

[edited by - Mastaba on September 11, 2003 12:49:25 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.