Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Powerbasic > Re: Read/write ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 178 of 282
Post > Topic >>

Re: Read/write status of Check Box via DLL in a 'host' EXE.

by "Michael Mattias" <michael.mattias@[EMAIL PROTECTED] > Feb 19, 2006 at 10:13 PM

<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]

 




 5 Posts in Topic:
Read/write status of Check Box via DLL in a 'host' EXE.
ibdoerre@[EMAIL PROTECTED  2006-02-19 04:09:07 
Re: Read/write status of Check Box via DLL in a 'host' EXE.
"Michael Mattias&quo  2006-02-19 13:25:35 
Re: Read/write status of Check Box via DLL in a 'host' EXE.
ibdoerre@[EMAIL PROTECTED  2006-02-19 12:09:05 
Re: Read/write status of Check Box via DLL in a 'host' EXE.
"Michael Mattias&quo  2006-02-19 22:13:34 
Re: Read/write status of Check Box via DLL in a 'host' EXE.
ibdoerre@[EMAIL PROTECTED  2006-02-20 01:04:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 12:34:12 CDT 2008.