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?
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?
In a perfect world every dog would have a home and every home would have a dog.
Visit My Web Site, Canine Programming
I use Win32 API
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!
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
Thank You! Now just about the picture on a button thing.
In a perfect world every dog would have a home and every home would have a dog.
Visit My Web Site, Canine Programming
I use Win32 API
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.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
So you mean create an hdc from the button hdc just like it was the main window? I undestand now! Thank You!
In a perfect world every dog would have a home and every home would have a dog.
Visit My Web Site, Canine Programming
I use Win32 API