Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Determine If Shift Is Held While Clicking Toolbar Button


i tried this, but it didn't work:

Private Const VK_LSHIFT = &HA0
Private Const VK_RSHIFT = &HA1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

If GetAsyncKeyState(VK_LSHIFT) <> 0 Then blahblahblah...
If GetAsyncKeyState(VK_RSHIFT) <> 0 Then blahblahblah...


It always says the state is 0.
so how do i go about doing this?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Mouse-clicking A Button On The Toolbar Whilst Holding Down The Shift Key
Hi ppl,

Anybody knowing how to trigger some action by simultaneously pressing
the Shift (or Alt, or Ctrl) key and mouse-clicking a
MSComctlLib.Button on the toolbar?

With the most of the other controls it would be something like:
If (Shift And vbAltMask) > 0 And Button = 1 Then...
on the MouseDown event.

But, what do you do when it's a MSComctlLib.Button?

Nenad
http://www.bigfoot.com/~n63

How To Determine Clicking The What's This Button On A Form ?
Hello everybody,

I need your help. I need the ability to determine when the "What' this" button on a form is clicked. I think i have to subclass my form and look for the right message. Could anybody tell me what message I have to look for.

Best regards

Michael Hartmann

Clicking Toolbar Button On Another App
Hi, does anybody know how to click the first Toolbar button on another app?
I tried TB_PRESSBUTTON and it sets the first button to tbrPressed, but it doesn't run the Toolbar click event.


Code:
Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
'Private Const BM_CLICK As Long = &HF5

Private Const WM_USER = &H400
Private Const TB_PRESSBUTTON = (WM_USER + 3)

Private Sub Command1_Click()
Dim hParent As Long
Dim hChild As Long

hParent = FindWindow("TfrmMain", vbNullString)
'Debug.Print hParent

If hParent <> 0 Then

hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)
'Debug.Print hChild

If hChild <> 0 Then
Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)
End If
End If
End Sub

Clicking Toolbar Button On Another App
Hi, does anybody know how to click the first Toolbar button on another app?
I've already asked this on several places, but nobody seems to know how to do it. I tried TB_PRESSBUTTON and it sets the first button to tbrPressed, but it doesn't run the Toolbar click event.


Code:
Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
'Private Const BM_CLICK As Long = &HF5

Private Const WM_USER = &H400
Private Const TB_PRESSBUTTON = (WM_USER + 3)

Private Sub Command1_Click()
Dim hParent As Long
Dim hChild As Long

hParent = FindWindow("TfrmMain", vbNullString)

If hParent <> 0 Then

hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)

If hChild <> 0 Then
Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)
End If
End If
End Sub

Clicking A Button On Toolbar Of External App
Hello, does anybody know how to click/press the first button on the toolbar of an external application? The code below finds the button and presses it, but the event behind the button is not triggered. How can I trigger the event of that button?


Button is pressed, but event not triggered.
http://img510.imageshack.us/img510/1408/screenlz1.png



Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

'Private Const BM_CLICK As Long = &HF5

Private Const WM_USER = &H400
Private Const TB_PRESSBUTTON = (WM_USER + 3)

Private Sub Command1_Click()
Dim hParent As Long
Dim hChild As Long

hParent = FindWindow("TfrmMain", vbNullString)
Debug.Print hParent

If hParent <> 0 Then

hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)
Debug.Print hChild

If hChild <> 0 Then
Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)
End If
End If
End Sub

Clicking First Button On Toolbar Of External App
Hello, does anybody know how to click/press the first button on the toolbar of an external application? The code below finds the button and presses it, but the event behind the button is not triggered. How can I trigger the event of that button?


Button is pressed, but event not triggered.




vb Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long'Private Const BM_CLICK As Long = &HF5 Private Const WM_USER = &H400Private Const TB_PRESSBUTTON = (WM_USER + 3) Private Sub Command1_Click()    Dim hParent As Long    Dim hChild As Long        hParent = FindWindow("TfrmMain", vbNullString)    Debug.Print hParent        If hParent <> 0 Then                hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)        hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)        hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)        hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)        hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)        Debug.Print hChild                If hChild <> 0 Then            Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)        End If    End IfEnd Sub

Clicking Toolbar Button Within Code
Does anyone know how to cause a toolbar button to be clicked from within a section of code (instead of actually clicking on it with a mouse)? What event do I call, and what parameters must be passed?

Using VB6

Thanks


 

Toolbar, Determine Selected Button (Right Click)
Dear all

Can anyone help me?

I have a Toolbar with a number of buttons. I need to determine which button I select when I right click it.

This may be simple but I cant figure it out.
Can anyone please help?


Best regards

GT

Holding Shift Down And Double Clicking On A Picture
Can anyone post some code to make a message box popup up when a picture box is double clicked on, only when the left shift button is being held down?? Thanks in advance.

Using Time() To Determine A Shift
I'm trying to use the Time() function to determine which shift a person is logging into. I have the following;

Code:
If Time() < "2:00:00 PM" And Time() > "6:00:00 AM" Then
      !Shift = "1st"
ElseIf Time() < "10:00:00 PM" And Time() > "2:00:00 PM" Then
      !Shift = "2nd"
ElseIf Time() < "6:00:00 AM" And Time() > "10:00:00 PM" Then
      !Shift = "3rd"
End If


but it keeps listing everyone as "3rd"

I'm using "with recordset" etc in the code also...

MCP - Windows XP

Edited by - LuiePL on 7/6/2006 2:04:50 PM

How Can I Detect A Button Being Held Down?
I need to keep a variable increasing as a button is held down

How can I do this?

Gausie

Mouse Button Held Down
In vb there is a mouse click event for buttons etc. Does anyone know if there is a way of firing a mousebutton held down event. e.g.

If the command button is clicked and held pressed (not released from the control) then do this code...

If anyone knows any such code event then you would be an absolute guru-king of the vb universe!

Kind regards

ALC

Weird Icon Color Shift On Toolbar (RESOLVED)
Hello everybody

I have this slight problem. My app has a main MDI form with a toolbar. Moreover, the toolbar has buttons (as every toolbar does... ) and the buttons have been covered with a small bitmap image. The original bitmaps have a white background. When I place these images on an ImageList control though, they appear to have a black background.
Does anyone know why the images exhibit this behaviour?

thx, in advance

George Papadopoulos

Run Commands When Clicking One Of The Icons On Toolbar
I have a toolbar with some icons, what kind of event would i use for for running commands when i click on a specific icon? I see a Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button), but am I suppose to use some sort of if event for which icon button is clicked on the toolbar?

Shift Button To Datagrid
hi guys! is it possible to enable shift button to select all the items in a datagrid? can u please give an idea!....

Shift 'Close' Button!
Can the ControlBox (comprising of the Close, Maximize/Restore & Minimize buttons) on the titlebar (at the extreme top right) be shifted towards the left hand side? If yes, then how?

I am mainly interested in shifting the Close button towards the left (not at the extreme left hand side where the Form's Caption comes; somewhere at the 80-85% mark of the titlebar).

Help! How Can I See If The Shift Button Is Pressed?
Code:
Public Const WH_KEYBOARD = 2
Public Const VK_SHIFT = &H10
Public Const VK_CONTROL = &H11

Public bShift As Boolean

Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Public hHook As Long
Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
bShift = False
Form1.label2.Caption = ""
'if idHook is less than zero, no further processing is required
If idHook < 0 Then
'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
Else
'check if SHIFT is pressed
If (GetKeyState(VK_SHIFT) And &HF0000000) Then
'show the result
Form1.label2.Caption = "Pressed"
bShift = True
End If

'call the next hook
KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
End If
End Function

thers the code im using now.. you can tell if the shift button is pressed in the application, but you cant tell if its pressed universally.. anyone know how i can?

CODE For BROWSE BUTTON By CLICKING The BUTTON
i dont know what is the code for browsing files by clicking a button.... can u pls help me???

Creating A Cammand Button From Clicking A Button
Hi, What is the code to create a button? I want to click a button and create a new one on click.

Disable The Shift, Ctrl And Alt Button
Dear all,

I am having a problem on how to disable the Shift key, Alt key and Ctrl key for my application. Does anybody know how I can do it?

Thanks for your sincere advices in advance.

Cheers with best regards,

How Can I Simulate Right Clicking On An Icon On Bottom Windows Toolbar ?
I've wrtten some VBA code to allow user to select files and copy the selection to a rewriteable CD, I'm using INCD packet writing software from nero which runs as a service in the background and allows the write to the CD to be done like writing to a floppy drive. One feature of INCD is it disables the CD eject button on the front of the drive, to eject the user usually moves the cursor over the bottom windows toolbar and right clicks on an icon then presses ctlr+E, this allows INCD to close the CD.

My question is: Using an on screen button on a Visual Basic form how can I recreate the same effect as right clicking on the service icon on the toolbar and sending ctrl+E to the pop-up window.

Click Mouse While Mouse Button Is Being Held
What I want to do is have the program click the mouse button really really fast, while the user is holding the button down. I cant really think of what I could do. I was thinking I could tell it to goto the timer on form_mousedown and in the timer have code to click (dont know the syntax for making the mouse click).
I dont know how I would be able to tell when they let go of the button either.


VB Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    GoTo Timer1_TimerEnd Sub Private Sub Timer1_Timer() mouse_leftclick If MouseDown = False Then    GoTo StopTimerEnd If End Sub Private Sub StopTimer()'Stops the timer from executingEnd Sub


Would that If statement work? I just guessed at it. But if someone could tell me the sytax to click the mouse or if there's a better way to do this let me know please. Thanks

How To Make The Arrow Button In Button Menus To Grey In Toolbar ?
How to make the arrow button in button menus to grey in toolbar

Have a look at samp.jpg file !!

Custom Toolbar Button Mimic Print Button
I have created a custom toolbar button for Word, Excel, and Powerpoint using VB6. What I want to do now is mimic the events of the print button. When the print button disables, I want my toolbar button to disable and vice versa. Does anyone know how to do this. Thanks.

Vb6 Toolbar When Button Depressed Button Face Image
i wish to change the image displayed for 1 of 8 buttons (say the 3rd button).

i'm familiar with style (depressed look)... but can i change the image of the 3rd button from 'say' normal.bmp (in the image list control) to 'say' pressed.bmp.

thx all..have a good yr.

Clicking A Button Twice.
Hello to all and thanks for reading this post.
This is simple i know, but for some reason still boggles my mind.

How would i tell a button (a picture actually) that when clicked on the first time to show another button (picture) but when click on again, it will hide the added button (picture)


Thanks for any replies!

Button Clicking
Does anyone know how to make a button do something different after being clicked a second time?

Here's my case: I need a button, once clicked, to make .visible=true after clicked once. After being clicked again I need it to make .visible=false.

Maybe I'm going about this the wrong way, but basically clicking button needs to make something appear, clicking it again needs to make it disappear.

Anyone got a clue what I'm talking about?

How Do You Run An .exe By Clicking A Button?
I was wondering if it was possible to run an .exe through a command line in VB. I want it so that when I click a button, it'll run a program. (Ex.: CommandButton1 would run C:Program FilesiTunesiTunes.exe)
How would I do this?

Thanks for the help.

P.S. Sorry if this has been answered before, but I couldn't find anything like this when I searched.

Clicking On The 'x' Button
is it possible to run some code in the event of the user clicking on the 'x' button (top right)?

Button Clicking
How can I sense how many times a button was clicked (eg. say a button was clicked twice and on the first time it did one thing but on the second time it did something else then on the third time it went back to what it did on the first click, and it keeps looping itself) THANKS!!!!!!!!!

Clicking A Button Using API..HELP!
Hi, I'm making a program that clicks on a button. This program pops up a box that you have to click "ok" on inorder to stay active. Now, its not a standard Msgbox, its a small form that opens and there is a big button that says "OK". Here is the info:


The Main Programs window class info:

ClassName: "TApplication"
Text: "09"

---------------------------------
The Form that opens up:

ClassName: "TConMsgBox"
Text="10"

----------------------------------

The button:

ClassName: "TButton"
Text: "OK"
------------------------------------
Ok, I'm new to API but here is what I have but it doesn't work.


VB Code:
Do: DoEvents Window% = FindWindow("TForm1", vbNullString) Window2% = FindWindow("TConMSgBox", Window%)   If Window% ThenButton% = FindWindowEx(Window%, Window2%, "TButton", "OK")Click Button% Exit DoEnd IfLoop

any help appreciated! thanks!

Button Clicking
I have a website... say for example this one. I want to make a program to save my passwords and user names and when I go to the site I just press a button and it enters it for me, then clicks the login button. Any idea how to fill in text fields and press buttons on a website through VB code? Any help is GREATLY appreciated. Later,

zer0_flaw

Clicking A Button
hi,

their is a button on a webpage that i have to click before i can move onto the next part..
how can i make vb "click" that button, so my program can move onto the next part?
any help would be great!
thanks

Clicking Button
I am launching a program from my VB app. I then want my app to go ahead and click a button in this app that says Update. Is there some way to do this?

It seems to me that I saw that I will need to use Spy++ to find some information. I am really new to this area and so any help is appreciated. Thanks!

Clicking On A Button...
Hello!
I need to raise a click-event on a command button which is on another application.
How can I manage to do that...
I tried using the windows API PostMessage Function to broadcast the WM_LBUTTONDOWN message to this particular program, but, it seemed not to work...
So, any idea is welcome!
Thank you!

Button Clicking
I have a form with a text field and a button. I don't want the text field to be visible all the time, so what I want to do is when the user clicks the button have the text field become visible and have the button continue to look like it is depressed as long as the text field is visible and then when the user clicks the button again, the text field disappears and the button goes back to normal. Any idea how to do that?

------------------
Ryan

How To Get New Forms By Clicking On A Cmd Button?
Hi, I'm only brand new to VB but I've got to design a GUI for a project that I'm doing (it is to display the results from six different weather instruments). I'm not sure the best way to do this but I thought that it would be a good idea if I could have a main form where the user could click on one of six command boxes (eg, rainfall, wind direction etc) and then another form could pop up for the appropriate choice. However I have no idea how to do this so please any help or advice would be GREATLY appreciated.

Clicking On Submit Button
how do I click on a submit button taht doesnt have a name n the form doesnt have a name?

Clicking On A Submit Button
I have this website that I want to click on a submit button. I already know how to add a value into a text so now I want to submit it. But the submit button doesn't seem to have a name. And the form just has "action=..." and "method=...". BTW, there are 2 submit buttons on the page.

Clicking Command Button Twice...
Hi, I am looking for a way to see if a user has clicked a command button twice, and then if so I would like to disable the command button..

Private Sub btn_equipment_Click(Index As Integer)
Dim tmpFlash, tmpSmoke As String
tmpFlash = 0 'Flash click counter starts at zero.
tmpSmoke = 0 'Smoke click counter starts at zero.

If btn_equipment(2) Then 'If btn_equipment(2) is clicked then.
tmpFlash = tmpFlash + 1 'Add 1 to tmpFlash
If tmpFlash >= 2 Then 'Check to see if command button has been clicked twice.
btn_equipment(2).Enabled = False 'Disable command button.
Else
btn_equipment(2).Enabled = True 'Enable command button
End If
Debug.Print
End If

Debug.Print btn_equipment(Index).Tag
End Sub

Webbrowser (Clicking A Button)
I have a page loaded in the Webbrowser .

Need to click a particular button on the page from my vb program
I have had a look at the source. (the button is called Name ="Refresh1" ID="Refresh1" )... etc

Q1. Is there a simple send command to simulate clicking on this button.
----------------------------------

Q2. Is there a routine to list the controls visible on a webbrowser.
----------------------------------

Appreciate any help.

Clicking On A Button In Webbrowser??
I have a big problem I want to login to website, but I cannot press the button to submit the username and password.

Could you take a look at this page.
http://www.orangeworld.ch/login?&vie...on_begin_login
or
http://www.orangeworld.ch

Can you look at the Source code and figure out how to press the button in Webbrowser.

I would be very thankful for this!

tomaa

CLicking A Button In A Frame?
I know some other people also asked for this, and i tried to search the forum, but didn't got any answers that i found working.

So here we go again

Lets say i have this page with 2 frames. A login, and the real page. Now i wanna fill the username called UserName and the password called Password. Normally i would just do something like:

forms(0).Username.Value = "Myusername"

But I can't get that working.

Clicking A Button On A Web Page
I have been trying to get vb to automate a click of a button on a web page in webbroswer. The button on the page is <input type="submit" class="bginput" value="Agree">. WebBrowser1.Document.Forms(0).submit.Click works but, after it clicks it, it says error:object required. How can i get it to work?

Clicking Button On Web Page Through VB
I need to modify my VB code to click a button on a web page. The code I currently have is:

Dim oTrack

Set oTrack = docHTML.All("track")
oTrack.Click

This has worked fine but now the web developer for the webpage has made a change to block programs like mine because of 3rd party auditors. I am just trying to check on my own packages. They blocked it by naming a blank gif image "track" as well as the button that I am trying to click. Any ideas? I am new to VB, I would consider myself an amatuer but can modify code here and there. Any help would be greatly appreciated.

Bm_click Vs Clicking A Button...
I'm using:
btnpush = SendButtonMessage(newqt, BM_CLICK, 0, 0)

to open a window on another app, and trying to use:

progr = FindWindow(vbNullString, "New Quote")
If progr <> 0 Then
MsgBox "Good"
Exit Sub
Else
' Msgbox "No Good"
End If
Exit Sub

to try and determine when the page is opened. The problem I'm running into is that when using the sendbuttonmessage function, The findwindow isn't working, If I click on the button manually, I can find it, but using sendmsg, I'm returning nothing, anyone have an idea as to why?? Thanks for any help.

Clicking A Button On The Webbrowser.
OK guys , I know how to click a normal button with the Name property, but I have a listbox and a button next to it. I can select an item from the listbox - no problem, but I want to be able to click the button as well.
The code for the button is this:


Code:
<input class="btnlite" type="submit" value="Go" />


Could anyone help me?

Could Somebody Help Me Testing Please(by Clicking A Button)
I have just finished my program.
It connects to a USB interface board.
When the button(at www.purpledog.nl/led.php) is clicked,
my LED at home, is turned on/off(depending on it's recent status).
It worked when I tried it myself, but the app in running on my system, so I'm not sure if it also works with other people.

Thanx

Copyright © 2005-08 www.BigResource.com, All rights reserved