|
-
Sep 23rd, 2001, 01:22 PM
#1
Thread Starter
Hyperactive Member
many buttons
is there some sort of limit of how many buttons you can have in the WM_COMMAND event?? i dont think so, but how come this doesn't work:
Code:
case WM_COMMAND: //click events
{
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[0])
{
paConfig(1);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[1])
{
paConfig(2);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[2])
{
paConfig(3);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[3])
{
paConfig(4);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[4])
{
paConfig(5);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[5])
{
paConfig(6);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[6])
{
paConfig(7);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[7])
{
paConfig(8);
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bReset)
{
paReset();
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bAllOn)
{
SendMessage(myhwnd, WM_COMMAND, (WPARAM)BN_CLICKED, (LPARAM)bLed[7]);
}
}
break;
the event when clicked bAllOn is not executed..how come? if i switch the event from bAllOn with the one from bReset, it works..
whats wrong??
Thanks
Amon Ra
The Power of Learning.
-
Sep 23rd, 2001, 01:34 PM
#2
Monday Morning Lunatic
Code:
SendMessage(myhwnd, WM_COMMAND, (WPARAM)BN_CLICKED, (LPARAM)bLed[7]);
Try sending a different message. Perhaps WM_LMOUSEDOWN (or whatever, don't remember) followed by mouse-up?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 23rd, 2001, 01:56 PM
#3
Thread Starter
Hyperactive Member
hmm weird... anything i put in there doesn't seem to be executed..i tried calling other functions from my program, but doesn't work..
this buton(bAllOn) is suppoed to call this
but it doesn't work
Amon Ra
The Power of Learning.
-
Sep 23rd, 2001, 02:40 PM
#4
Frenzied Member
wow this is just shouting for a loop huh
-
Sep 23rd, 2001, 03:43 PM
#5
Thread Starter
Hyperactive Member
you haven't seen the control creation.. LOL
i have thought about it, but my loop didn't work for the windows creation..
is it possible to have a loop here though? in the WM_COMMAND?
Amon Ra
The Power of Learning.
-
Sep 23rd, 2001, 03:59 PM
#6
Frenzied Member
sure...in my checkers game I had a control array up there...works like a charm
-
Sep 23rd, 2001, 08:17 PM
#7
Thread Starter
Hyperactive Member
hmm
steve, could you please show me the how you used the array in the WM_COMMAND message? thanks
Amon Ra
The Power of Learning.
-
Sep 23rd, 2001, 09:28 PM
#8
Frenzied Member
PHP Code:
int i; //this is the loop variable
case WM_COMMAND: //click events
{
for(i=1; i<=7;i++) {
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bLed[i])
{
paConfig(i+1);
}
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bReset)
{
paReset();
}
if ((LOWORD(wParam) == BN_CLICKED) && (HWND)lParam == bAllOn)
{
SendMessage(myhwnd, WM_COMMAND, (WPARAM)BN_CLICKED, (LPARAM)bLed[7]);
}
}
break;
I typed this up in a minute or two...so there might be an error I missed....try that out. 
See now isn't that so much nicer?
Last edited by SteveCRM; Sep 23rd, 2001 at 09:32 PM.
-
Sep 23rd, 2001, 09:30 PM
#9
Thread Starter
Hyperactive Member
great..i am gonna try it..Thanks a lot =)
Amon Ra
The Power of Learning.
-
Sep 23rd, 2001, 09:30 PM
#10
Thread Starter
Hyperactive Member
great..i am gonna try it..Thanks a lot
Amon Ra
The Power of Learning.
-
Sep 23rd, 2001, 09:33 PM
#11
Frenzied Member
NOTE: i edited the code so use the new code when you read this
-
Sep 23rd, 2001, 09:39 PM
#12
Thread Starter
Hyperactive Member
man...still doesn't work for the bAllOn stuff...but anyways thanks..
i'll try to fix it
Amon Ra
The Power of Learning.
-
Sep 24th, 2001, 03:12 PM
#13
Just a small comment on your code:
Instead of repeatedly checking for BN_CLICKED, you could create a condition similar to the following.
Code:
case WM_COMMAND:
if( HIWORD(wParam) == BN_CLICKED ) {
if( (HWND)lParam == hwndButton ) {
// ...
-
Sep 24th, 2001, 03:14 PM
#14
I just noticed something: You are checking the LOWORD of wParam for BN_CLICKED. BN_CLICKED is a notification, message, thus you should be checking the HIWORD instead.
-
Sep 24th, 2001, 08:30 PM
#15
Thread Starter
Hyperactive Member
man!! stil does't work..i dont understand...everything else works, except this button
Amon Ra
The Power of Learning.
-
Sep 24th, 2001, 10:30 PM
#16
Thread Starter
Hyperactive Member
thats really weird..i changed the name from bAll to bTotal, and it worked....weird =)
Amon Ra
The Power of Learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|