Computing.Net > Forums > Programming > Set Dialog ItemText

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Set Dialog ItemText

Reply to Message Icon

Name: aj67my
Date: November 30, 2002 at 02:08:51 Pacific
OS: Windows 98 SE
CPU/Ram: 32MB
Comment:

Im makeing a simple calculator useing the Win32 API. I do not have any Window per say, all I have is a dialog box. The dialog box is created inside WinMain.

DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_CALCULATOR), NULL, DlgProc);

As you can see there is no handle for a parent window as my Dialog box is the only window. I have a Text controll. As a test, inside my dialog procedure, for the message WM_INITDIALOG I use SetDlgItemText to set some default text into my Text controll (Calculator display).

Here is my problem, SetDlgItemText requires a handle for my dialog box. Since I dont have a parent window I dont know how to get a handle for my dialog box. GetDlgItem requires a handle for the dialog box which is no good.

How can I get a handle for my dialog box so I can pass it to SetDlgItemText?

Please help.



Sponsored Link
Ads by Google

Response Number 1
Name: Jeff J
Date: November 30, 2002 at 08:53:27 Pacific
Reply:

The HWND parameter in the dialog procedure you caught WM_INITDIALOG in, is the handle to your dialog. Your dialog does not have a parent, since it is free-standing, and the dialog is the parent window for all the controls on it.

Cheers


0

Response Number 2
Name: aj67my
Date: November 30, 2002 at 22:05:51 Pacific
Reply:

Thank you. Useing the hwnd passed to my dialog procedure as you stated, I got it to work, thanks so much.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Set Dialog ItemText

VB Copy Command www.computing.net/answers/programming/vb-copy-command/12183.html

Verify Proxy.pac www.computing.net/answers/programming/verify-proxypac/16306.html

Edit visiblity on a dialog www.computing.net/answers/programming/edit-visiblity-on-a-dialog/574.html