4 Replies - 916 Views - Last Post: 23 November 2009 - 02:41 PM Rate Topic: -----

#1 Xallen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-October 09

VB6 Shortcut button

Posted 21 November 2009 - 05:02 PM

I made a Command1 button in visual basic, I want to know how to make this button a shortcut key.
So that if I click it, it will open up the program I want.

For example, if I clicked a button labeled Firefox, it would open Firefox.

Could you enter the code required and explain it (only been doing VB6 for 3 days).
Is This A Good Question/Topic? 0
  • +

Replies To: VB6 Shortcut button

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1619
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: VB6 Shortcut button

Posted 21 November 2009 - 05:02 PM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 Xallen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 05-October 09

Re: VB6 Shortcut button

Posted 21 November 2009 - 05:07 PM

I have:
Private Sub Command2_Click()
shellexecute (filename)
End Sub


That is all, but it is not working

This post has been edited by Xallen: 21 November 2009 - 05:25 PM

Was This Post Helpful? 0
  • +
  • -

#4 Nash29  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 24
  • Joined: 17-November 09

Re: VB6 Shortcut button

Posted 23 November 2009 - 08:26 AM

View PostXallen, on 21 Nov, 2009 - 04:07 PM, said:

I have:
Private Sub Command2_Click()
shellexecute (filename)
End Sub


That is all, but it is not working


Hey there.. If your firefox is installed in Program Files(typically), then you can use the following code. You need to use Shell() function to run the exe and Environ$() to locate Program Files directory.

Try this... (in VB6)
Private Sub Command2_Click()
	Dim Browser
	Browser = Shell(Environ$("ProgramFiles") & "\Firefox\firefox.exe")
End Sub


That's it.. :D
Was This Post Helpful? 0
  • +
  • -

#5 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 458
  • View blog
  • Posts: 4,222
  • Joined: 25-March 09

Re: VB6 Shortcut button

Posted 23 November 2009 - 02:41 PM

hi dude :)

i bet 3 min search in Google will do. Like so :

http://www.google.co...&...-8&oe=utf-8

remember Google is your friend :)

This post has been edited by NoBrain: 23 November 2009 - 02:43 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1