Jump to content

DllCall user32 with _sendmessage function


Recommended Posts

Hi,

I saw in some udf send message function with user32 dll but with only mouse keys and with hexadecimal numbers like "0x0101" so is it possible to send alpha key with hexadecimal numbers like IsPressed (I dont want to have more explaination because I developped functions based on IsPressed function)

Cheers, FireFox.

Edited by FireFox
Link to comment
Share on other sites

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

@ProgAndy

Already saw that but I understand little thing of all... how tu use it with autoit ?

found a little thing in helpfile but not usefull :

Message : WM_CHAR
  Code : 0x0102 
  Code : 0x000E
Message : WM_GETTEXTLENGTH

Cheers, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Example:

#include <sendmessage.au3>
#include <windowsconstants.au3>

$pid=Run("notepad")
WinWait("[CLASS:Notepad]")
WinActivate("[CLASS:Notepad]")
$controlhwnd=ControlGetHandle("[CLASS:Notepad]","","[CLASS:Edit]")

For $i=0x30 To 0x39
_SendMessage($controlhwnd,$WM_CHAR,$i)
Next

sleep(2500)

ProcessClose($pid)

:)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

@monoceres

Works fine but I want to send enter to window for example the window is minimized or hidden with skype :

#include <WindowsConstants.au3>
#include <Misc.au3>


If Not WinExists('[CLASS:TskMultiChatForm.UnicodeClass]', '') Then Exit

$cgh = ControlGetHandle('[CLASS:TskMultiChatForm.UnicodeClass]', '', '[CLASS:TRichViewEdit]')
WinSetState('[CLASS:TskMultiChatForm.UnicodeClass]', '', @SW_HIDE)

While 1
    For $key = 1 to 20
    _SendMessage($cgh, $WM_CHAR, 0x5A)
    If _IsPressed("1B") Then ExitLoop
    Next
WEnd

WinSetState('[CLASS:TskMultiChatForm.UnicodeClass]', '', @SW_SHOW)


Func _SendMessage($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lparam")
    Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessage", "hwnd", $hWnd, "int", $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

But I doesnt work with _SendMessage($cgh, $WM_CHAR, 0x1B) for send enter or controlclick doesn't work with CLASS or CLASSNN on send buton...

Thanks for anyhelp :)

Cheers, FireFox.

Edited by FireFox
Link to comment
Share on other sites

bump

Cheers, FireFox.

I don't understand what it means to send Enter to a window. It sounds like you need ControlSend to me.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

@martin

Read my post : already tried but doesnt work

With _Sendmessage I can send message to minimized or hidden window like msn or skype but after I want to click to 'send message' button with control click but doesnt work :)

I though to that way to do sendclick or send enter with _Sendmessage

Thanks for anyhelp.

Cheers, FireFox.

Link to comment
Share on other sites

  • Moderators

bump

Cheers, FireFox.

LOL... out of curiosity, what do you think "ControlSend" and "ControlClick" use to send their commands to windows? (Hint: SendMessage)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...