isolation Posted April 11, 2009 Posted April 11, 2009 Hi, I'm trying to add some new threads on a normal autoit executable I found that the only way to do that is to use guiregistermsg and an internal message code So I made this piece of script: #Include <WinAPI.au3> #include <WindowsConstants.au3> Global $mymsg=_WinAPI_RegisterWindowMessage("MyNewMsg") Global $uiui=GUICreate("uuu") GUIRegisterMsg($mymsg,"lol") Func lol($a,$b,$c,$d) MsgBox(0,$c,$d) EndFunc Sleep(1000) _WinAPI_PostMessage ($uiui,$mymsg,"Hello","uuu") While 1 ;..................................... WEnd But msgbox displays only 0x000000000000
ProgAndy Posted April 11, 2009 Posted April 11, 2009 You can't add more threads to AutoIt. a function from GUIRegisterMsg interrupts the whole script until it's finished. *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
Yashied Posted April 11, 2009 Posted April 11, 2009 Hi, I'm trying to add some new threads on a normal autoit executable I found that the only way to do that is to use guiregistermsg and an internal message code So I made this piece of script: #Include <WinAPI.au3> #include <WindowsConstants.au3> Global $mymsg=_WinAPI_RegisterWindowMessage("MyNewMsg") Global $uiui=GUICreate("uuu") GUIRegisterMsg($mymsg,"lol") Func lol($a,$b,$c,$d) MsgBox(0,$c,$d) EndFunc Sleep(1000) _WinAPI_PostMessage ($uiui,$mymsg,"Hello","uuu") While 1 ;..................................... WEndoÝ÷ ØÈ£b²ZÊÊ'-1ÓM4ÓM4ÓM4þ«¨µäëÊØb±«¢+Ø%¹±Õ±Ðí]¥¹A$¹ÔÌÐì(%¹±Õ±Ðí]¥¹½ÝÍ ½¹ÍѹÑ̹ÔÌÐì()±½°ÀÌØíµåµÍõ}]¥¹A%}I¥ÍÑÉ]¥¹½Ý5ÍÍ ÅÕ½Ðí5å9Ý5ÍÅÕ½Ðì¤)±½°ÀÌØíÕ¥Õ¤õU% ÉÑ ÅÕ½ÐíÕÕÔÅÕ½Ðì¤()U%I¥ÍÑÉ5Í ÀÌØíµåµÍ°ÅÕ½Ðí±½°ÅÕ½Ðì¤()Õ¹±½° ÀÌØí°ÀÌØí°ÀÌØí°ÀÌØí¤($(%±½°ÀÌØíÑMÑÉÕÐô±±MÑÉÕÑ ÉÑ ÌäíÝ¡ÉlÌäìµÀì9ÕµÈ ÀÌØí¤µÀìÌäítÌäì°ÀÌØí¤($(%5Í ½à À°ÌäíQÍÐÌäì°±±MÑÉÕÑÑÑ ÀÌØíÑMÑÉÕаĤ¤(¹Õ¹()M±À ÄÀÀÀ¤()±½°ÀÌØíÍAÉ´ôÅÕ½Ðí!±±¼ÅÕ½Ðì)±½°ÀÌØíÑMÑÉÕÐô±±MÑÉÕÑ ÉÑ ÌäíÝ¡ÉlÌäìµÀìMÑÉ¥¹¡MÑÉ¥¹1¸ ÀÌØíÍAÉ´¤¬Ä¤µÀìÌäítÌäì¤()±±MÑÉÕÑMÑÑ ÀÌØíÑMÑÉÕаİÀÌØíÍAÉ´¤)}]¥¹A%}A½ÍÑ5ÍÍ ÀÌØíÕ¥Õ¤°ÀÌØíµåµÍ°±±MÑÉÕÑÑAÑÈ ÀÌØíÑMÑÉÕФ°±±MÑÉÕÑÑM¥é ÀÌØíÑMÑÉÕФ¼È¤(ÀÌØíÑMÑÉÕÐôÀ()]¡¥±Ä(츸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸)]¹ My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
martin Posted April 11, 2009 Posted April 11, 2009 Try this. #Include <WinAPI.au3> #Include <WindowsConstants.au3> Global $mymsg=_WinAPI_RegisterWindowMessage("MyNewMsg") Global $uiui=GUICreate("uuu") GUIRegisterMsg($mymsg,"lol") Func lol($a,$b,$c,$d) local $tStruct = DllStructCreate('wchar[' & Number($d) & ']', $c) MsgBox(0, 'Test', DllStructGetData($tStruct, 1)) EndFunc Sleep(1000) Global $sParam = "Hello" Global $tStruct = DllStructCreate('wchar[' & String(StringLen($sParam) + 1) & ']') DllStructSetData($tStruct, 1, $sParam) _WinAPI_PostMessage($uiui, $mymsg, DllStructGetPtr($tStruct), DllStructGetSize($tStruct) / 2) $tStruct = 0 While 1 ;..................................... WEndIt might be worth pointing out that Yashied's example only works because you are reading with the same aplication that sent the message. If you were sending to another preocess then you would need to use the WM_COPYDATA message or use some memory functions. 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.
isolation Posted April 11, 2009 Author Posted April 11, 2009 tanks, it seems to work but what ProgAndy wrote is true... I can't have more than a main thread and an adlib tanks all
Yashied Posted April 11, 2009 Posted April 11, 2009 tanks, it seems to workbut what ProgAndy wrote is true... I can't have more than a main thread and an adlibtanks allOf course this will only work within the script. I just corrected the code. If you need to pass a string in another program then see the following.http://www.autoitscript.com/forum/index.php?showtopic=91346 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
isolation Posted April 11, 2009 Author Posted April 11, 2009 (edited) Will be developed a version of autoit with threads? I know that is really difficult to use threads (expecially for base-level developers) but a special version with threads will help developers a lot!!!!! Edited April 11, 2009 by isolation
martin Posted April 11, 2009 Posted April 11, 2009 Will be developed a version of autoit with threads?I know that is really difficult to use threads (expecially for base-level developers)but a special version with threads will help developers a lot!!!!!No. The devs have even posted a note that this is one of the features that will not be developed and it should not to be requested. 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.
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