Solved

Desktop Icons and Mouse

Posted on 1998-09-14
3
131 Views
Last Modified: 2010-04-30
Hi all,
    Does anyone know how i can open the My Computer window, Network Neighborhood window and Recycling bin window??? I need it to open when i click a button. Also does anyone know a custom control or anything else that will let me move the mouse cursor and let me double click and click the left and maybe the right mouse button?? thanks
                  - Bart
0
Comment
Question by:Bart235
3 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 1434808
What are you asking? You open the icons by clicking on them? Do you want them to be open at startup? Open all three with one click?

"does anyone know a custom control or anything else that will let me move the mouse cursor and let me double click and click the left and maybe the right mouse button??"

Umm, I thought this is how Windows works? Obviously I'm not understanding what you're after here...
0
 
LVL 2

Accepted Solution

by:
wj7ster earned 100 total points
ID: 1434809
You can use the SetCursorPos API to position the mouse

' --------------------------------------------------------------------------------------------------
Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long

Then you can use the mouse_event API to simulate button clicks etc.

Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Public Const MOUSEEVENTF_RIGHTUP = &H10
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_MOVE = &H1
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_ABSOLUTE = &H8000

Here is an explanation of the mouse_event API parameters:

Parameter      Description
dwFlags            A combination of the MOUSEEVENTF_xxx constants above.  I think the are pretty sraight forward.
dx, dy            Specifies the absolute position or relative movement depending on if the MOUSEEVENTF_ABSOLUTE flag is specified.
cButtons      Unused
dwExtraInfo      Typically unused
      
' ---------------------------------------------------------------------------------------------------
'In order to open the folders...use

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Useage:

lRet = ShellExecute(Me.hWnd, vbNullString, [PathToOpen], vbNullString, "C:\", 1)

' ---------------------------------------------------------------------------------------------------

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1434810
Bought This Question.
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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

21 Experts available now in Live!

Get 1:1 Help Now