MadaraUchiha Posted November 7, 2013 Share Posted November 7, 2013 Hi, I am currently learning how to use DLLCalls etc. So I made my first script, using the help files instructions etc: Local $dwFreq = 600 Local $dwDuration = 1500 Local $DLL_BEEP = DllCall("kernel32.dll","BOOLEAN","Beep",'UINT',$dwFreq,'UINT',$dwDuration) This works perfectly fine, but I checked PInvoke and MSDN, and it says it has a return type (Boolean in this case) How can I get the return type, if it succeeded or not, and if not, why? Using GetLastError or something similar? Link to comment Share on other sites More sharing options...
MadaraUchiha Posted November 7, 2013 Author Share Posted November 7, 2013 And also... If I try it like this: Func SYS_BEEP($dwFreq,$dwDuration) Global $BEEP_Return = DllCall("kernel32.dll","BOOLEAN","Beep",'UINT',$dwFreq,'UINT',$dwDuration) EndFunc SYS_BEEP(343,500) MsgBox(0,'Result','DllCall Result was: ' & $BEEP_Return[0]) It returns me 1 (true?); - even if I set garbage as parameters like letters instead of numbers for the duration. It still returns 1?? Link to comment Share on other sites More sharing options...
kylomas Posted November 7, 2013 Share Posted November 7, 2013 (edited) MU, Run it like this and look at DLLCALL in the Help file... #include <array.au3> Local $dwFreq = 600 Local $dwDuration = 1500 Local $DLL_BEEP = DllCall("kernel32.dll","BOOLEAN","Beep",'UINT',$dwFreq,'UINT',$dwDuration) _arraydisplay($DLL_BEEP) kylomas edit: Feed the call garbage and look at the parms when the callreturns Edited November 7, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
MadaraUchiha Posted November 7, 2013 Author Share Posted November 7, 2013 If i change for example the durations param to some garbage, it returns 0 for duration, but main result, $Result[0] is still 1? Link to comment Share on other sites More sharing options...
kylomas Posted November 7, 2013 Share Posted November 7, 2013 Yes, I see what you mean. Tried feeding it -1 string($dwFreq) with $dwFreq = 'a' chr($dwFreq) and none of that makes the function fail...? Maybe someone else has an idea... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
MadaraUchiha Posted November 8, 2013 Author Share Posted November 8, 2013 Hm, okay, the problem is still unsolved... Link to comment Share on other sites More sharing options...
trancexx Posted November 8, 2013 Share Posted November 8, 2013 There are no problems here. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
kylomas Posted November 8, 2013 Share Posted November 8, 2013 trancexx, Are you saying that DLLCALL concerts whatever you feed it into a dWord, consequently the call never fails (keeping in mind that 0 is a valid value)? Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
trancexx Posted November 8, 2013 Share Posted November 8, 2013 If that word is "converts" then yes. Whatever you pass as argument is converted to specified type before the actual call happens. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
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