Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 10th, 2006, 07:05 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eyuvaraj Send a message via Yahoo to eyuvaraj
Default Internet Page Opening

Hi,
 Any body knows, how to open a webpage with default browser with pass the data with post method. I can able to open a page using shellexecute but I am not able to post my data to that page.

I am using the following code for shell execute.

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

ShellExecute(Me.hwnd, "Open", "http://www.supportminds.com/users/login.php?" & PostData(data), _
       vbNullString, App.Path, vbNormalFocus)


 
Old August 10th, 2006, 11:45 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What does PostData(data) look like? (What are the contents?)
 
Old August 11th, 2006, 01:10 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eyuvaraj Send a message via Yahoo to eyuvaraj
Default

It is a private function to convert into binary form. It is given below.

Private Function PostData(ByVal strPostData As String)
    '
    ' Convert the text to a byte array. Sending binary data
    ' is a little different but not much.
    '
    ' This code is only needed when using the POST method
    '
    Dim ByteArray() As Byte
    Dim intNewBytes As Integer
    Dim strCH As String
    Dim i As Integer

'MsgBox (strPostData)
    intNewBytes = Len(strPostData) - 1

    If intNewBytes < 0 Then
     Exit Function
    End If

    ReDim ByteArray(intNewBytes)

    For i = 0 To intNewBytes
     strCH = Mid$(strPostData, i + 1, 1)

     If strCH = Space(1) Then
        strCH = "+"
     End If

     ByteArray(i) = Asc(strCH)
    Next
    'MsgBox (ByteArray)
    PostData = ByteArray

End Function

 
Old August 14th, 2006, 03:35 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What happens when you try this? You say that it does not work, but do you get an error? Page opens without the data? Nothing discernable happens?
 
Old August 17th, 2006, 01:22 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eyuvaraj Send a message via Yahoo to eyuvaraj
Default

Page is opening without login. That is the problem. I want to know which how to pass the data with that page with post data.

 
Old August 17th, 2006, 10:11 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I think I would do this:
Code:
Private Function PostData(ByVal PostData As String) As String

    Dim strOut As String
    Dim intBytes As Integer
    Dim strCH As String
    Dim i As Integer

       intBytes = Len(PostData)
    If intBytes = 0 Then Exit Function

    For i = 1 To intBytes
        strCH = Mid$(PostData, i, 1)
        If strCH = Space(1) Then strCH = "+"

        strOut = strOut + strCH
    Next

    PostData = strOut

End Function
Of course, you could do the entire process of PostData as I've modified it by instead using:
Code:
    ShellExecute(Me.hwnd, _
                 "Open", _
                 "http://www.supportminds.com/users/login.php?" & Replace(data, Space(1), "+"), _
                 vbNullString, _
                 App.Path, _
                 vbNormalFocus)
 
Old August 22nd, 2006, 08:42 AM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to eyuvaraj Send a message via Yahoo to eyuvaraj
Default

It is not working. Is there any possiblity to open a page with posting the data as method post.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening page layout... photon BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 October 7th, 2008 04:22 PM
How can I access a Web page by Internet Explorer Hoang Excel VBA 7 March 11th, 2008 04:42 AM
Opening a customized page Snuffles ASP.NET 2.0 Basics 8 April 1st, 2007 10:53 AM
Internet Explorer cannot open the internet site cathiec ASP.NET 2.0 Basics 1 October 22nd, 2005 01:30 PM
Loading XML from internet on ASP page Rustam_pascal XML 0 March 2nd, 2005 07:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.