Solved

[Left Click] via mouse_event API becomes a [Right Click --> Properties] selecton on Win XP Quick Launch button?

Posted on 2004-08-12
8
2,290 Views
Last Modified: 2012-08-13
For any experts who are comfortable with heavy API usage...

Take a look at the fine solution I posted here:  *pats self on back*
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21091072.html

The app has a small quirk in it that I just can't figure out...

If the app sends a click to a button residing on my XP Quick Launch bar (down on the task bar)...instead of launching the application associated with that button, I instead get the properties dialog for that button as if I had Right clicked on it and selected Properties.

Can anyone else duplicate this problem and if so, shed some light on it?

I am running VB6 on Win XP Pro with all service packs and updates installed.

Regards,

Idle_Mind
0
Comment
Question by:Mike Tomlinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 7

Assisted Solution

by:Burbble
Burbble earned 50 total points
ID: 11794582
I cannot duplicate the problem on Windows Millenium, I can try it on 2000 when I get a chance...

Does

    mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0

have the same problem for you as

    mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, x, y, 0, 0

?


-Burbble
0
 
LVL 86

Author Comment

by:Mike Tomlinson
ID: 11796134
Yes...both configurations produce the same result.

Thank you for taking the time to try it out.

Idle_Mind
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 11836203
it's b/c alt is still pressed down when you issue the click event... toggle it off.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 18

Accepted Solution

by:
bobbit31 earned 450 total points
ID: 11836295
it goes w/o saying that you already know how to do this... but to make your life easier:

Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Public Const VK_ALT = &H12
Public Const KEYEVENTF_KEYUP = &H2

...


Private Sub clickGrid(ByVal grid As Long)
    Dim x As Single
    Dim y As Single
   
    ' erase currentgrid
    DrawGrid
   
    ' turn off capturing
    capturing = False
   
    ' calculate new region
    ' and point to click
    calculateNewRegion grid
    x = (currentRegion.Left + currentRegion.Right) / 2#
    y = (currentRegion.Top + currentRegion.Bottom) / 2#
   
    ' click the center of the selected grid
    Call SetCursorPos(x, y)

    keybd_event VK_ALT, 0, KEYEVENTF_KEYUP, 0 '' *** <---- HERE ***

    mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, x, y, 0, 0
    'mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
    'mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0
End Sub

I've tested it and it works... at least for me.

btw: nice piece of code.
0
 
LVL 86

Author Comment

by:Mike Tomlinson
ID: 11837492
LOL....    =)

Very nice sleuthing!

I never before realized that holding down Alt and clicking a Quick Launch button brought up its properties dialog.

Thank you bobbit31 for pointing out what is painfully obvious now!

If you comment in these links, I will give you additional points there as well:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21095453.html
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21098934.html

Thanks....I can once more sleep peacefully,

Idle_Mind
0
 
LVL 7

Expert Comment

by:Burbble
ID: 11840942
lol... good job. Clever trick to bring up the properties dialog, I guess (?).

Thanks for the points, although I don't think I deserve them... I didn't really do anything ;-)

-Burbble
0
 
LVL 86

Author Comment

by:Mike Tomlinson
ID: 11841047
You took the time to read the question, build the project and test it out for me.

Personally, I hate it when I participate constructively in a question but don't get points because I didn't have the "complete" answer.

Thanks again,

Idle_Mind
0
 
LVL 7

Expert Comment

by:Burbble
ID: 11841095
Oh... See, about that: I didn't compile the whole project, it was just the clickGrid subroutine I tested. That's why it "worked". The ALT+Click thing DOES bring up the properties dialog on Windows Millenium (probably a feature of Internet Explorer 4 and later).

-Burbble
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question