tamir Posted February 4, 2005 Posted February 4, 2005 i have a simple function to create TCP connection: Func TCPConnect() DLLCall("au3xtra.dll","int","TCPStartUp") $MainSocket = DllCall("au3xtra.dll", "int", "TCPListen", "str", "127.0.0.1", "int", 9342, "int", 100) If @error Or $MainSocket[0] < 0 Then MsgBox(0, "", "An error occured") Else ... (some other code, nvm) EndIf EndFunc and another function that opens a "file open dialog": Func BrowseFilePath($var) $select = FileOpenDialog("Browse", @ScriptDir, "(*.exe)", 1+2) If Not (@error = 1) Then GUICtrlSetData(Eval($var), $select) EndIf EndFunc when i call the TCPConnect() function it is creating TCP connection and everything working fine. but if i use the BrowseFilePath() function before then when i try to use TCPConnect() it gives me the error message and $MainSocket somehow equals to 0. how come that the browse function cause error to the tcp connection?
tamir Posted February 4, 2005 Author Posted February 4, 2005 $MainSocket... i also don't understand y is that... :/
Blue_Drache Posted February 4, 2005 Posted February 4, 2005 $MainSocket... i also don't understand y is that... :/<{POST_SNAPBACK}>I believe that Larry is saying that $mainsocket may have return output in array format. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
tamir Posted February 4, 2005 Author Posted February 4, 2005 i know... it suppose to return array but it doesn't
tamir Posted February 5, 2005 Author Posted February 5, 2005 (edited) so none knows what's the problem? why this function cause $MainSocket to be 0? FileOpenDialog("Browse", @ScriptDir, "(*.*)") Edited February 5, 2005 by tamir
Valik Posted February 5, 2005 Posted February 5, 2005 As a matter of fact, I think I do. FileOpenDialog() changes the working directory for the script, so when it tries to find the Dll, it sets @error. You have two solutions. Specify the full path to the Dll in the DllCall() line or (I'm assuming the DLL is in @ScriptDir), then change the working directory back with FileChangeDir().
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now