Nine Posted January 3 Author Posted January 3 Changed the way temporary files are deleted (as requested by @pixelsearch). Other QoL added. New version available “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Ghost_Line Posted April 24 Posted April 24 Hello @Nine, I'm sorry to ask, but could you please give a small example on how give the content of an array as an argument ? I'm not sure to understand how WCD-IPC is working :(
Nine Posted April 24 Author Posted April 24 (edited) @Ghost_Line If the array is not too big, you could pass a string (use _ArrayToString to create it). Using WCD-IPC might be a little unnecessary complex. Here a simple example : #include "..\Files\PMT-UDF.au3" #include <Array.au3> Local $aArray = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] _PMT_Init() $sString = _ArrayToString($aArray) _PMT_Start("DisplayArray", $sString) While Sleep(100) WEnd Func DisplayArray($sStr) Local $aArr = _ArrayFromString($sStr) _ArrayDisplay($aArr) EndFunc Edited April 24 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Ghost_Line Posted April 25 Posted April 25 Thanks for that @Nine ! I feel a little dumb not having thought of _ArrayToString 😅
Nine Posted April 25 Author Posted April 25 (edited) @Ghost_Line No worries. Made me think what would be a good way to communicate large amount of data between 2 threads and I came up with this solution. expandcollapse popup#include "..\Files\PMT-UDF.au3" #include <Array.au3> #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Local $aLargeArray[500][20] For $i = 0 To UBound($aLargeArray, 1) - 1 For $j = 0 To UBound($aLargeArray, 2) - 1 $aLargeArray[$i][$j] = $i & "-" & $j Next Next _PMT_Init() Local $hMapping = _WinAPI_CreateFileMapping(-1, 65000, 'FileMapping') If Not $hMapping Or @extended Then Exit MsgBox($MB_OK, "Error", "Unable to create file mapping @extended = " & @extended) Local $pAddress = _WinAPI_MapViewOfFile($hMapping) Local $tData = DllStructCreate('char content[65000]', $pAddress) $tData.content = _ArrayToString($aLargeArray, Default, Default, Default, @CR) Local $hProc = _PMT_Start("Receiver", "FileMapping", 65000) Local $sResponse While Sleep(50) $sResponse = _PMT_GetResponse($hProc) If @error Then Exit MsgBox($MB_OK, "Error", "Process has dropped") If $sResponse <> "" Then MsgBox($MB_OK + $MB_TOPMOST, "Response", $sResponse & @CRLF) ExitLoop EndIf WEnd _WinAPI_UnmapViewOfFile($pAddress) _WinAPI_CloseHandle($hMapping) Func Receiver($sName, $iSize) Local $hMapping = _WinAPI_OpenFileMapping($sName) If Not $hMapping Then Return 0 Local $pAddress = _WinAPI_MapViewOfFile($hMapping) Local $tData = DllStructCreate("char content[" & $iSize & "]", $pAddress) Local $sText = $tData.content Local $aLargeArray = _ArrayFromString($sText, Default, @CR) _ArrayDisplay($aLargeArray) _WinAPI_UnmapViewOfFile($pAddress) _WinAPI_CloseHandle($hMapping) Return 1 EndFunc ;==>_Receiver Edited April 25 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Solution Nine Posted June 11 Author Solution Posted June 11 New version available. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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