Leaderboard
Popular Content
Showing content with the highest reputation on 07/26/2015 in all areas
-
So if you haven't noticed Zedna's Resources UDF has been a very popular UDF over the last 7 years and was last updated in 2011, but now is the time to bring the UDF up to date with the current AutoIt language syntax (v3.3.14.2). So with the blessing of Zedna may I present to you ResourcesEx. It's built using the UDF standards I have tried to enforce around here, with improved documentation and an overall UDF structure. I please ask that you try and break the UDF, criticise, educate, whatever, just play around with the functions and example. I do ask that you just don't say "you've missed the point" and leave at that. Provide an alternative or constructive reason as to why I have "missed the point". Thanks. IMPORTANT: You must be using SciTE4AutoIt3, as this comes included with AutoItWrapper Changes between Zedna's UDF and guinness' UDF. _ResourceGet() => _Resource_Get() _ResourceGetAsString() => _Resource_GetAsString() with an additional param of whether to return ANSI. _ResourceGetAsStringW() => _Resource_GetAsString() _ResourceGetAsBytes() => _Resource_GetAsBytes() _ResourceGetAsImage() => _Resource_GetAsImage() _ResourceGetAsBitmap() => _Resource_GetAsBitmap() _ResourceSaveToFile() => _Resource_SaveToFile() _ResourceSetImageToCtrl() => _Resource_SetToCtrlID() _SetBitmapToCtrl() => _Resource_SetBitmapToCtrlID() As to JFX's question of what makes this different... Known problems/limitations: (Taken for Zedna's Resources UDF) _ResourceGet() returns resource size (in bytes) in @extended macro but not for resource type RT_BITMAP [FIXED] _ResourceSetImageToCtrl() works with "static/button" type of controls (picture,label,icon,button,checkbox,radiobutton,groupbox) [NO_ISSUE] _ResourcePlaySound() plays only WAV files (not MP3 files) [FIXED] _ResourceGetAsBytes() doesn't work for RT_BITMAP type because _ResourceGet() returns hBitmap instead of memory pointer in this case there could be used _ResourceGetAsImage() as workaround _ResourceGet() has potential memory leak releasing of resources UnlockResource, FreeResource (opposite of LoadResource, LockResource) is not done because it must be done after using of resources at the end and not inside UDF [FIXED] _GDIPlus_Startup() is called once at start of whole include --> no _GDIPlus_Shutdown() is called [FIXED] Download the ZIP and play around with the Example/UDF. ResourcesEx.zip Jos: 15-9-2022 Updated version replaced $__WINVER with _WinAPI_GetVersion() Jos: 27-4-2023 updated script as they required extra #include: ResourcesEx.zip Changelog: 2015/09/26 Changed: Comments throughout the UDF, removing trailing dot Fixed: Various cosmetic changes 2015/01/12 Fixed: Example directive using double equals sign Fixed: Delete functions not being cast as a bool value. (Thanks Synix) Fixed: @error and @extended not be passed back in nested functions e.g. _Resource_GetAsRaw() 2014/07/19 Added: _Resource_SetBitmapToCtrlID() formely known as _Resource_SetImageToCtrlID() Added: Note about using #AutoIt3Wrapper_Res_Icon_Add to the example. (Thanks Zedna) Added: Passing a blank string to _Resource_SetToCtrlID() through the $sResNameOrID parameter, will delete the image and previous handle Changed: _Resource_SetImageToCtrlID() now accepts a hBitmap not a HBITMAP object Fixed: _Resource_GetAsBitmap() now works the same way as _ResourceGetAsBitmap() did, by converting a jpg, png etc... to HBITMAP Fixed: Memory management of some functions 2014/07/18 Fixed: Destroying a cursor Fixed: Regression from loading the current of external module. (Thanks UEZ) 2014/07/17 Added: Additonal checks to destroy cursors and icons Added: Checking if the dll or exe filepath has a valid extension Added: Example of using an icon and image on a button control Fixed: Icons and cursors (finally) being re-sized to a control Fixed: Using GUIGetStyle() on a non-AutoIt handle would cause issue with controls Fixed: Variable naming of $sDLL to $sDllOrExePath for improved clarity Removed: Workaround for setting icons to AutoIt controls 2014/07/17 Added: Commented workaround in the example for re-sizing an icon control Added: ResourcesEx_PE.au3 created by PreExpand for all you constant variable haters out there!!! Fixed: Changelog comments and source code comments Fixed: Re-sizing icons when the control was different to the icon's size. (Thanks czardas for the MSDN link and Jon.) Fixed: Re-sizing cursors and icons in general 2014/07/15 Added: Comments about using SOUND for wav files and RT_RCDATA for mp3 files. (Thanks Melba23) Added: Option to relevant functions to re-size the image based on the control's dimensions. (Requested by kinch: http://www.autoitscript.com/forum/topic/51103-resources-udf/?p=1147525) Added: Using _Resource_LoadFont() example. (Thanks UEZ) Changed: Certain example resources to now use those found in %AUTOITDIR%\Examples\Helpfile\Extras Changed: Constants and enums readability. (Thank mLipok) Changed: Internal functions for destroying resources Changed: Removed changes made from the previous version for loading resources multiple times. The design needs to be re-thought Changed: Setting styles of controls using native AutoIt functions Fixed: Destroying control resource images would fail to show if reinstated again Fixed: Documentation comments Fixed: Missing certain users who helped with creating this UDF Fixed: Outdated SciTE files 2014/07/14: Added: _Resource_GetAsCursor(), for the loading of animated cursors and standard cursors which can then be used with _WinAPI_SetCursor() Added: _Resource_GetAsIcon(), for loading icon resource types Added: _Resource_LoadFont(), which retrieves a font resource and adds to the current memory of the associated module Added: _Resource_SetCursorToCtrlID() and _Resource_SetIconToCtrlID() Added: Additional resource types to destroy on exit, including $RT_FONT, $RT_ICON and $RT_MENU Added: Playing Mp3s to _Resource_LoadSound(). (Thanks to UEZ and Melba23 with changes made by me.) Changed: _Resource_GetAsBitmap() returns a HTBITMAP handle without converting from hBitmap to HBITMAP Changed: _Resource_PlaySound() to _Resource_LoadSound() Changed: _Resource_SetBitmapToCtrlID() to _Resource_SetImageToCtrlID() Changed: _SendMessage() to GUICtrlSendMsg() Changed: Example files Changed: Setting $iError in the internal get function Changed: Signature of _Resource_Destroy() Changed: Updated example to reflect major changes to the ResourcesEx UDF Changed: Various UDF tweaks that I didn't document because I simply couldn't keep track of all the playing around I did in the last week Fixed: _Resource_GetAsImage() not returning an error when a bitmap couldn't be found in the resource table Fixed: Retrieving length of a string Fixed: Using the current module instead of zero in _Resource_LoadSound() Fixed: Various comment changes. (Thanks mLipok) Fixed: Loading resources multiple times. This is fixed thanks to using the internal storage array 2014/07/07: Added: _Resource_Destroy() and _Resource_DestroyAll() to destroy a particular resource name or all resources Added: Checking if the resource name of id value is empty Added: Descriptions, though could do with a little tweaking Changed: _Resource_Get() to _Resource_GetAsRaw() Changed: Internal workings of __Resource_Storage() Changed: Re-size the storage array when destroyed or on shutdown Fixed: _Resource_GetAsString() with default encoding of ANSI Fixed: Calltips API referencing Resources.au3 and not ResourcesEx.au3 Removed: _Resource_Shudown() due to the addition of _Resource_Destroy() and _Resource_DestroyAll() 2014/07/06: Added: _Resource_Shudown() to free up those resources which aren't loaded using _WinAPI_LockResource(). UnlockResource is obsolete Added: Support for using $RT_STRING Changed: _Resource_GetAsString() now works correctly for most encodings. (Thanks Jos) Changed: _Resource_GetAsString() will now load as a string if the resource type requested is $RT_STRING 2014/07/04: Added: #Regions. (Thanks mLipok) Added: #Tidy_Parameters=/sort_funcs /reel (Thanks mLipok) Added: All optional params now accept the default keyword Added: Link to this thread. (Thanks mLipok) Added: Main header. (Thanks mLipok) Changed: $f.... >> $b..... (Thanks mLipok) 2014/07/03: Initial release1 point
-
Powerful HTTP Server in Pure AutoIt
Skeletor reacted to jvanegmond for a topic
This is a full HTTP server written in pure AutoIt. No external libraries are used. The server code is readable and very simple to modify. Abilities: A full web server in a single executable. Able to integrate the web pages into your source code and modify its contents with code. ( This is how the first web pages were build ) The ability to send a page with over 1000 images in under 5 seconds. Fully compatible with both Firefox, Internet Explorer 6 through 9, Chrome and Safari. Nearly every line is commented. It helps you understand the code easily, so that you may reuse it and add on new code with ease. GET, POST are both supported and even cookies and sessions are supported This is intended to be a base for any future projects that provide any service over HTTP. Three different servers give you the base code that you need, and nothing you won't need. In the download there is included a short guide on how to choose the right one. BrettF has done some awesome work and added to capability to retain sessions in this post: >http://www.autoitscript.com/forum/topic/...e-autoit/page__view__findpost_ If you need sessions, you can use his version. This version is added in the above v1.1 download. Edit: Please find the webserver attached to this post. You guys keep eating my bandwidth and I had to move it again. webserver_011.zip1 point -
Here's an UDF to to get informations from any HTML (XML) source, without any browser. _HTML.au3 Current functions: - _HTML_ExtractURLVar - _HTML_Get - _HTML_GetAllImageSrc - _HTML_GetAllLinks - _HTML_GetImageSrc - _HTML_GetLink - _HTML_GetSource - _HTML_GetTable - _HTML_GetText - _HTML_GetURLVar - _HTML_ImageSave - _HTML_Search Different search-modes: $_HTML_SEARCHMODE = 1 ; (0 = Compare / 1 = Substring / RegExp) (2 = Compare / 3 = Substring / String-compare) Example 1: (getting the url of the favicon of a page) #include <_html.au3> $sHTML = _HTML_GetSource("http://autoit.de/index.php?page=Portal") $sIconURL = _HTML_Get($sHTML, "link", "href", "image/x-icon", "type") MsgBox(64,"",$sIconURL) Example: #Region Includes #include <Array.au3> #include <_HTML.au3> #EndRegion Includes $_HTML_SEARCHMODE = 1 Main() Func Main() Local $HTML = _HTML_GetSource("http://autoit.de/index.php?page=Portal") MsgBox(0, "", _HTML_GetURLVar($HTML, "page", "Mitglieder", "title") & @CRLF) MsgBox(0, "", _HTML_GetText($HTML, "div", "cont.*erCont", "class", 5) & @CRLF) MsgBox(0, "", _HTML_GetImageSrc($HTML, "controllcenterImage") & @CRLF) MsgBox(0, "", _HTML_GetLink($HTML, "loginButton") & @CRLF) Local $a = _HTML_GetAllLinks($HTML) _ArrayDisplay($a) $a = _HTML_GetAllLinks($HTML, '\.com') _ArrayDisplay($a) $a = _HTML_GetAllImageSrc($HTML, 'wcf/images/') _ArrayDisplay($a) EndFunc ;==>Main The UDF: _HTML.au3 V1.01: Small bug fix in _HTML_GetTable1 point
-
The long awaited! Magic Number CalculatorMagic Number Calculator is a useful tool if you have code which does not uses constants but instead use magic numbers to specify Styles & ExStyles... Its Features: Small & Compact Standalone exeutableAutomatically generates the Corrected function lineMade for the lazy, Press the "Press the Paste Button", "Press the Calculate Button", Wait, "Press the Copy Button" & Done!Fast CalculationsThe Unlicensed Open Source >>> Links <<< Source & Version Archive Bug Submission & Bug Tracker >>>Download<<< https://www.autoitscript.com/forum/files/file/352-magic-number-calculator/ Please Report Bugs & Request Features in the Bug Submission form! It will help me keep track of all requests! P.S If you are not able to view the sources & version archive, please try disabling your adblocker1 point
-
Can you IniWrite from a Password Textbox/InputBox?
SevereMessage reacted to guinness for a topic
I just tested and see no error. How questions like this turn out is you haven't provided us with all the information and thus the error is your side and not AutoIt's. My advice, learn how to debug your own code. Failing that if you do want help, perhaps a small reproducer of what you're trying would help your cause.1 point -
I doubt it, because not all of that code directly translates to AutoIt, so I would have to think of workarounds. I love the fact they are overriding ++ and -- for the BigInteger struct. That's one of my favourite features in C#.1 point
-
New version (1.1.0) posted that includes all the suggested changes (THANK YOU) with the exception of @Guinness' MsgBox note. That is perfectly legit and when I catch my second wind I will circle back on it (requires wholesale gutting of most code snippet images). This pass took a long time because I cross referenced each code snippet, made sure I had it on file (and if not, I recreated it). Then I organized the code by directories and example numbers that matched the text in the book. Finally, I pushed out the updated text and companion code file(s) . More to follow after my eyes un-cross. As always, comments and suggestions most welcome.1 point
-
I have edit my post above. About your suggestion I did that, but it's not the point. Oh well, good luck.1 point
-
You are missing quit a few possible abbreviations so maybe it is better to point to the helpfilepage?: Jos1 point
-
Autoit SciTE bug? [Not]
TheAutomator reacted to Danyfirex for a topic
I'm can find it. :S (maybe is stolen)1 point -
1 point
-
@Danyfirex, have you blocked seeing my posts? Could have said yourself all that typing otherwise.1 point
-
Sorting the data will make counting much faster. About 10 times faster. #include <Array.au3> Opt( "MustDeclareVars", 1 ) Example() Func Example() ; 1. Read file Local $aArray1 = FileReadToArray( "inexample1.txt" ) ;_ArrayDisplay( $aArray1 ) ; 2. Create 2D-array Local $iRows = UBound( $aArray1 ) Local $aArray2[$iRows][4], $aLine For $i = 0 To $iRows - 1 $aLine = StringSplit ( $aArray1[$i], " ", 3 ) ; 3 = $STR_ENTIRESPLIT + $STR_NOCOUNT $aArray2[$i][0] = $aLine[0] ; Col 0 : Time $aArray2[$i][1] = $aLine[1] ; Col 1 : 16 chars $aArray2[$i][2] = $aLine[2] ; Col 2 : Long string $aArray2[$i][3] = $aLine[3] ; Col 3 : blocked/written Next ;_ArrayDisplay( $aArray2 ) ; 3. Index based sort of 2D-array, $aArray2 ($aArray2 is not changed) Local $tIndex = DllStructCreate( "uint[" & $iRows & "]" ) Local $pIndex = DllStructGetPtr( $tIndex ) ; Sort 2D-array by column 2 (long string) ; Sort duplicates by column 0 (time) Local $aCmps[2][3] = [ _ [ 2, 1, +1 ], _ ; Col 2: Compared as strings, asc [ 0, 1, +1 ] ] ; Col 0: Compared as strings, asc SortArray( $aArray2, $pIndex, $tIndex, $aCmps ) ; http://www.autoitscript.com/forum/index.php?showtopic=173279 ; See post 15 ; 4. Extract rows in sorted order Local $aSorted[$iRows][5], $k For $i = 0 To $iRows - 1 $k = DllStructGetData($tIndex,1,$i+1) $aSorted[$i][0] = $aArray2[$k][0] ; Col 0 : Time $aSorted[$i][1] = $aArray2[$k][1] ; Col 1 : 16 chars $aSorted[$i][2] = $aArray2[$k][2] ; Col 2 : Long string $aSorted[$i][3] = $aArray2[$k][3] ; Col 3 : blocked/written $aSorted[$i][4] = $k ; Col 4 : Index in $aArray2 (to display results in file order instead of sort order) Next ;_ArrayDisplay( $aSorted ) ; 5. Count equal strings in col 2 Local $aResults[$iRows][5], $iRes = 0, $iCnt For $i = 0 To $iRows - 2 $iCnt = 1 $aResults[$iRes][0] = $aSorted[$i][0] ; First time $aResults[$iRes][1] = StringLeft( $aSorted[$i][2], 10 ) & "xxxxxx" & StringMid ( $aSorted[$i][2], 17, 2 ) $aResults[$iRes][4] = $aSorted[$i][4] ; File index While $i < $iRows - 1 And $aSorted[$i][2] = $aSorted[$i+1][2] $i += 1 $iCnt += 1 WEnd $aResults[$iRes][2] = $iCnt ; Count $aResults[$iRes][3] = $aSorted[$i][0] ; Last time $iRes += 1 Next ReDim $aResults[$iRes][5] ;_ArrayDisplay( $aResults ) ; If order of results doesn't matter, you can skip step 6. ; and create $aResults2 from $aResults wihtout a sorting. ; 6. Sort results in file order instead of sort order Local $tIndex = DllStructCreate( "uint[" & $iRes & "]" ) Local $pIndex = DllStructGetPtr( $tIndex ) ; Sort 2D-array by column 4 (file index) Local $aCmps[1][3] = [ _ [ 4, 0, +1 ] ] ; Col 4: Compared as numbers, asc SortArray( $aResults, $pIndex, $tIndex, $aCmps ) ; 7. Extract the rows in file order Local $aResults2[$iRes], $k For $i = 0 To $iRes - 1 $k = DllStructGetData($tIndex,1,$i+1) $aResults2[$i] = $aResults[$k][0] & " " & _ ; First time $aResults[$k][1] & " " & _ ; xxxxxx-string StringFormat( "%3d", $aResults[$k][2] ) ; Count If $aResults[$k][2] > 1 Then $aResults2[$i] &= " " & $aResults[$k][3] ; Last time ConsoleWrite( $aResults2[$i] & @CRLF ) Next ;_ArrayDisplay( $aResults2 ) ; 8. Store results Local $s = "[code]" & @CRLF For $i = 0 To $iRes - 1 $s &= $aResults2[$i] & @CRLF Next $s &= "[/code]" & @CRLF FileWrite( "inexample2.txt", $s ) EndFunc Func SortArray( ByRef $aItems, $pIndex, $tIndex, $aCmps ) Local $iCmps = UBound( $aCmps ), $c, $r, $v[$iCmps] Local $lo, $hi, $mi For $i = 0 To UBound( $aItems ) - 1 For $j = 0 To $iCmps - 1 $v[$j] = $aItems[$i][$aCmps[$j][0]] ; Values Next $lo = 0 $hi = $i - 1 While $lo <= $hi ; Binary search $r = 0 ; Compare result (-1,0,1) $j = 0 ; Index in $aCmps array $mi = Int( ( $lo + $hi ) / 2 ) While Not $r And $j < $iCmps ; This While-loop handles sorting by multiple $c = $aCmps[$j][0] ; Column ; columns. Column values of the two rows are Switch $aCmps[$j][1] ; Number/string ; compared until a difference is found. Case 0 ; Compare column values as numbers. The following line is an implementation of the spaceship or three-way comparison operator for numbers like StringCompare is for strings. $r = ( $v[$j] < $aItems[DllStructGetData($tIndex,1,$mi+1)][$c] ? -1 : $v[$j] = $aItems[DllStructGetData($tIndex,1,$mi+1)][$c] ? 0 : 1 ) * $aCmps[$j][2] ; * $iCmpAsc Case 1 ; Compare column values as strings. StringCompare is a spaceship or three-way comparison operator for strings. $r = StringCompare( $v[$j], $aItems[DllStructGetData($tIndex,1,$mi+1)][$c] ) * $aCmps[$j][2] ; * $iCmpAsc EndSwitch $j += 1 WEnd Switch $r Case -1 $hi = $mi - 1 Case 1 $lo = $mi + 1 Case 0 ; Equal ExitLoop EndSwitch WEnd If $i > $mi Then _ ; Make space for the row number in index DllCall( "kernel32.dll", "none", "RtlMoveMemory", "struct*", $pIndex+($mi+1)*4, "struct*", $pIndex+$mi*4, "ulong_ptr", ($i-$mi)*4 ) DllStructSetData( $tIndex, 1, $i, $mi+1+($lo=$mi+1) ) ; Insert row number $i at position $mi+1+($lo=$mi+1) in index Next EndFunc The zip contains inexample1.txt with 3000 lines and results in inexample2.txt and inexample2-a.txt. Code in tst00.au3 and tst00-a.au3. The a-versions are your versions. Files.7z1 point
-
As I have had no use for it up until now. I dabbled in VBA for an assignment, but that's as far as I have gone with Visual Basic-like syntax. Why, do you use VB.NET? Personally C# is a better constructed language, as it was built from the ground up with OOP at the forefront of its design.1 point
-
C#, Java, PHP (main language right now), JavaScript and Android (old version of Java). So AutoIt was my starting point in all of this.1 point
-
OK. My advice learn how to use the tools to aid in learning a language. These are fundamentally important. So far the languages I have learnt after AutoIt, have all been done just by searching.1 point
-
Seeing as you like free hand outs and I am in a good mood, look what I found with a simple search >> https://www.autoitscript.com/forum/topic/146863-run-autoit-code-from-a-variable/ Doesn't that help you?1 point
-
Output type? Follow this link, it's like the best I have found >> https://lmddgtfy.net/?q=site%3Aautoitscript.com a3x help1 point
-
I don't see any issue with my UDF (thankfully) #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include '_GUICtrlMenu_Recent.au3' Example() Func Example() Local $hGUI = GUICreate('GUI 2xRecent Menu', 300, 100) Local $idFileMenu = GUICtrlCreateMenu('&File') Local $idFileMenuItem = GUICtrlCreateMenuItem('Open File', $idFileMenu) GUICtrlCreateMenuItem('', $idFileMenu) ; Seperator Line. Local $hFileRecentMenuItem = _GUICtrlMenu_RecentCreate(5, $idFileMenu, 'Recent Files') Local $idDBMenu = GUICtrlCreateMenu('&Database') Local $idDBMenuItem = GUICtrlCreateMenuItem('Open DB Folder', $idDBMenu) GUICtrlCreateMenuItem('', $idDBMenu) ; Seperator Line. Local $hDBRecentMenuItem = _GUICtrlMenu_RecentCreate(5, $idDBMenu, 'Recent Databases') GUISetState(@SW_SHOW, $hGUI) Local $iMsg = 0, _ $sFilePath = '' ; Loop until the user exits. While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $idFileMenuItem $sFilePath = FileOpenDialog('Choose file...', @TempDir, 'All (*.*)') _GUICtrlMenu_RecentAdd($hFileRecentMenuItem, $sFilePath) Case $idDBMenuItem $sFilePath = FileSelectFolder('Choose folder...', @TempDir) _GUICtrlMenu_RecentAdd($hDBRecentMenuItem, $sFilePath) ; This is important! Case Else ; Check if the message id returned by GUIGetMsg() is present in the recent menu list. $sFilePath = _GUICtrlMenu_RecentSelected($hFileRecentMenuItem, $iMsg) If Not @error Then MsgBox($MB_SYSTEMMODAL, '', 'The recent menu was selected and the following item was chosen' & @CRLF & _ @CRLF & _ $sFilePath, 0, $hGUI) ; So as not to fall through to the next if statement. ContinueLoop EndIf ; Check if the message id returned by GUIGetMsg() is present in the recent menu list. $sFilePath = _GUICtrlMenu_RecentSelected($hDBRecentMenuItem, $iMsg) If Not @error Then MsgBox($MB_SYSTEMMODAL, '', 'The recent menu was selected and the following item was chosen' & @CRLF & _ @CRLF & _ $sFilePath, 0, $hGUI) ; So as not to fall through to the next if statement. ContinueLoop EndIf EndSwitch WEnd ; Destroy the recent menu. _GUICtrlMenu_RecentDestroy($hFileRecentMenuItem) _GUICtrlMenu_RecentDestroy($hDBRecentMenuItem) GUIDelete($hGUI) EndFunc ;==>Example1 point
-
Some regex... $before = 'ue="1001372">27/07 05:00<' $after = StringRegExpReplace($before, '.*>([^<]+).*', "$1") MsgBox(0, "Result1", $before & @CRLF & $after) ; this way works but will crash your script in case of error (same for SadBunny's code) $after = StringRegExp($before, '>([^<]+)', 3)[0] MsgBox(0, "Result2", $before & @CRLF & $after) ;error example: #include <String.au3> $before = 'ue="1001372">27/07 05:00' ; < is absent, so ... $after = _StringBetween($before, ">", "<")[0] ; ... no match causes AutoIt fatalll error ! MsgBox(262144, "Result", $before & @CRLF & $after, 0)1 point
-
1 point
-
GUICTRLGET-LEFT, TOP, WIDTH AND HEIGHT
guiltyking reacted to rizaado for a topic
Func left($iControlID) Return ControlGetPos(GUICtrlGetHandle($iControlID), "", 0)[0] EndFunc ;==>left Func top($iControlID) Return ControlGetPos(GUICtrlGetHandle($iControlID), "", 0)[1] EndFunc ;==>top Func width($iControlID) Return ControlGetPos(GUICtrlGetHandle($iControlID), "", 0)[2] EndFunc ;==>width Func height($iControlID) Return ControlGetPos(GUICtrlGetHandle($iControlID), "", 0)[3] EndFunc ;==>height1 point -
Process Suspend/Process Resume UDF
GeneNight reacted to The Kandie Man for a topic
Well, I was looking on the internet for ways to suspend processes and spent a great deal of time trying to find API commands to do this. I found many thread suspend functions and other things, but not really any process suspend functions. I finally found a process suspend NTAPI function NtSuspendProcess(). To my great distaste I could find absolutely nothing documenting the NTAPI functions, nothing at all. Hours of Googling and i finally found a page that has the NTAPI functions listed. No thanks to Microsoft. :S You would think they would document functions that they took the time to write so that people could actually use them. To save others time, here is a page with the NTAPI functions listed: http://www.metasploit.com/users/opcode/syscalls.html Here is a UDF to call the system API to suspend or resume a process. No more systeminternals 104kb PsSuspend.exe. Func _ProcessSuspend($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid) $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) If IsArray($i_sucess) Then Return 1 Else SetError(1) Return 0 Endif Else SetError(2) Return 0 Endif EndFunc Func _ProcessResume($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid) $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) If IsArray($i_sucess) Then Return 1 Else SetError(1) Return 0 Endif Else SetError(2) Return 0 Endif EndFunc @The Development Team I think it would be a good idea to add these to the process.au3 include file. You can call the function with the process name or PID _ProcessSuspend("notepad.exe") or _ProcessSuspend(467) The returns are as follows: 0 = Failure 1 = Sucess @error = 1 means that it failed because something errored when calling the dll @error = 2 means that it failed because the process was not found or is not running Sorry i didn't do a standard UDF writeup, didn't have time. If the development team is interested in adding this function i will happily write the standard UDF documentation for it. Important: This function will only run on Windows XP, Windows 2003 and Windows Vista.1 point -
1 point
-
Meet the line continuation character "_" $string = 'This is line 1' & @CRLF & _ 'This' & _ ' is line 2' & @CRLF & _ 'This is line 3' ConsoleWrite($string & @CRLF) Now you can have the line to suit your editor width which will be easier for you to manage to type and read.1 point