Leaderboard
Popular Content
Showing content with the highest reputation on 06/12/2014 in all areas
-
Being sufficiently ancient to recall CP/M, monochrome CRTs, and woolly mammoths, I thought I'd share something from the bad old days: FAT filesystems (FAT12, FAT16, FAT32). Still widely used in USB flashRAM, SD cards, RAMdisks, and microcontroller-based embedded systems, (F)ile (A)llocation (T)able filesystems are simple and robust, providing a great environment for learning how filesystems work. Moreover, many operating systems other than Windows can handle them, enabling data exchange between different platforms. That's the good part. I've often wondered why nobody had yet written a FAT UDF library for AutoIt. Now I know why. When a normally bone-dry tech page introduces FAT with the words "Welcome to Hell" you know you're in for a rough ride. It took me almost a year of grief and many, many wrecked (virtual) volumes to get to this first beta release. That's the bad part. Why was it so painful to develop, you rhetorically ask? The I/O itself is fairly straightforward, but backward compatibility, poor design choices and some blatant mistakes have produced a convoluted mess of rules with exceptions, exceptions to the exceptions, and exceptions to the exceptions to the exceptions (and in case you're wondering, no, I'm not talking about my own scripts here). It's like the Gregorian calendar, which has 365 days per year, unless the year is divisible by 4 (366), unless the year is also divisible by 100 (365), unless the year is also divisible by 400 (366). Add to that non-standard address-widths (paired 12-bit in FAT12, 28-bit in FAT32), file fragmentation, lost clusters, cross-, open-, and self-linked chaining errors, and the train wreck that is VFAT Long File Names support , and you've got yourself a challenge. The result is a main library called the FAT Suite (FATsuite.au3), to which I've added a large demo GUI called FAT Manager (FATman.au3, not to be confused with the famous superhero), plus my trusty MBR handler (BuildPartitionTable.au3), and a few sample image files with different types of FAT. If running older versions of AutoIt, you'll additionally need Yashied's outstanding WinAPIEx.au3. I've also gratefully incorporated two excellent UDFs by Ascend4nt and trancexx respectively (with acknowledgement, of course). Many thanks to you all! When you start FATman and load a volume, you'll see a pretty lame directory/file tree above a small log-window (ripped from my CodeScanner). Bog-standard menus allow you to copy, rename, remove files and dirs, etcetera. No big deal, right? You're not impressed. But please consider this: When FATman loads a volume (either from an image file or a physical drive) it is unmounted. As far as Windows is concerned, the volume is inaccessible to you. But your actions are not handled by the OS, but by the FATsuite UDFs. If you don't appreciate the significance of unmounted full access, then this library probably isn't for you. For my fellow codehounds, however, check out the main features below. And yes, it can be slow for large filled volumes with a small cluster size (especially the demo GUI tree refresh). But it also offers you full access to your files and other data, that is, more than Windows usually offers you. Main Features: FAT volume creation and (re)formatting (18 KB - 2 TB; slow for large volumes) visualising FAT architecture, with interactive tool (manipulate total size, cluster size, number of FAT copies) two-way file transfer between FAT volume and memory (UDF only, no GUI support) two-way file transfer between FAT volume and other, mounted (FAT/NTFS) volumes internal volume-, directory-, and file I/O (create/copy/move/truncate/remove/rename/filefind/edit filespecs) *physical* directory sorting by any criterion (unlike MicroSoft's "sorted" view of physically unsorted data) wiping files and physical removal of "deleted" files/subdirs in dir table and zeroing DataRegion clusters retrieving lost/deleted/damaged data clusters (with or without FAT reference) detecting/patching FAT chaining errors (cross-linked, open-ended, and circular chains) raw FAT I/O, including flipping CleanShutdown and Hard R/W-error bits manipulating bad clusters (single creation/single removal/bulk removal) with file chain rerouting determining cluster ownership for any defined FAT entry extracting all filesystem parameters, and editing some rawcopy image-to-volume and volume-to-image (imagefile or physical device) optional comparison/synchronisation of multiple FAT copies (the table, not the entire volume) File Find utility (UDF only, no GUI support) heavily annotated code for learning about FAT filesystem mechanics But beware, you can do enormous damage to your FAT volumes. For example, there's no soft-delete with recycle bin retrieval, and confirmation checks are few. Once you remove/wipe/truncate a file, it's gone forever, period. So please, please, please, read the FATsuite Remarks section before calling its UDFs; also read the annotations in the UDFs; study FATman's many examples; always work with imagefiles of which you keep multiple backup copies. Remember, it's a beta release ( glitches possible!); you may accidentally parse a wrong parameter at some point; and Murphy's Law always applies. FATsuite.v1.1.7z (AutoIt 3.3.12 compliant version 1.1; likely won't run in legacy AutoIt environments) FATimageExamples.7z Sample FAT image files (reduced in size) I hope this contribution helps to clarify how FAT filesystems work, and that you have fun playing with it, or find some other use(s) for it. RT PS Okay, I admit the mammoth was already slightly dead when I saw it, and had been for quite a while.1 point
-
Something like this maybe: $oMyError = ObjEvent("AutoIt.Error", "ComError") If UserInGroup(@LogonDomain,@UserName,"Administrators") then msgbox(0,"Validate","User exists in specified groupname") Else msgbox(0,"Validate","User does NOT exist in specified groupname") EndIf Exit ; Check if User is in a group Func UserInGroup($Domain, $UserName, $InGroup) Local $objUser = ObjGet("WinNT://" & $Domain & "/" & $UserName) For $oGroup in $objUser.Groups If $oGroup.Name = $InGroup Then Return 1 EndIf Next Return 0 EndFunc ;COM Error function Func ComError() If IsObj($oMyError) Then $HexNumber = Hex($oMyError.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc ;==>ComError1 point
-
Are these users listed in the Computers Administrators group or are they given in another way Admin access? When they are in the Administrators group you could enumerate the users in the group and see if the @username is in it. Jos1 point
-
So you want to know whether the current userid is part of the administrators group of the computer? It is clear that the isadmin() will only return a 1 when actually running at that level. Jos1 point
-
What exactly is it you want to do that doesnt work with isadmin()?1 point
-
Use CheckTokenMembership instead...1 point
-
1 point
-
Maybe using http://msdn.microsoft.com/en-us/library/bb776463(v=vs.85).aspx but I'm no sure if isAdmin is a wrapped of this. Saludos1 point
-
GUIRegisterMsg replacement for GUICtrlSetOnEvent and GUIGetMsg
pixelsearch reacted to BrewManNH for a topic
Seems like they've changed since I wrote this,I think it was originally written on an XP machine. Here's a version that correctly identifies the clicks on the borders and all 4 corners as well as the title bar. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MenuConstants.au3> GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR") $GUI = GUICreate("Test GUI", 200, 200, -1, -1, BitOR($WS_THICKFRAME, $gui_ss_default_gui)) $Button = GUICtrlCreateButton("Test", 20, 20) $Button2 = GUICtrlCreateButton(" Another Test ", 20, 100) $Slider = GUICtrlCreateSlider(20, 60, 150) $hSlider = GUICtrlGetHandle($Slider) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $Button MsgBox(0, "", "You pressed the button marked TEST") Case $Button2 MsgBox(0, "", "You pressed the button marked 'Another Test'") EndSwitch WEnd Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam Local $nCommand = BitAND($wParam, 0x000f) $wParam1 = BitAND($wParam, 0xfff0) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider ConsoleWrite("+Slider moved to: " & GUICtrlRead($Slider) & @LF) EndSwitch Case $WM_VSCROLL Case $WM_COMMAND Switch $nID Case $Button ConsoleWrite(">Button Test pressed" & @LF) Case $Button2 ConsoleWrite(">Button Another Test pressed" & @LF) Case Else MsgBox(0, "WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _ "MsgID" & @TAB & ":" & $iMsg & @LF & _ "wParam" & @TAB & ":" & $wParam & @LF & _ "lParam" & @TAB & ":" & $lParam & @LF & @LF & _ "WM_COMMAND - Infos:" & @LF & _ "-----------------------------" & @LF & _ "Code" & @TAB & ":" & $nNotifyCode & @LF & _ "CtrlID" & @TAB & ":" & $nID & @LF & _ "CtrlHWnd" & @TAB & ":" & $hCtrl) EndSwitch Case $WM_SYSCOMMAND Switch $wParam Case $SC_CLOSE ConsoleWrite("!Exit pressed" & @LF) Exit Case $SC_RESTORE ConsoleWrite("!Restore window" & @LF) Case $SC_MINIMIZE ConsoleWrite("!Minimize Window" & @LF) Case $SC_MOUSEMENU + 3 ConsoleWrite("!System menu pressed" & @LF) Case $SC_MOVE ConsoleWrite("!System menu Move Option pressed" & @LF) Return 0 Case $SC_MOVE + 2 ConsoleWrite("!Title bar clicked" & @LF) Case $SC_SIZE ConsoleWrite("!System menu Size Option pressed" & @LF) Case Else Switch ($wParam - $wParam1) Case 1 ConsoleWrite("!Left side of GUI clicked" & @LF) Case 2; This and the following case statements are only valid when the GUI is resizable ConsoleWrite("!Right side of GUI clicked" & @LF) Case 3 ConsoleWrite("!Top border clicked" & @LF) Case 4 ConsoleWrite("!Top Left corner of GUI clicked" & @LF) Case 5 ConsoleWrite("!Top Right corner of GUI clicked" & @LF) Case 6 ConsoleWrite("!Bottom side of GUI clicked" & @LF) Case 7 ConsoleWrite("!Lower Left corner of GUI clicked" & @LF) Case 8 ConsoleWrite("!Lower Right corner of GUI clicked" & @LF) Case Else MsgBox(0, "WM_SYSCOMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _ "MsgID" & @TAB & ":" & $iMsg & @LF & _ "wParam" & @TAB & ":" & $wParam & @LF & _ "lParam" & @TAB & ":" & $lParam & @LF & @LF & _ "WM_COMMAND - Infos:" & @LF & _ "-----------------------------" & @LF & _ "Code" & @TAB & ":" & $nNotifyCode & @LF & _ "CtrlID" & @TAB & ":" & $nID & @LF & _ "CtrlHWnd" & @TAB & ":" & $hCtrl) EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_EXTRACTOR1 point -
1 point
-
Translate autoit operators to C#
AutID reacted to Richard Robertson for a topic
while ((Math.Abs(x) >= 6) || (Math.Abs(r) >= 0.3) || (q <= 0))1 point -
Call mode of dlls
trancexx reacted to Richard Robertson for a topic
That is internal behavior and unimportant for you as an AutoIt user. I can't answer the question as AutoIt is closed source.1 point -
Just change the timderdiff value. And add a sleep in there to conserve your cpu load. Local $timer = TimerInit() While TimerDiff($timer)<15000 Sleep(10) $text=ControlGetText("[CLASS:tooltips_class32]","","") $strtxt = StringMid($text, 1, 1) If $strtxt = "C" Then ExitLoop WEnd1 point
-
Wait few Sec, then continue
flyingmarsii reacted to Geir1983 for a topic
Try this TimerInit($timer) While TimerDiff($timer)<2000 $text=ControlGetText("[CLASS:tooltips_class32]","","") $strtxt = StringMid($text, 1, 1) If $strtxt = "C" Then ExitLoop EndIf WEnd1 point -
1 point
-
Many Thanks I will update the @error -1 no received data to @extended = -1 Cheers1 point
-
Try this (GDI+ version): ;coded by UEZ build 2014-06-13 #cs A4 paper size 72 dpi (web) = 595 X 842 pixels 200 dpi (print) = 1654 X 2339 pixels 300 dpi (print) = 2480 X 3508 pixels 600 dpi (print) = 4960 X 7016 pixels Letter 72 dpi (web) = 612 X 792 pixels 200 dpi (print) = 1700 X 2200 pixels 300 dpi (print) = 2550 X 3300 pixels 600 dpi (print) = 5100 X 6600 pixels #ce AutoItSetOption("MustDeclareVars", 1) #include <GDIPlus.au3> #include <File.au3> Global $bRec = 1 Global $sFolder = FileSelectFolder("Select a folder with GDI+ supported images", @ScriptDir, 0, "") If @error Then Exit MsgBox(16, "Error", "No folder has been selected - exiting script!", 30) Global $t = TimerInit() Global $aFiles = _FileListToArrayRec($sFolder, "*.jpg;*.png;*.gif;*.bmp", $FLTAR_FILES, $bRec, $FLTAR_SORT, $FLTAR_FULLPATH) Global $te = TimerDiff($t) If UBound($aFiles) = 1 Then Exit MsgBox(16, "Error", "No images found in dir " & $sFolder & " - exiting script!", 30) Global $sDestFolder = FileSelectFolder("Select destination folder where the contact sheets will be saved to", @ScriptDir, 0, "") If @error Then Exit MsgBox(16, "Error", "No destination folder has been selected - exiting script!", 30) If Not FileExists($sDestFolder) Then DirCreate($sDestFolder) If StringRight($sFolder, 1) = "\" Then $sDestFolder = StringTrimRight($sDestFolder, 1) ConsoleWrite($aFiles[0] & " image files detected in " & Round($te, 2) & " milli seconds. Processing..." & @CRLF) _GDIPlus_Startup() Global $iPieces = 8, $iExtended = 0, $iRet $t = TimerInit() $iRet = _GDIPlus_BitmapCreateContactSheets($aFiles, $sDestFolder, $iPieces) $iExtended = @extended If $iExtended Then ConsoleWrite($iRet & @CRLF) $te = TimerDiff($t) ConsoleWrite("Processed " & $aFiles[0] & " image files in " & Round($te / 1000, 2) & " seconds, added " & $aFiles[0] - $iExtended & " images and created " & Ceiling(($aFiles[0] - $iExtended) / $iPieces ^ 2) & " contact sheets!" & @CRLF) _GDIPlus_Shutdown() Func _GDIPlus_BitmapCreateContactSheets($aFiles, $sDestFolder, $iPieces = 4, $iWidth = 842, $iHeight = 595) If Not IsArray($aFiles) Then Return SetError(1, 0, 0) If UBound($aFiles) = 1 Then Return SetError(2, 0, 0) Local $iW = Floor($iWidth / $iPieces), $iH = Floor($iHeight / $iPieces), $iPages = Ceiling($aFiles[0] / $iPieces ^ 2), $iX = 0, $iY = 0, $i, $j = 1, $hBmp_tmp, $iErrors = 0, $sErrorFiles Local Const $hBitmap_CS = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) Local Const $hGfx_CS = _GDIPlus_ImageGetGraphicsContext($hBitmap_CS) For $i = 1 To $iPages _GDIPlus_GraphicsClear($hGfx_CS) While $iY < $iPieces While $iX < $iPieces If $j > $aFiles[0] Then ExitLoop 2 $hBmp_tmp = _GDIPlus_BitmapFitCenteredToSize($aFiles[$j], $iW, $iH) If @error Then $iErrors += 1 $sErrorFiles &= $aFiles[$j] & ";" $j += 1 ContinueLoop 2 Else _GDIPlus_GraphicsDrawImageRect($hGfx_CS, $hBmp_tmp, $iW * $iX, $iH * $iY, $iW, $iH) _GDIPlus_BitmapDispose($hBmp_tmp) $iX += 1 EndIf $j += 1 WEnd $iX = 0 $iY += 1 WEnd $iY = 0 _GDIPlus_ImageSaveToFile($hBitmap_CS, $sDestFolder & "\ContactSheets" & StringFormat("%0" & StringLen($iPages) & "i", $i) & ".png") If $j > $aFiles[0] Then ExitLoop Next _GDIPlus_GraphicsDispose($hGfx_CS) _GDIPlus_BitmapDispose($hBitmap_CS) If $iErrors Then Return SetError(1, $iErrors, "Skipped files (" & $iErrors & "): " & $sErrorFiles) Return 1 EndFunc ;==>_GDIPlus_BitmapCreateContactSheets Func _GDIPlus_BitmapFitCenteredToSize($sFile, $iW, $iH, $bDisplayFilename = True, $sFontname = "Verdana", $bFullpath= False, $bUpscale = False) Local Const $hBitmap = _GDIPlus_BitmapCreateFromFile($sFile) If @error Then Return SetError(10, 0, 0) Local Const $iWidth = _GDIPlus_ImageGetWidth($hBitmap), $iHeight = _GDIPlus_ImageGetHeight($hBitmap) Local $f, $iW_new, $iH_new If $iW >= $iH Then If $iWidth > $iHeight Then $f = $iW / $iWidth If Int($iHeight * $f) > $iH Then $f = $iH / $iHeight Else $f = $iH / $iHeight If Int($iWidth * $f) > $iW Then $f = $iW / $iWidth EndIf Else If $iWidth >= $iHeight Then $f = $iW / $iWidth If Int($iHeight * $f) > $iH Then $f = $iH / $iHeight Else $f = $iH / $iHeight If Int($iWidth * $f) > $iW Then $f = $iW / $iWidth EndIf EndIf $f = (Not $bUpscale And ($iWidth < $iW) And ($iHeight < $iH)) ? 1 : $f $iW_new = Int($iWidth * $f) $iH_new = Int($iHeight * $f) Local Const $hBitmap_new = _GDIPlus_BitmapCreateFromScan0($iW, $iH), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap_new) _GDIPlus_GraphicsSetInterpolationMode($hGfx, 7) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap, ($iW - $iW_new) / 2, ($iH - $iH_new) / 2, $iW_new, $iH_new) If $bDisplayFilename Then Local $iSize = Int(($iW + $iH) / 40) $iSize = ($iSize < 8) ? 8 : ($iSize > 12) ? 12 : $iSize _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 2) Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFontname) Local Const $hFormat = _GDIPlus_StringFormatCreate() Local Const $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_StringFormatSetLineAlign($hFormat, 2) Local Const $hPath = _GDIPlus_PathCreate() Local $sPath = (Not $bFullpath) ? StringRegExpReplace($sFile, ".+\\(.+)", "$1") : $sFile _GDIPlus_PathAddString($hPath, $sPath, $tLayout, $hFamily, 0, $iSize, $hFormat) Local Const $hPen = _GDIPlus_PenCreate(0xFF000000, 1 + Int($iSize / 11)) Local Const $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) _GDIPlus_GraphicsDrawPath($hGfx, $hPath, $hPen) _GDIPlus_GraphicsFillPath($hGfx, $hPath, $hBrush) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) EndIf _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap_new EndFunc ;==>_GDIPlus_BitmapFitCenteredToSize Benchmark: Processed 997 image files in 69.28 seconds, added 993 images and created 16 contact sheets! Please report any bugs! Br, UEZ Edit1: fixed memory leak Edit2: fixed a bug in _GDIPlus_BitmapFitCenteredToSize function (calculation) and added text (filename)1 point
-
I made some changes, so now it works quite perfect: 1) it detects overlapping titles and select only the top window. 2) it stops default scrolling in window EDIT: no... 3) it gets also windows not active 4) it doesn't select hidden window 5) it detects if wheel up or down and make different actions I used the func _WinAPI_WindowFromPoint, _WinAPI_GetParent. I had to get the delta value to see if wheel up or down, but I don't know how, so I made an hack looking at the first number of DllStructGetData($tMSLL, 3): if 7 wheel UP. Now the code makes window minimize when wheel down on title and maximize when wheel up: #include <WinAPI.au3> #include <WindowsConstants.au3> OnAutoItExitRegister("_Close") Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ';uint mouseData;uint flags;uint time;ulong_ptr dwExtraInfo;' Global $hFunc, $pFunc, $hHook, $hMod $hFunc = DllCallbackRegister('_MouseProc', 'lresult', 'int;int;int') $pFunc = DllCallbackGetPtr($hFunc) $hMod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pFunc, $hMod) While 1 Sleep(20) WEnd Func _MouseProc($iCode, $iwParam, $ilParam) Static $x0, $y0 If $iCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) Local $tMSLL = DllStructCreate($tagMSLLHOOKSTRUCT, $ilParam) If $iwParam = $WM_MOUSEWHEEL Then $x = DllStructGetData($tMSLL, 'X') $y = DllStructGetData($tMSLL, 'Y') If $x <> $x0 And $y <> $y0 Then Local $point = DllStructCreate($tagPOINT) DllStructSetData($point,"X", $x) DllStructSetData($point,"Y", $y) local $hWnd = _WinAPI_WindowFromPoint($point) ; Retrieve the window handle. ; check it's a handle from the root window if _WinAPI_GetParent($hWnd) = 0 Then ; check it's not a wheel outside title: Local $rect = _WinAPI_GetWindowRect($hWnd) DllStructSetData($rect, "Bottom", DllStructGetData($rect, "Top")+35) If _WinAPI_PtInRect($rect, $point) Then if StringLeft(DllStructGetData($tMSLL, 3),1) = 7 Then ; hack to get if wheel UP... (it starts with 4 for down) WinSetState($hWnd,"",@SW_MAXIMIZE ) Else WinSetState($hWnd,"",@SW_MINIMIZE ) EndIf Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) EndIf EndIf EndIf EndIf Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) EndFunc Func _Close() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hHook) Exit EndFunc1 point
-
GUIRegisterMsg replacement for GUICtrlSetOnEvent and GUIGetMsg
Professor_Bernd reacted to BrewManNH for a topic
Here's an updated version of the same code as above, but using a single function to handle all 3 types of Windows messages. I'm sure there's a Windows constant for the 2 numbers I used in the Switch statement for $iMsg, but I wasn't able to find out what it was. The 273 is used to activate the button control function, which also works on combobox controls, the 274 is the GUI messages for things like the sysmenu and the close button. If anyone knows the variables for those 2 numbers, please let me know. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUIRegisterMsg($WM_COMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_SYSCOMMAND, "_WM_EXTRACTOR") GUIRegisterMsg($WM_HSCROLL, "_WM_EXTRACTOR") $GUI = GUICreate("Test GUI", 200, 200, -1, -1, BitOR($WS_THICKFRAME, $gui_ss_default_gui)) $Button = GUICtrlCreateButton("Test", 20, 20) $Button2 = GUICtrlCreateButton(" Another Test ", 20, 100) $Slider = GUICtrlCreateSlider(20, 60, 150) $hSlider = GUICtrlGetHandle($Slider) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $Button MsgBox(0, "", "You pressed the button marked TEST") Case $Button2 MsgBox(0, "", "You pressed the button marked 'Another Test'") EndSwitch WEnd Func _WM_EXTRACTOR($hWnd, $iMsg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam #forceref $hWnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider ConsoleWrite("+Slider moved to: " & GUICtrlRead($Slider) & @LF) EndSwitch Case $WM_VSCROLL Case 273 Switch $nID Case $Button ConsoleWrite(">Button Test pressed" & @LF) Case $Button2 ConsoleWrite(">Button Another Test pressed" & @LF) Case Else MsgBox(0, "MY_WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _ "MsgID" & @TAB & ":" & $msg & @LF & _ "wParam" & @TAB & ":" & $wParam & @LF & _ "lParam" & @TAB & ":" & $lParam & @LF & @LF & _ "WM_COMMAND - Infos:" & @LF & _ "-----------------------------" & @LF & _ "Code" & @TAB & ":" & $nNotifyCode & @LF & _ "CtrlID" & @TAB & ":" & $nID & @LF & _ "CtrlHWnd" & @TAB & ":" & $hCtrl) EndSwitch Case 274 Switch $wParam Case 0xf060 ConsoleWrite("!Exit pressed" & @LF) Exit Case 0xF120 ConsoleWrite("!Restore window" & @LF) Case 0xF020 ConsoleWrite("!Minimize Window" & @LF) Case 0xF093 ConsoleWrite("!System menu pressed" & @LF) Case 0xF010 ConsoleWrite("!System menu Move Option pressed" & @LF) Return 0 Case 0xF000 ConsoleWrite("!System menu Size Option pressed" & @LF) Return 0 Case 0xF002 ; This and the following case statements are only valid when the GUI is resizable ConsoleWrite("!Right side of GUI clicked" & @LF) Return 0 Case 0xf001 ConsoleWrite("!Left side of GUI clicked" & @LF) Return 0 Case 0xF008 ConsoleWrite("!Lower Right corner of GUI clicked" & @LF) Return 0 Case 0xF007 ConsoleWrite("!Lower Left corner of GUI clicked" & @LF) Return 0 Case 0xF006 ConsoleWrite("!Bottom side of GUI clicked" & @LF) Return 0 Case Else MsgBox(0, "MY_WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _ "MsgID" & @TAB & ":" & $msg & @LF & _ "wParam" & @TAB & ":" & $wParam & @LF & _ "lParam" & @TAB & ":" & $lParam & @LF & @LF & _ "WM_COMMAND - Infos:" & @LF & _ "-----------------------------" & @LF & _ "Code" & @TAB & ":" & $nNotifyCode & @LF & _ "CtrlID" & @TAB & ":" & $nID & @LF & _ "CtrlHWnd" & @TAB & ":" & $hCtrl) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_EXTRACTOR1 point