The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: trodon on November 18, 2006, 07:24:44 PM

Title: Enabling,Dissabling?
Post by: trodon on November 18, 2006, 07:24:44 PM
HI, one question...
what api can i use when i want to dissable some button from my Dialog, and what to enable?
Title: Re: Enabling,Dissabling?
Post by: TNick on November 18, 2006, 07:27:24 PM
Well, I didn't use dialogs so I'm not shure that this would help, but you can use EnableWindow for any window (as long as you know it's handle).

Regards,
Nick
Title: Re: Enabling,Dissabling?
Post by: trodon on November 18, 2006, 07:50:25 PM
hi TNick, thanks for answering.
No, i was try to use EnableWindow but failed, thats only for Window,Dialog

anyone sugest something?
Title: Re: Enabling,Dissabling?
Post by: jdoe on November 18, 2006, 08:16:38 PM
Quote from: trodon on November 18, 2006, 07:50:25 PM
hi TNick, thanks for answering.
No, i was try to use EnableWindow but failed, thats only for Window,Dialog

anyone sugest something?


EnableWindow work for windows and controls.


invoke EnableWindow, hButton, FALSE  ; or TRUE


If it fails, the problem must be elsewhere.

::)


Title: Re: Enabling,Dissabling?
Post by: Tedd on November 18, 2006, 10:05:12 PM
invoke SendDlgItemMessage, hDlg,IDB_BTN,WM_ENABLE,FALSE,NULL

..or..

invoke GetDlgItem, hDlg,IDB_BTN
invoke SendMessage, eax,WM_ENABLE,FALSE,NULL


..or..

invoke GetDlgItem, hDlg,IDB_BTN
invoke EnableWindow, eax,FALSE

(which just calls the SendMessage as above.)



Replace the FALSE with TRUE, to enable - obviously :wink
Title: Re: Enabling,Dissabling?
Post by: Ehtyar on November 19, 2006, 12:38:51 AM
WM_ENABLE is a notification, not a message: LINK (http://msdn2.microsoft.com/en-gb/library/ms632621.aspx).
Here is a small function i use in my own applications:

EnableControl PROC hWnd:HWND, nIDDlgItem:DWORD, bEnable:DWORD
invoke GetDlgItem, hWnd, nIDDlgItem
invoke EnableWindow, eax, bEnable
ret
EnableControl ENDP


Hope this helps, Ehtyar.
Title: Re: Enabling,Dissabling?
Post by: trodon on November 19, 2006, 01:09:18 PM
well i must say thank you all  :U