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,281 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
  • 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 85

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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 85

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 85

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now