If you make a button in createwindow() function how can you tell if it has been pressed also is there any way to have a button title be a icon/bitmap?
Printable View
If you make a button in createwindow() function how can you tell if it has been pressed also is there any way to have a button title be a icon/bitmap?
Before anything:
#define ID_OF_BUTTON 23
And when you create the button use the (HMENU):
CreateWindow(
"button",
"Text",
WS_CHILD | WS_VISIBLE,
0, 0,
100, 20,
hwnd,
(HMENU)ID_OF_BUTTON,
0,
NULL
);
Where you have the break; from WM_CREATE:, do this:
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_OF_BUTTON:
// Do what you want in here when the button is pressed
break;
}
break;
I HOPE THIS HELPS!
Thank You! Now just about the picture on a button thing.
I would check the 'resource.h' file to ensure that the value I defined for the button will not clash with the number ID's the compiler is going to/has assigin.
This file contains all the resouce editors control ID's hash defined.
Here is a section of a resource.h from MSVC
#define IDS_LIST 50006
#define IDS_LISTVIEW 50007
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 125
#define _APS_NEXT_COMMAND_VALUE 40050
#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 101
The controls (ie buttons ect ) are in the 1000's. I would use 2000's for mine.
SyntaxBubble's hwnd is the HWND of the parent window.
To this windows callback the msg generated by the button will be sent (if you have more than one callback).
Bitmaps/icons are possible but require you to process WM_PAINT and use HDC's.
So you mean create an hdc from the button hdc just like it was the main window? I undestand now! :) Thank You! :)