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

August 10th, 2006, 07:05 AM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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)
|
|

August 10th, 2006, 11:45 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
What does PostData(data) look like? (What are the contents?)
|
|

August 11th, 2006, 01:10 AM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

August 14th, 2006, 03:35 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
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?
|
|

August 17th, 2006, 01:22 AM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

August 17th, 2006, 10:11 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
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)
|
|

August 22nd, 2006, 08:42 AM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It is not working. Is there any possiblity to open a page with posting the data as method post.
|
|
 |