Click here to Skip to main content
15,908,264 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Running a service in Windows 2000 Pin
Corto Maltese14-May-02 9:15
Corto Maltese14-May-02 9:15 
GeneralRe: Running a service in Windows 2000 Pin
Carlos Antollini14-May-02 9:35
Carlos Antollini14-May-02 9:35 
GeneralRe: Running a service in Windows 2000 Pin
Anders Molin14-May-02 12:41
professionalAnders Molin14-May-02 12:41 
GeneralRe: Running a service in Windows 2000 Pin
Amit Dey14-May-02 13:07
Amit Dey14-May-02 13:07 
GeneralDisplaying the Focus Rect around a Checkbox Pin
underholt14-May-02 8:46
underholt14-May-02 8:46 
GeneralRe: Displaying the Focus Rect around a Checkbox Pin
Larry Antram14-May-02 18:46
Larry Antram14-May-02 18:46 
GeneralRe: Displaying the Focus Rect around a Checkbox Pin
underholt14-May-02 22:01
underholt14-May-02 22:01 
GeneralRe: Displaying the Focus Rect around a Checkbox Pin
underholt15-May-02 2:32
underholt15-May-02 2:32 
The problem seems to be Win2000 and a soloution was provided by Jeff Partch [MVP]

Hi, Andy!

May not be relevant, but under what OS are you running? On Win2k and up, the focus rect is hidden by
default until you do things like: 1) Tabbing with the keyboard, 2) Hit the ALT key, or 3) Invoke the
dialog with the keyboard in the first place. The WM_UPDATEUISTATE may explain it better than I do,
but if I add a PostMessage of it to your OnInitDialog...

BOOL CTestChekBoxDlg::OnInitDialog()
{
CDialog::OnInitDialog();

m_button.Create(
_T("Hello"),
WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_AUTOCHECKBOX,
CRect(10,10,100,30),
this,
10000
);

GotoDlgCtrl(&m_button);

PostMessage(
WM_UPDATEUISTATE,
MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS)
);

return FALSE;
}

...it'll circumvent the expected behavior (which may not be a good thing, but that's your call). It
does do for me anyway. To get these 'UISTATE' defines you need to have the latest (or later than
that which ships with VC6) PSDK installed, and 2) You need to have defined (_WIN32_WINNT >= 0x0500)
way early in the build process. Personally, I think this conditional around a Window's message and
its parameter values is an error in judgement. Anyway, both these can be a real pain, so FWIW...

#ifndef WM_UPDATEUISTATE
#define WM_UPDATEUISTATE 0x0128
#endif
#ifndef UISF_HIDEFOCUS
#define UISF_HIDEFOCUS 0x1
#endif
#ifndef UIS_CLEAR
#define UIS_CLEAR 2
#endif

And in the not that you asked department: the way you've posted it, you dynamic creation of the
button looks like the hard way to go about it.

--
Jeff Partch [MVP]

GeneralAdding strings to Combo boxes Pin
RalfPeter14-May-02 8:04
RalfPeter14-May-02 8:04 
GeneralRe: Adding strings to Combo boxes Pin
Chris Losinger14-May-02 8:12
professionalChris Losinger14-May-02 8:12 
GeneralRe: Adding strings to Combo boxes Pin
Carlos Antollini14-May-02 8:40
Carlos Antollini14-May-02 8:40 
GeneralRe: Adding strings to Combo boxes Pin
RalfPeter14-May-02 12:00
RalfPeter14-May-02 12:00 
GeneralRe: Adding strings to Combo boxes Pin
Jack Handy14-May-02 15:02
Jack Handy14-May-02 15:02 
GeneralRe: Adding strings to Combo boxes Pin
RalfPeter15-May-02 4:24
RalfPeter15-May-02 4:24 
GeneralRe: Adding strings to Combo boxes Pin
Carlos Antollini15-May-02 3:30
Carlos Antollini15-May-02 3:30 
GeneralRe: Adding strings to Combo boxes Pin
RalfPeter15-May-02 4:20
RalfPeter15-May-02 4:20 
General2 questions: Setting focus and dropdown list Pin
albean14-May-02 7:46
albean14-May-02 7:46 
GeneralRe: 2 questions: Setting focus and dropdown list Pin
Chris Losinger14-May-02 7:51
professionalChris Losinger14-May-02 7:51 
GeneralRe: 2 questions: Setting focus and dropdown list Pin
albean14-May-02 9:18
albean14-May-02 9:18 
GeneralRe: 2 questions: Setting focus and dropdown list Pin
Chris Losinger14-May-02 9:23
professionalChris Losinger14-May-02 9:23 
GeneralRe: 2 questions: Setting focus and dropdown list Pin
albean14-May-02 9:30
albean14-May-02 9:30 
GeneralAdd Windows Message Handler.... Pin
Le centriste14-May-02 7:43
Le centriste14-May-02 7:43 
GeneralRe: Add Windows Message Handler.... Pin
Le centriste14-May-02 7:49
Le centriste14-May-02 7:49 
GeneralCDialog with CReBar Pin
John Oliver14-May-02 7:17
John Oliver14-May-02 7:17 
GeneralDocking Toolbar question Pin
14-May-02 7:14
suss14-May-02 7:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.