News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Picture

Started by Faiseur, February 20, 2005, 07:52:14 PM

Previous topic - Next topic

Faiseur

Hi Ramon,

it is perhaps a stupid question but I have a problem with the pictures. Thanks for your help.

1. In Properties for example, a Window, I select a picture bitmap in the entry "Picture".  But if I want to remove this picture to find the initial state "[ None ]" I do not arrive.  With EasyCode I can select an image but I do not find to empty this entry. Or is the solution?

2. It is possible to apply a texture on the totality of a window, DialogBox, etc, with the function "SetPicture" ?  I usually use the functions "BitmapFromResource" or "LoadBitmap" to load texture, and "WM_CTLCOLORDLG", etc,  to apply textures.


Sorry my bad english  :-)


French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

Ramon Sala

Hi Faiseur,

Pleased to here from you.

To remove a picture, click on the picture name (in Properties window, right part), so that it gets the focus and you can see the cursor there. Then press the <Del> key.

About method SetPicture, it is defined as follows:

SetPicture Proto hWnd:HWND, hPicture:DWord

Where hWnd is handle to the object and hPicture is a resource ID or a picture handle previously loaded with "BitmapFromResource", "LoadBitmap", etc. If the high word of hPicture is 0, its is treated as a resource ID, otherwise it is treated as a picture handle (icon, cursor or bitmap). Here you are the SetPicture method help:


SetPicture method (nnly available in Window, MDIWindow, DialogBox, Button, Picture and Image objects)


Prototype


SetPicture Proto hWnd:HWND, hPicture:DWord

Syntax


Invoke SetPicture, hWnd, hPicture

where hWnd is the handle to the object for which the property is to be set and hPicture is a DWord value specifying the new picture for that object. The meaning of hPicture may vary according to the following considerations:


If the high word is 0, hPicture is treated as a resource ID.
If the high word is not 0, hPicture is treated as a handle to an icon, cursor or bitmap.

Eax returns TRUE if succesful, or FALSE if not.


Regards,

Ramon
Greetings from Catalonia

Faiseur

#2
Hi Ramon,

in first, thanks for your explanation.

QuoteTo remove a picture, click on the picture name (in Properties window, right part), so that it gets the focus and you can see the cursor there. Then press the <Del> key.

Ok  :P  Small suggestion:  to avoid that others seek it would be well to be able to make the same thing with the option "cut" of the right mouse (or with "edit menu", or "erase" key (left arrow)). Example RadAsm. Not to seek it is saved time :-)

QuoteWhere hWnd is handle to the object and hPicture is a resource ID or a picture handle previously loaded with "BitmapFromResource", "LoadBitmap", etc. If the high word of hPicture is 0, its is treated as a resource ID, otherwise it is treated as a picture handle (icon, cursor or bitmap). Here you are the SetPicture method help:

Thanks, I read the help but probably I do not understand what you want by " high word"...

Example:

Invoke LoadBitmap, hWnd, ID_TEXTURE1  <--- added in "image list"
mov pBrushD, eax
...
Invoke SetPicture, hWnd, PBrushD

is not ok ?


Best Regards
French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

Ramon Sala

#3
Hi Faiseur,

Your example code:

Invoke LoadBitmap, hWnd, ID_TEXTURE1  <--- added in "image list"
mov pBrushD, eax
...
Invoke SetPicture, hWnd, PBrushD



is perfectly good. Also, you could pass the resource ID directly:

Invoke SetPicture, hWnd, ID_TEXTURE1


When I say the "high word",  I mean that a resource ID cannot be greater than 65535 (that is, 0000FFFFH), so the high word will be 0. On the other hand, a handle will always be greater than 65535, so the high word will not be 0. If the value you pass as the second parameter is between 0 and 65535 (the high word is 0), the SetPicture method treats it as a resource ID and tries to load it from the file resources. Otherwise, it treats the second parameter as a picture handle (already loaded).


Best Regards,

Ramon
Greetings from Catalonia

Faiseur

Hi Ramon,

thanks for your help.


Best Regards,

faiseur

French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

Ramon Sala

You're welcome Faiseur.

Ramon
Greetings from Catalonia