<ibdoerre@[EMAIL PROTECTED]
> wrote in message
news:1140379745.596523.179140@[EMAIL PROTECTED]
> The following is what I've done until now.
> :
> Function SimulateButtonClickWithParams(hWndButton As Long, lCheck As
> Long) As Long
> 'INPUT: hWndButton als Handle des Buttons, lCheck = 1 oder 0
> local lRet As Long
> local hWndParent As Long
>
> hWndParent = GetParent(hWndButton)
> If hWndParent <> 0& Then
> If SendMessageLong(hWndButton, BM_GETCHECK, 0&, 0&) = 1& Then
> If lCheck = 0& Then 'uncheck
> lRet = SendMessageLong(hWndButton, BM_CLICK, 0&,
> lCheck) 'lCheck = 0
.....
> The button handle is correct but the function works only when I first
> programaticaly show the tab control where the button resides. I wonder
> why.....
It only works when that dialog is in the foreground (techinically, when
it's
the active window) because an inactive window cannot receive a BM_CLICK
message. (It thinks it came from the keyboard, but the focused window is
the
active window, and only the focused window can recieve keyboard input).
Change to using BM_SETCHECK message. (Didn't I say that before? It's deja
vu
all over again.)
Also as a matter of style, don't use "0" and "1". Use %BST_CHECKED /
%BST_UNCHECKED. It will be a lot easier to maintain the program that way.
(FWIW, the hWndParent code in there does nothing).
--
Michael Mattias
Tal Systems, Inc.
Racine WI
mmattias@[EMAIL PROTECTED]


|