JohnD Posted February 23, 2010 Share Posted February 23, 2010 Hi everyone. I am not able to get dllcall to work with send message. $result = DllCall("user32.dll", "int", "Sendmessage", "hwnd", $Edithwnd, "ULONG", $WM_SETTEXT, "WPARAM", 0, "LPARAM", "Hello World.") Anyone know what I am missing here? This is for a control not in my application. Thanks. -JD Link to comment Share on other sites More sharing options...
Minikori Posted February 23, 2010 Share Posted February 23, 2010 (edited) "ULONG" should be "UINT" and the return value isn't and integer, it's an lresult (not quite sure what that is in DllCall() though) http://msdn.microsoft.com/en-us/library/ms644950%28VS.85%29.aspx EDIT: Oh hey 500 Edited February 23, 2010 by Minikori For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
wraithdu Posted February 23, 2010 Share Posted February 23, 2010 What is @error returned by DllCall? I'll bet it's '3 "function" not found in the DLL file'. DllCall function names are case sensitive. Link to comment Share on other sites More sharing options...
JohnD Posted February 23, 2010 Author Share Posted February 23, 2010 What is @error returned by DllCall? I'll bet it's '3 "function" not found in the DLL file'. DllCall function names are case sensitive.Actually, the return value is 0, indicating success. I changed ULONG to UINT but it still doesn't place the text. The constant is declared along with there being a valid window handle, so I don't know what else it could be. $result = DllCall("user32.dll", "int", "Sendmessage", "hwnd", $Edithwnd, "UINT", $WM_SETTEXT, "WPARAM", 0, "LPARAM", "Hello World.") Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 23, 2010 Share Posted February 23, 2010 wraithdu was talking about the value of @error. Also, when DllCall returns 0, that's an indicator of error. DllCall returns an array on a successful call. Link to comment Share on other sites More sharing options...
JohnD Posted February 23, 2010 Author Share Posted February 23, 2010 Sorry, that wasn't clear. It is @error returning 0, not 3. Link to comment Share on other sites More sharing options...
trancexx Posted February 23, 2010 Share Posted February 23, 2010 Sorry, that wasn't clear. It is @error returning 0, not 3....sure it is ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 23, 2010 Share Posted February 23, 2010 There is no function called "Sendmessage" in that dll. There's no way @error says 0. Link to comment Share on other sites More sharing options...
MHz Posted February 23, 2010 Share Posted February 23, 2010 Look at SendMessage.au3 in your include folder for some information. Perhaps just include SendMessage.au3 and use that. Syntax _SendMessage($hWnd, $iMsg[, $wParam = 0[, $lParam = 0[, $iReturn = 0[, $wParamType = "wparam"[, $lParamType = "lparam"[, $sReturnType = "lresult"]]]]]]) Function in SendMessage.au3 Func _SendMessage($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lresult") Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessageW", "hwnd", $hWnd, "uint", $iMsg, $wParamType, $wParam, $lParamType, $lParam) If @error Then Return SetError(@error, @extended, "") If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn] Return $aResult EndFunc ;==>_SendMessage Include it #include <SendMessage.au3> Link to comment Share on other sites More sharing options...
JohnD Posted February 24, 2010 Author Share Posted February 24, 2010 Look at SendMessage.au3 in your include folder for some information. Perhaps just include SendMessage.au3 and use that. Syntax _SendMessage($hWnd, $iMsg[, $wParam = 0[, $lParam = 0[, $iReturn = 0[, $wParamType = "wparam"[, $lParamType = "lparam"[, $sReturnType = "lresult"]]]]]]) Function in SendMessage.au3 Func _SendMessage($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lresult") Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessageW", "hwnd", $hWnd, "uint", $iMsg, $wParamType, $wParam, $lParamType, $lParam) If @error Then Return SetError(@error, @extended, "") If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn] Return $aResult EndFunc ;==>_SendMessage Include it #include <SendMessage.au3> Thanks MHz! It took a little tinkering bc I am new to this language but I got it working. I appreciate the help. 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