WinapiZone.net




Extensions > ImageButton > Docs

Documentation

Click the function links to see the prototype, the function parameters, the return values and the remarks. Click it again to hide it.

Create


ImageButton_Create
This function add the button to the array of the buttons to be ownerdrawn.
Prototype BOOL ImageButton_Create(HWND button);
Parameters
button
[IN] Handle to button to be ownerdrawn.
Return values
TRUE
The button will be ownerdrawn.
FALSE
An error occur.
Remarks None
ImageButton_Create
This function add the button to the array of the buttons to be ownerdrawn.
Prototype BOOL ImageButton_Create(HWND hwndParent, UINT ctrlID);
Parameters
hwndParent
[IN] Handle to the parent window of the button.
ctrlID
[IN] Id of the button
Return values
TRUE
The button will be ownerdrawn.
FALSE
An error occurred.
Remarks None
ImageButton_Create
This function add more than one button to the array of the buttons to be ownerdrawn.
Prototype void ImageButton_Create(int buttonCount, ...);
Parameters
buttonCount
[IN] Number of buttons to be added to the ownerdraw array.
... (variable arguments)
[IN] Handle to the buttons to be ownerdrawn. The number of handles passed must respect the number passed as buttonCount
Return values No return values.
Remarks None

Bitmaps


ImageButton_SetBitmap
This function assings directly bitmaps handle (HBITMAP) to button.
Prototype BOOL ImageButton_SetBitmap(HWND button, HBITMAP normalBitmap, HBITMAP disabledBitmap, HBITMAP hoverBitmap);
Parameters
button
[IN] Handle to a button.
normalBitmap
[IN] Handle to the bitmap that is shown when the button is in its normal state.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
disabledBitmap
[IN] Handle to the bitmap that is shown when the button is disabled.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
> IBO_GRAY to create a grayscale bitmap from the normal bitmap (the button's normalBitmap MUST be a valid image).
hoverBitmap
[IN] Handle to the bitmap that is shown when the mouse hovers the button.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
> IBO_LIGHTEN to create a lighter bitmap from the normal bitmap (the button's normalBitmap MUST be a valid image).
Return values
TRUE
The new images have been set.
FALSE
An error occurred.
Remarks None
ImageButton_SetBitmap
This function loads bitmaps usign resource IDs.
Prototype BOOL ImageButton_SetBitmap(HWND button, UINT normalBitmapID, UINT disabledBitmapID, UINT hoverBitmapID);
Parameters
button
[IN] Handle to a button.
normalBitmapID
[IN] ID of the bitmap resource that is shown when the button is in its normal state.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
disabledBitmapID
[IN] ID of the bitmap resource that is shown when the button is disabled.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
> IBO_GRAY to create a grayscale bitmap from the normal bitmap (the button's normalBitmap MUST be a valid image).
hoverBitmapID
[IN] ID of the bitmap resource that is shown when the mouse hovers the button.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
> IBO_LIGHTEN to create a lighter bitmap from the normal bitmap (the button's normalBitmap MUST be a valid image).
Return values
TRUE
Images have been set.
FALSE
An error occurred.
Remarks This function loads bitmaps using the instance handle of the executable that called this function (with GetModuleHandle(NULL)).
ImageButton_SetBitmap
This function loads bitmaps using IDs the instance of the dll/exe you specify.
Prototype BOOL ImageButton_SetBitmap(HWND button, HINSTANCE instance, UINT normalBitmapID, UINT disabledBitmapID, UINT hoverBitmapID);
Parameters
button
[IN] Handle to the button.
instance
[IN] Instance handle of the exe/dll file where the bitmap resource are. Use GetModuleHandle("[filename].dll") where [filename] is the name/path of the resource file.
normalBitmapID
[IN] ID of the bitmap resource that is shown when the button is in its normal state.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
disabledBitmapID
[IN] ID of the bitmap resource that is shown when the button is disabled.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
> IBO_GRAY to create a grayscale bitmap from the normal bitmap (the button's normalBitmap MUST be a valid image).
hoverBitmapID
[IN] ID of the bitmap resource that is shown when the mouse hovers the button.
You can pass:
> IBO_MAINTAIN to maintain the current bitmap.
> IBO_LIGHTEN to create a lighter bitmap from the normal bitmap (the button's normalBitmap MUST be a valid image).
Return values
TRUE
Images have been set.
FALSE
An error occurred.
Remarks This function should be used only if the bitmap resources aren't located in the current executable, since all the other ImageButton_SetBitmap functions already loads bitmaps using GetModuleHandle(NULL).

Icons


ImageButton_SetIcon
This function assings directly icons handle (HICON) to button.
Prototype BOOL ImageButton_SetIcon(HWND button, HICON normalIcon, HICON disabledIcon, HICON hoverIcon);
Parameters
button
[IN] Handle to the button.
normalIcon
[IN] Handle to the icon resource that is shown when the button is in its normal state.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
disabledIcon
[IN] Handle to an icon that is shown when the button is disabled.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
> IBO_GRAY to create a grayscale icon from the normal icon (the button's normalIcon MUST be a valid image).
hoverIcon
[IN] Handle to an icon resource that is shown when the mouse hovers the button.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
> IBO_LIGHTEN to create a lighter icon from the normal icon (the button's normalIcon MUST be a valid image).
Return values
TRUE
Images have been set.
FALSE
An error occurred.
Remarks This function loads icons using the instance handle of the executable that called this function (with GetModuleHandle(NULL)).
ImageButton_SetIcon
This function loads icons from IDs. Use this function if you want to specify the desider dimensions of the normal and hover icon.
Prototype BOOL ImageButton_SetIcon(HWND button, UINT normalIconID, UINT disabledIconID, UINT hoverIconID, int iconWidth, int iconHeight);
Parameters
button
[IN] Handle to the button.
normalIconID
[IN] ID of an icon resource that is shown when the mouse is in its normal state.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
disabledIconID
[IN] ID of an icon resource that is shown when the button is disabled.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
> IBO_GRAY to create a grayscale icon from the normal icon (the button's normalIcon MUST be a valid image).
hoverIconID
[IN] ID of an icon resource that is shown when the mouse hovers the button.
> IBO_MAINTAIN to maintain the current icon.
> IBO_LIGHTEN to create a lighter icon from the normal icon (the button's normalIcon MUST be a valid image).
iconWidth
[IN] Desired width of the icon. This parameter defaults to 16.
iconHeight
[IN] Desired height of the icon. This parameter defaults to 16.
Return values
TRUE
Images have been set.
FALSE
An error occurred.
Remarks This function loads icons using the instance handle of the executable that called this function (with GetModuleHandle(NULL)).

You can call this function without the last two parameters if you want to load a 16*16 image, since the default value is in fact 16.
ImageButton_SetIcon
This function loads icons using IDs and the instance that you specify.
Prototype BOOL ImageButton_SetIcon(HWND button, HINSTANCE instance, UINT normalIcoID, UINT disabledIconID, UINT hoverIconID, int iconWidth, int iconHeight);
Parameters
button
[IN] Handle to the button.
instance
[IN] Instance (HINSTANCE/HMODULE handle) of the exe/dll file where the bitmap resource are located. Use GetModuleHandle("[filename].dll") where [filename] is the name/path of the resource file. (See the remarks section)
normalIconID
[IN] ID of an icon resource that is shown when the mouse is in its normal state.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
disabledIconID
[IN] ID of an icon resource that is shown when the button is disabled.
You can pass:
> IBO_MAINTAIN to maintain the current icon.
> IBO_GRAY to create a grayscale icon from the normal icon (the button's normalIcon MUST be a valid image).
hoverIconID
[IN] ID of an icon resource that is shown when the mouse hovers the button.
> IBO_MAINTAIN to maintain the current icon.
> IBO_LIGHTEN to create a lighter icon from the normal icon (the button's normalIcon MUST be a valid image).
iconWidth
[IN] Desired width of the icon. This parameter defaults to 16.
iconHeight
[IN] Desired height of the icon. This parameter defaults to 16.
Return values
TRUE
Images have been set.
FALSE
An error occurred.
Remarks This function should be used only if the icon resources aren't located in the current executable, since all the other ImageButton_SetIcon functions already loads icons using GetModuleHandle(NULL).

You can call this function without the last two parameters if you want to load a 16*16 image, since the default value is in fact 16.

Cursors


ImageButton_SetCursor
This function set the cursor to a button.
Prototype BOOL ImageButton_SetCursor(HWND button, HCURSOR cursor);
Parameters
button
[IN] Handle to the button.
cursor
[IN] Handle to the cursor.
Return values
TRUE
The cursor has been set.
FALSE
It was impossible to set the specified cursor.
Remarks This function loads cursors using the instance handle of the executable that called this function (with GetModuleHandle(NULL)).
ImageButton_SetCursor
This function set the cursor (loaded using ID and instance) to a button.
Prototype BOOL ImageButton_SetCursor(HWND button, HINSTANCE instance, UINT cursorID);
Parameters
button
[IN] Handle to the button.
instance
[IN] Instance (HINSTANCE/HMODULE handle) of the exe/dll where the two bitmap resource are.
CursorID
[IN] ID of the cursor.
Return values
TRUE
The cursors have been set.
FALSE
It was impossible to set the specified cursor.
Remarks You should use GetModuleHandle(NULL) if the cursor resource is located in the same file that calls this function. If it isn't, use GetModuleHandle("[filename].dll") where [filename] is the name/path of the resource file.
ImageButtons_SetCursor
This function set the cursor to all the buttons created with ImageButton_Create.
Prototype BOOL ImageButtons_SetCursor(HCURSOR cursor);
Parameters
cursor
[IN] Handle to the cursor.
Return values
TRUE
The cursor has been set.
FALSE
It was impossible to set the specified cursor.
Remarks This function loads cursors using the instance handle of the executable that called this function (with GetModuleHandle(NULL)).
ImageButtons_SetCursor
This function set the cursor (loaded using ID and instance) to all the buttons created with ImageButton_Create.
Prototype BOOL ImageButtons_SetCursor(HINSTANCE instance, UINT cursorID);
Parameters
instance
[IN] Instance (HINSTANCE/HMODULE handle) of the exe/dll where the two bitmap resource are.
cursorID
[IN] ID of the cursor.
Return values
TRUE
The cursors have been set.
FALSE
It was impossible to set the specified cursor.
Remarks You should use GetModuleHandle(NULL) if the cursor resource is located in the same file that calls this function. If it isn't, use GetModuleHandle("[filename].dll") where [filename] is the name/path of the resource file.

This page was last modified 32 months, 2 weeks, 6 days and 2 hours ago