Archived

This topic is now archived and is closed to further replies.

d000hg

How to grey out components in Windows dialogs

Recommended Posts

I''m sure there''s some SetDlgItemStyle or something to allow me to disable edit boxes etc in a dialog but all my guesses and searches in the MSVC help has failed to turn it up - especially annoying since I thought I saw it the other day while doing something else! Can someone help me here?
Read about my game, project #1 NEW (18th December)2 new screenshots, one from the engine and one from the level editor
John 3:16

Share this post


Link to post
Share on other sites
The winapi function SetWindowLong can be used to enable/disable a window:
SetWindowLong(h, GWL_STYLE, GetWindowLong(h, GWL_STYLE) & ~WS_DISABLED); //disable

SetWindowLong(h, GWL_STYLE, GetWindowLong(h, GWL_STYLE) | WS_DISABLED); //enable

where h is the hwnd of the window to modify
500x1

Share this post


Link to post
Share on other sites
OK, they look good but I was convinced there was a special one for a control, so I don''t have to get the handle to the control within the dialog then use that handle to disable the control?



Read about my game, project #1
NEW (18th December)2 new screenshots, one from the engine and one from the level editor



John 3:16

Share this post


Link to post
Share on other sites
get the window handle of the control with GetDlgItem and then call the EnableWindow function.

Share this post


Link to post
Share on other sites