Sign in to follow this  
Followers 0
RazerM

Receiving message from _SendMessage

6 posts in this topic

#1 ·  Posted (edited)

If Script1.au3 is:

$PID = Run(@AutoItExe & ' "' & @ScriptDir & '\Script2.au3"')

$GUI = GUICreate("Script1Rcv")
GUIRegisterMsg(2000, "DoFunc")

While 1
 Sleep(100)
WEnd

Func DoFunc($hwnd, $MsgID, $wParam, $lParam)
 ConsoleWrite($MsgID & ":" & Number($wParam) & ":" & Number($lParam) & @CRLF)
 Exit
EndFunc   ;==>DoFuncoÝ÷ Ø    ÝIÊâ¦Ý»x¬jëh×6#include <misc.au3>
_SendMessage(WinGetHandle("Script1Rcv"), 2000, 5, 6, 0, "int", "int")oÝ÷ Ù'+ují奪Úج¦V²³Zµªiyªì¶Þj"׫nëb~'+^jËk¹Ëb'+ujíí«n±ë-êh{^¬­ aj·­«!zÌ!zr-¯+hYR¶»´g­
«Z~º&¶¬¶»´   ò×°Gb´(®GÚ.´(Zr¸©·V®ÞÚºÚ"µÍÚ[ÛYH ÜÝ[Ë]LÉÝÂÌÍÔQH[]]Ò]^H [È ÌÎNÈ ][ÝÉÌÎNÈ   [ÈØÜ [È ÌÎNÉÌLÔØÜ]LÉ][ÝÉÌÎNÊBÌÍÑÕRHHÕRPÜX]J  ][ÝÔØÜTÝ][ÝÊBÕRTYÚÝÙÊ   ][ÝÑÑ[É][ÝÊBÚ[HBTÛY
L
BÑ[[ÈÑ[Ê    ÌÍÚÛ    ÌÍÓÙÒQ ÌÍÝÔ[K  ÌÍÛ[JBIÌÍÜÝQÝXÝÜX]J   ][ÝØÚÌLI][ÝË[X    ÌÍÛ[JJBPÛÛÛÛUÜ]J    ÌÍÓÙÒQ [È ][ÝÎ][ÝÈ    [È[X   ÌÍÝÔ[JH [È ][ÝÎ][ÝÈ    [ÈÝXÝÙ]]J   ÌÍÜÝJH  [ÈÔBQ^][[ÈÏOIÝÑÑ[oÝ÷ Ø(Zr¸©·f®ÞÚºÚ"µÍÚ[ÛYH    ÛZØË]LÉÝÂÚ[ÛYH  ÓY[[ÜK]LÉÝÂØØ[   ÌÍÜY[SXÌÍÜY[HHÓY[R[]
Ú[Ù][J    ][ÝÔØÜTÝ][ÝÊKL   ÌÍÜY[SX
BÌÍÜÝHÝXÝÜX]J    ][ÝØÚÌLI][ÝÊBÝXÝÙ]]J   ÌÍÜÝK   ][ÝÙÝÙ]I][ÝÊBÓY[UÜ]J    ÌÍÜY[SXÝXÝÙ]  ÌÍÜÝ
JBÔÙ[YÜØYÙJÚ[Ù][J    ][ÝÔØÜTÝ][ÝÊK
K   ÌÍÜY[K   ][ÝÚ[ ][ÝË  ][ÝÚ[ ][ÝÊ
Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites



I found what you did interesting.

Can you tell me, when you have reserved memory based on a windows handle using _MemInit, does that memory get automatically freed when the application whose window you use closes?


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.

Share this post


Link to post
Share on other sites

I found what you did interesting.

Can you tell me, when you have reserved memory based on a windows handle using _MemInit, does that memory get automatically freed when the application whose window you use closes?

I don't understand what the memory stuff is for. This transfers integers to a GUI via messages without any of that:

#include <GuiConstants.au3>
#include <misc.au3>

HotKeySet("{SPACE}", "_Trigger")

Opt("GuiOnEventMode", 1)
$hGUI = GUICreate("Mesage Test", 300, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
GUIRegisterMsg(2000, "_RcvMsg")
$Edit_1 = GUICtrlCreateEdit("Messages received:" & @CRLF, 10, 10, 280, 180)
$iTime = TimerInit()
GUISetState()

While 1
    Sleep(20)
WEnd

Func _Trigger()
    _SendMessage($hGUI, 2000, $iTime, TimerDiff($iTime))
EndFunc   ;==>_Trigger

Func _RcvMsg($hWnd, $Msg, $wParam, $lParam)
    ConsoleWrite("Debug: Received message:" & @LF & _
            @TAB & "$hWnd = " & $hWnd & @LF & _
            @TAB & "$Msg = " & $Msg & @LF & _
            @TAB & "$wParam = " & $wParam & @LF & _
            @TAB & "$lParam = " & $lParam & @LF)
    GUICtrlSetData($Edit_1, GUICtrlRead($Edit_1) & $wParam & ":" & $lParam & @CRLF)
EndFunc   ;==>_RcvMsg

Func _Quit()
    Exit
EndFunc   ;==>_Quit

Is it a particular tricky kind of message that's wanted?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

@martin

I should have freed the memory in the example

@PsaltyDS

It was strings I was finding hard to send, although i worked it out.


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

@martin

I should have freed the memory in the example

@PsaltyDS

It was strings I was finding hard to send, although i worked it out.

I see, thanks for pointing that out. Changed my code with just this:

Func _Trigger()
    _SendMessage($hGUI, 2000, "This is $wParam", "Time = " & Round(TimerDiff($iTime) / 1000, 2) & "secs", 0, "str", "wstr")
EndFunc   ;==>_Trigger

And the problem shows.

It just didn't seem like it should be that 'hard' (= fiddling with memory).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I need to use _Mem functions to read and write to a DllStruct from another process.


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

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