Solved

How can I open “My Computer” window

Posted on 2002-07-26
7
225 Views
Last Modified: 2010-05-02
Hi,

What is the code which may do the following:
Open “My Computer” window by pressing “F11”  or any other Key. I use Windows 98.

Your efforts are completely appreciated.

Thanx in advance
Ray14
0
Comment
Question by:ray14
  • 4
  • 2
7 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 7179932
Private Sub Command1_Click()
Shell "command.com /c explorer.exe /n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", vbHide
End Sub
0
 
LVL 1

Accepted Solution

by:
adam8 earned 200 total points
ID: 7179974
If you put a timer on the form and set it's interval to say, 80, then this will check for when you press the F11, or whatever button.

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Sub Timer1_Timer()
    If GetAsyncKeyState(vbKeyF11) = -32767 Then
        'Run My Computer
    End If
End Sub
0
 
LVL 1

Expert Comment

by:adam8
ID: 7179984
To run My Computer you can use.

Shell "Explorer /n,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", vbNormalFocus
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 28

Expert Comment

by:vinnyd79
ID: 7179990
You could use something like this to create a hotkey to launch My Computer

http://www.freevbcode.com/ShowCode.Asp?ID=987
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 7179997
The link I posted for the hotkey will respond even if your app does not have the focus.
0
 

Author Comment

by:ray14
ID: 7180146
Hi Experts,

Thank you so much, you gave me excellent answers specially "adam8" who let me use F Keys as I asked in my quesion.

Please, I shall be very happy if you give me the code which can close the window (My Computer) by pressing F10

Many Thanks in advance
Ray14
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 7180204
you could try changing the timer routine to this:

Private Sub Timer1_Timer()
   If GetAsyncKeyState(vbKeyF11) = -32767 Then
    ' run my computer
   End If
   If GetAsyncKeyState(vbKeyF10) = -32767 Then
       SendKeys "%{F4}", True
   End If
End Sub

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

743 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

10 Experts available now in Live!

Get 1:1 Help Now