Click here to Skip to main content
15,888,056 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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

Private Sub winsock1_Click()
winsock1.close
winsock1.remotehost="talk.google.com"
winsock1.remoteport="5222"
winsock1.conection
winsock1.localhost="127.0.0.1"
winsock1.localport="5222"
end sub


Private Sub Form_Load()
If winsock1 = 1 Then
ShellExecute Me.hwnd, "open", "http://www.codeproject.com/", "", "", vbNormalFocus
label1.Caption = "Connected"
Else
label1.Caption = "Not Connected"
End If
end sub

hii all why my program cannot run help me error

if conection open ie http://www.codeproject.com
canot open target web

for access conetion game online
because port standard 8080 slow loading

:confused::confused::confused:
Posted
Updated 18-Dec-09 20:12pm
v6

OK, I still don't see what you're trying to do. What is winsock1 ? Why is it trying to find talk.google.com ? Is that just a check if the computer is online ? Of course, your connect button code is not going to run until you click it, and your winsock = 1 code will run before that.

This whole thing is a dogs breakfast. 'canot open target web' is definitely not the exact error message. And, I repeat, importing ShellExecuteA is redundant when you can use Process.Start without importing anything.

I just compiled and ran this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("www.codeproject.com")
End Sub

It worked fine. I did just create a Label on a winforms app and it does NOT have a Caption property. A WPF label does not have a Caption property either. Start again, tell us what this winsock thing is, tell us why you need to use ShellExecuteA, etc. Are you even using VB.NET, as you claim ? Because me.Hwnd is NOT valid in VB.NET, me.Handle is. your pinvoke signature as posted was also incomplete, and once I fixed it, I found it plain did nothing ( but, no errors ). Get rid of the pinvoke, or explain to use why you feel you need to use it. Post the actual full error message and clarify the line that causes it. Tell us what the winsock1 object is an instance of, and what you need it for.
 
Share this answer
 
Well, you're wasting a lot of effort on p/invoke when the Process class will do what ShellExceute does.


Beyond that, if you told us which bit 'does not run', what the error is, and what you were expecting to see, as opposed to what happens, then we'd be able to answer you. Please edit your post accordingly, and also fix the title ( I'd fix it for you, but you need to edit it anyhow to add detail ). 'help me project' is useless. Your title should actually describe your problem.
 
Share this answer
 
thanks broder

i wrong winsock1 = cmdConnect_Click()

:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900