Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: _argv[] proglems Pin
David Crow22-Sep-06 3:16
David Crow22-Sep-06 3:16 
AnswerRe: _argv[] proglems Pin
hlmechanic22-Sep-06 4:06
hlmechanic22-Sep-06 4:06 
QuestionRe: _argv[] proglems Pin
David Crow22-Sep-06 5:21
David Crow22-Sep-06 5:21 
AnswerRe: _argv[] proglems Pin
hlmechanic22-Sep-06 5:42
hlmechanic22-Sep-06 5:42 
Questionwin32 API - How to use a button Pin
gunner_uk200021-Sep-06 6:13
gunner_uk200021-Sep-06 6:13 
AnswerRe: win32 API - How to use a button Pin
David Crow21-Sep-06 6:56
David Crow21-Sep-06 6:56 
QuestionRe: win32 API - How to use a button Pin
gunner_uk200021-Sep-06 23:23
gunner_uk200021-Sep-06 23:23 
AnswerRe: win32 API - How to use a button [modified] Pin
David Crow22-Sep-06 3:01
David Crow22-Sep-06 3:01 
gunner_uk2000 wrote:
I i understand correctly hwndButton is a handle to the button, and hwnd is a handle to the window...


A button is a window.

The ninth argument to CreateWindow() is supposed to be the ID associated with the button control. You're using NULL. When a control generates a message, it is sent to the parent window. Processed messages are typically not sent to DefWindowProc().

You should have:

hwndButton = CreateWindow(..., (HWND) MY_BUTTON, ...);
...
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
    case WM_COMMAND:
        if (LOWORD(wParam) == MY_BUTTON)
            MessageBox();
        return 0;
    default:
        return DefWindowProc(hwnd, msg, wParam, lParam);
}



"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

"Judge not by the eye but by the heart." - Native American Proverb


AnswerRe: win32 API - How to use a button Pin
susiriss22-Sep-06 3:25
susiriss22-Sep-06 3:25 
QuestionShell open with Pin
Mohammad A Gdeisat21-Sep-06 6:13
Mohammad A Gdeisat21-Sep-06 6:13 
Questionarray input using edit box Pin
Cyclone0221-Sep-06 5:27
Cyclone0221-Sep-06 5:27 
AnswerRe: array input using edit box Pin
Zac Howland21-Sep-06 5:39
Zac Howland21-Sep-06 5:39 
AnswerRe: array input using edit box Pin
David Crow21-Sep-06 6:59
David Crow21-Sep-06 6:59 
GeneralRe: array input using edit box Pin
Cyclone0221-Sep-06 7:15
Cyclone0221-Sep-06 7:15 
GeneralRe: array input using edit box Pin
David Crow21-Sep-06 7:28
David Crow21-Sep-06 7:28 
GeneralRe: array input using edit box Pin
Cyclone0222-Sep-06 5:59
Cyclone0222-Sep-06 5:59 
QuestionCall Windows Explorer after save files Pin
Max++21-Sep-06 5:19
Max++21-Sep-06 5:19 
AnswerRe: Call Windows Explorer after save files Pin
toxcct21-Sep-06 5:39
toxcct21-Sep-06 5:39 
QuestionDialog don't get focus back [modified] Pin
jsumm21-Sep-06 4:34
jsumm21-Sep-06 4:34 
QuestionComparing enum types Pin
Waldermort21-Sep-06 4:25
Waldermort21-Sep-06 4:25 
AnswerRe: Comparing enum types Pin
Zac Howland21-Sep-06 4:44
Zac Howland21-Sep-06 4:44 
GeneralRe: Comparing enum types Pin
Waldermort21-Sep-06 5:21
Waldermort21-Sep-06 5:21 
GeneralRe: Comparing enum types Pin
Zac Howland21-Sep-06 5:36
Zac Howland21-Sep-06 5:36 
GeneralRe: Comparing enum types Pin
Waldermort21-Sep-06 5:45
Waldermort21-Sep-06 5:45 
QuestionReceive broadcast UDP Pin
jeron121-Sep-06 4:14
jeron121-Sep-06 4:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.