Newsgroups: comp.windows.ms.programmer
Path: funic!fuug!mcsun!dxcern!dscomsa!news.DKRZ-Hamburg.DE!rzsun2.informatik.uni-hamburg.de!Sirius.dfn.de!ira.uka.de!sol.ctr.columbia.edu!spool.mu.edu!torn!nott!emr1!jagrant
From: jagrant@emr1.emr.ca (John Grant)
Subject: Re: Disabling dialog buttons
Message-ID: <1993Feb14.041501.15095@emr1.emr.ca>
Organization: Energy, Mines, and Resources, Ottawa
References: <1lhfufINNc7c@flop.ENGR.ORST.EDU>
Date: Sun, 14 Feb 1993 04:15:01 GMT
Lines: 25

In article <1lhfufINNc7c@flop.ENGR.ORST.EDU> huangj@prism.CS.ORST.EDU (Jen Huang (aka. Jim)) writes:
>I am need of help again. 
>
>This time, I need to disable a button which I created with the dialog editor.
>So let's say I need to disable an OK button with an id of IDOK.  I have tried
>using EnableWindow() an casting the id to a hwnd, but I guess this is wrong.
>My other alternative is to create the button during run-time, but this would
>not be very efficient.  So has anybody got any idea of how I can go about
>disabling a button in a dialog?

	You can't cast an id to a HWND! An id is just a number that
	*you* use to identify the control.  Windows uses a HWND
	to identify the control: it's a 'handle' pointing
	to some clever stuff inside Windows.

	Try this:
	  EnableWindow(GetDlgItem(hwnd,id),FALSE);

	also look at:
	  ShowWindow(GetDlgItem(hwnd,id),SW_HIDE);

-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
