Skip to main content

Place a hyperlink in VB Program


I was wondered about, how to place a website hyperlink in a program.
I searched a lot on the internet but I didn't get it.
The following format was expected by me .

"Created by SACHIN",
where clicking on "SACHIN" would launch the system's default browser and open http://softbysachin.blogspot.com
OR
"Created by sd0389@gmail.com",
where clicking on the e-mail address would launch the system's default mail client such as Outlook etc.


         Then I remembered the shellexecute function which we normally use in Autorun CDs. I searched on internet about shellexecute function, and then I got the library in which the function was located and that was shell32.dll.

         Then I declared a private function in the program as follows :

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


This function would declare the shell32.dll in the program.
Then I just used shellexecute function as follows in menu.(But you can use it anywhere in the program such as in  a button or a picture etc.)



Private Sub Website_Click()
ShellExecute Me.hwnd, "open", "http://softbysachin.blogspot.com/", vbNullString, "", 0
End Sub



That's all,
when you click on the desired button, or text link then the new browser window will open and the desired website will load in it.

Comments

Popular posts from this blog

C programs to create pyramid structures

Q1.  Write a C program to create pyramid structure as shown below : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Code: //Author : Lakshmikant A. Deshpande #include<stdio.h> #include<stdlib.h> void main() { int i=1,j=5; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) printf("%d ",j); printf("\n"); } } Q2.  Write a C program to create pyramid structure as shown below :     1      1 2     1 2 3  1 2 3 4 1 2 3 4 5 Code: //Author : Lakshmikant A. Deshpande #include<stdio.h> #include<stdlib.h> void main() { int spaces=4; int i,j,k; for(i=1;i<=5;i++) { for(k=0;k<spaces;k++) //Print spaces printf(" "); for(j=1;j<=i;j++) { printf("%d ",j); } for(k=0;k<spaces;k++) //Print ...

Enable Developer Tools in Moto G

As we know, Moto G is a fantastic and affordable phone by Motorola and Google !! Moto G surprisingly provides specifications that the phones with double price could provide. Are you too a nerd too, trying to explore your brand new phone ? You are at the right place. Initially developer options used to be visible. Later, with the release of Android 4.2 Jelly Bean (JB)  Google decided to hide those settings, because people used to play with developer tools, even if they did not know what those settings could lead. Follow the steps. 1. First of all get a Moto G, if you still don't have it... 2. Open settings. 3. Scroll down to bottom. 4. Touch on 'About Phone' 5. Tap on Build Number 7 times You are good to go... :)

Moto G Tips and Tricks

Hey there ! You got a Moto G ? Awesome. You bought the Motorola's most successful phone ever. It's the best phone you can get by spending  less than 200$. The Motorola and Google have done some magic over the phone and it's still difficult to find out what exactly they have done to bring down the price bar. Smart typing with Google Keyboard.   Google has introduced Google keyboard in Kitkat with gesture based typing which lets you type by just swiping your finger through the letters of intended word. It's an incredible way of typing which gets better and better as you go on using it. Google currently haven't added a facility to fetch slang words/popular acronyms from social networks. Getting help from Motorola   Motorola has provided a nice application for providing easy access to help. It is also one of the only few apps Motorola has added to keep the operating system more close to stock android. To access this service, just click on Help icon in launche...