Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Open a URL via GUI button?


Ganjika
 Share

Recommended Posts

I have dragon eclipse and want to turn the jukebox GUI button on the main in-game menu (on the right hand side of the screen where it says "inv, spells, etc") into one that says Wiki and opens up the wiki-site created for the game. How would i accomplish this?I don't neccasarily want to get rid of jukebox - just make the button for it on the gui not exist and be a button for opening wiki instead and not having a button for jukebox on gui.
Link to comment
Share on other sites

Creat a new button named cmdWeb and code this

Private Sub cmdWeb_click ()

Shell ("Explorer YOUR WEBSITE")

End Sub

This should work…

If that does then close it and don't save. Then open vb back up and try double clicking the origional button. Delete the code and place previous code in. Im just not to sure if you will get a compile error if you edit the origional button.

BTW make sure you go "run with full compile" when u test it.

If this doesn't work then PM me and I will sus it out when I get home from work and give you the proper way. XD
Link to comment
Share on other sites

> ```
> Private Sub cmdWeb_click ()
>
> Shell ("Explorer YOUR WEBSITE")
>
> End Sub
> ```

It's a better idea to open the default browser instead. As shown in [this article](http://support.microsoft.com/kb/224816), the code looks somewhat like:

```
Private 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

Private Sub WebsiteButton_Click()

Call ShellExecute(Me.hwnd, "open", "http://www.google.com/", _

vbNullString, vbNullString, vbNormal)

End Sub
```

Yours faithfully

S.J.R. van Schaik.
Link to comment
Share on other sites

> It's a better idea to open the default browser instead. As shown in [this article](http://support.microsoft.com/kb/224816), the code looks somewhat like:
>
> ```
> Private 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
>
> Private Sub WebsiteButton_Click()
>
> Call ShellExecute(Me.hwnd, "open", "http://www.google.com/", _
>
> vbNullString, vbNullString, vbNormal)
>
> End Sub
> ```
>
> Yours faithfully
>
> S.J.R. van Schaik.

Wow that's a long code XD no idea how it works but it looks fancy :)
Link to comment
Share on other sites

> Wow that's a long code XD no idea how it works but it looks fancy ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

It only does two things:

* Declare the ShellExecute function (i.e. telling Microsoft Visual Basic 6.0 that it exists, what its arguments look like, and where to find it).
* Call that function to open the URL (internally, the function will use the registry to actually open it with the right programme).

Yours faithfully

S.J.R. van Schaik.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...