just improving on cookies code
code:
Private Declare Function ShellExecute Lib "SHELL32" 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
Private Sub Command1_Click()
Dim URLString As String
URLString = "http://www.google.com/search?q=" & Encode(Text1.Text)
ShellExecute 0&, vbNullString, URLString, vbNullString, vbNullString, vbNormalNoFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
Public Function Encode(ByVal s As String) As String
Dim sChar As String, sAsc As String, sHex As String, sName As String
Dim I As Integer
For I = 1 To Len(s)
sChar = Mid$(s, I, 1)
sAsc = Asc(sChar)
If sAsc = 32 Then
sHex = "+"
Else
sHex = sChar
End If
sName = sName & sHex
Next I
Encode = sName
End Function
i quickly made a encode function that checks for a space(ascii 32) and then replaces it with a +.
Works perfectly
(in vb... )