-
Button Keypress 'd
hi,
im using this code to simulate a leftmousetclick to a particular window (button) using an API
SendMessageLong(BtnHwnd, WM_KEYDOWN, VK_SPACE, 0&)
It does what is supposed to do. i didnt send the the Const WM_KEYUP = &H101 so that the button remains pressed.
My problem is when i move the target window or just click or type anything on the form of the target window it released the mouse left click. I even tried to disable that window but it still released the button when it move.
is there a way so i can lock that window so it wont release its keypress hold on the button? or do i have to use a timer control then keep sending that message to that window???
tnx
-
try to put a mouse_left_button _flag. and tell it to your program that if the 1st press encountered, mouse_left_button _flag = true. Then the keypress to your target will be like this;
if mouse_left_button _flag then
<nothing>
else
<release keypress>
endif
and if the 2nd press encountered to your mouse, mouse_left_button _flag will be false.
I hope I get it right.
-
Is the target window a part of the app you are developing, or is it an external window in another app?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
 Originally Posted by Hack
Is the target window a part of the app you are developing, or is it an external window in another app?
its in another application 
its something like this
Private Sub cmdbutton_Click()
Select Case cmdbutton.Caption
Case Is = "LOCK BUTTON"
cmdbutton.Caption = "UNLOCK BUTTON"
Call SendMessageLong(BtnHwnd, WM_KEYDOWN, VK_SPACE, 0&)
Case Is = "UNLOCK BUTTON"
cmdbutton.Caption = "LOCK BUTTON"
frmMAIN.cmdbutton.Caption = "LOCK BUTTON"
Call SendMessageLong(BtnHwnd, WM_KEYUP, VK_SPACE, 0&)
End Select
End Sub
it does press the button on another app but when the target application moves (or it recieves another message i think????) the keypress on the button gets released.
I want it to press the button and keep holding it down (keydown) until i say to release it (keyup).
???
-
 Originally Posted by jonah
I want it to press the button and keep holding it down (keydown) until i say to release it (keyup).
Why? What are you attempting to achieve by doing this?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
 Originally Posted by Hack
Why? What are you attempting to achieve by doing this?
Actually its a Talk Mic Button. I want to lock it on keypress so i wont have to use the mouse to keep it holding it down 
When i send the message
SendMessageLong(BtnHwnd, WM_KEYDOWN, VK_SPACE, 0&)
it does hold down the button if i dont send the WM_KEYUP. But it releases the button when the target app moves or when i type something on that app.
Similar Threads
-
By James Graham in forum .NET
Replies: 4
Last Post: 10-23-2011, 02:47 PM
-
By vb_programmer in forum VB Classic
Replies: 5
Last Post: 12-16-2008, 11:02 AM
-
By zobi316 in forum VB Classic
Replies: 3
Last Post: 03-10-2008, 07:05 AM
-
By 2eXtreme in forum Java
Replies: 0
Last Post: 04-05-2006, 07:38 AM
-
By DrunkinP in forum Java
Replies: 0
Last Post: 03-31-2005, 09:36 AM
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks