Sign in to follow this  
Followers 0
tamir

really weird problem

7 posts in this topic

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?

Share this post


Link to post
Share on other sites



$MainSocket... i also don't understand y is that... :/

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

i know... it suppose to return array but it doesn't

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

so none knows what's the problem?

why this function cause $MainSocket to be 0?

FileOpenDialog("Browse", @ScriptDir, "(*.*)")
Edited by tamir

Share this post


Link to post
Share on other sites

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().

Share this post


Link to post
Share on other sites

you're right! woah, thanks alot!! :lmao:

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0