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,292 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

623 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