| Clearner1 (38) | |||
|
this is my first GUI program ..... has a weird error.... no compilation errors ...but when i opened it....it is supposed that when i hit ok ...a message should appear...the message controls showed no responding also i couldnt bring the dialog box handle please help ...check the code:
| |||
|
|
|||
| modoran (1245) | ||||
|
That code has many problems. 1. Check DialogBox documentation:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645452(v=vs.85).aspx 2. Your DlgProc must return TRUE if you process the message and FALSE if not, not calling DefWindowProc:
3. You end a modal dialog by calling EndDialog(), not using PostQuitMessage:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645472(v=vs.85).aspx It is so hard to read the documentation ? | ||||
|
|
||||
| Clearner1 (38) | |
|
thanks a lot | |
|
|
|
| Clearner1 (38) | |
|
enddialog function require a handle to the dialog box....how can i get it | |
|
|
|
| EssGeEich (1009) | |
| It is the HWND parameter of the callback. In your example it is the variable named hwnd. | |
|
|
|
| Clearner1 (38) | |||
ok....but when i am using it like this:
the function didnt work can you tell why | |||
|
|
|||
| Clearner1 (38) | |
|
i thought that it was a wrong handle | |
|
|
|
| EssGeEich (1009) | |
|
You want to change the title? You need to do: SetWindowText(hwnd,L"Test"); | |
|
|
|
| Clearner1 (38) | |
| no .... i want to write to the label (static text) with ID :IDC_STATIC | |
|
|
|
| EssGeEich (1009) | |
|
You must then change that control's ID to another ID. The Controls who have the IDC_STATIC id cannot have their text changed in a simple way. Go in your resource editor and choose another ID, and use that one. Just letting you notice, MSVC by default sets all the Static Texts to the Same ID (which is exactly IDC_STATIC). For the buttons and other controls, it adds another number, like IDC_BUTTON1, IDC_BUTTON2... That's the reason why you should switch IDC_STATIC. | |
|
|
|