Results 1 to 6 of 6

Thread: School Assignment - Open IE {resovled}

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    New South Wales, Australia
    Posts
    55

    Resolved School Assignment - Open IE {resovled}

    Hello,

    Im quite a beginner and i was wondering if there was ANY code for VB6 that would allow me to open an Internet Explorer Window when my user presses the Help Button.

    ANY help would be excellent
    Darcey
    Last edited by darcey_123; Jun 13th, 2005 at 10:02 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: School Assignment - Open IE

    Moved From The CodeBank.

    Welcome to the Forums darcey_123.

    Actually, there are a wide variety of ways to open an IE Window. Here is one, and I'm sure other members will post other ways.
    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    2. (ByVal  hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
    3. ByVal lpParameters As String, ByVal lpDirectory As String, _
    4. ByVal nShowCmd As Long)  As Long
    5.  
    6. Private Sub cmdHelp_Click()
    7.    Dim lngOpenPage As Long
    8.      lngOpenPage = ShellExecute(Form1.hwnd, "Open", "http://www.vbforums.com",  0&, 0&, 0&)
    9. End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    New South Wales, Australia
    Posts
    55

    Re: School Assignment - Open IE

    Hey Hack
    Thanks for your reply....however i think it needs some explaining...

    Form1.hwnd <-----wats this? do i need to change to a specific form?

    and also when i go to run it i get an error sayin that a comment can only be put after end sub, end property......

    the code you gave me isnt a comment so wat is it on about it??

    Neway Thank You soo much for help and i a cant wait to here ur reply
    Darcey

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: School Assignment - Open IE

    Quote Originally Posted by darcey_123
    Hey Hack
    Thanks for your reply....however i think it needs some explaining...

    Form1.hwnd <-----wats this? do i need to change to a specific form?
    Thats what can be called the reference number to a Window. Its the thing that Windows uses to keep track of all its windows
    These are called handels and are used by many API functions and Windows its-self internelly

    Quote Originally Posted by darcey_123
    and also when i go to run it i get an error sayin that a comment can only be put after end sub, end property......

    the code you gave me isnt a comment so wat is it on about it??

    Neway Thank You soo much for help and i a cant wait to here ur reply
    Darcey
    API Declerations normally go at the top of the form, did you put them at the top?

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: School Assignment - Open IE

    First, the API declaration needs to go in the General Declarations section of your form.

    Do you know what I mean by the General Declarations section?

    Form1 is an example. You have a form in your project now. I don't know what it is called, but change Form1 in my example to your forms name, so that parameter would read: frmYourFormsName.hwnd

    (PS: The hwnd property contains the handle of your form which the ShellExecute API requires in order to perform the requested task.)

  6. #6

    Thread Starter
    Member
    Join Date
    Jun 2005
    Location
    New South Wales, Australia
    Posts
    55

    Re: School Assignment - Open IE

    Hey Guys,

    THANK U SOOO MUCH..you have made my assignment alot easier.....god i cant thankyou enuf.

    Thank you again Darcey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width