Access ASP link from VB 6.0 Desktop App

Posted on 2004-11-01
Last Modified: 2012-05-05
I am not a VB developer and I need help to integrate an ASP web application with a VB 6.0 desktop. application.  This may be an easy question but I have no idea how to do this. PLEASE HELP!!!

I want users to be able to click on a button in the VB application that will open a web form provided by an ASP 3.0 application. Security information needs to be passed to the ASP page to determine permissions for the appropriate user.
Question by:cheyennejk
    LVL 16

    Expert Comment

    If your security details are passed to the ASP app with the querystring (the bit in the web address after a ?), you could compile an address string from the app homepage and your user details and use the ShellExecute API to open it...

        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
                                                    'DECLARE API FUNCTION
        Private Sub CommandButton1_Click()
            strUserName = "thisUser01"              'THE USERNAME -- USE YOUR METHOD
            strPassword = "thisPassword01"          'THE PASSWORD -- USE YOUR METHOD
            strASPApp = "http://www.myaspapp.asp"   'THE APP START PAGE
            strShellAddress = strASPApp & "?user=" & strUserName & "&pass=" & strPassword
                                                    'COMPILE QUERY STRING FROM DATA/FORMAT
            ShellExecute Application.hwnd, "", strShellAddress, "", "", 1
                                                    'OPEN BROWSER PAGE
        End Sub

    Otherwise, if you want to keep the browser within the Application, you can use a browser control, with similar effect...


    LVL 16

    Accepted Solution

    You may have to change

         ShellExecute Application.hwnd, "", strShellAddress, "", "", 1


         ShellExecute Me.hwnd, "", strShellAddress, "", "", 1

    if it throws up an error on this line...

    LVL 2

    Author Comment

    Im afraid that being new to VB, Im a little slow.

    Suppose I have a single form with a single button. Where do i declare the API function?
    LVL 16

    Expert Comment

    API declaration would go in the General/Declarations section of the form or, if that doesn't work, inside its own module.  If it does need to go in its own module, you will need to change Private Declare to Public Declare...

    LVL 2

    Author Comment

    Nevermind my last comment, I got it working.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    934 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

    20 Experts available now in Live!

    Get 1:1 Help Now