Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/11/2013 in all areas

  1. funkey

    CreateResourceDLL

    Hello, I just added a few scripts together to get a function for creating a resource dll. You can add icons und pictures to the library for now. I hope you like it. #include <WinAPIEx.au3> #include <Array.au3> #include <APIConstants.au3> #include <GDIPlus.au3> #include <Memory.au3> #include <StaticConstants.au3> Global $sDLL = @ScriptDir & "Resourcen.dll" Global $sTempFile, $aFiles[1] Global Const $tagICONDIRENTRY = "BYTE bWidth;BYTE bHeight;BYTE bColorCount;BYTE bReserved;WORD wPlanes;WORD wBitCount;DWORD dwBytesInRes;DWORD dwImageOffset" Global Const $tagGRPICONDIRENTRY = "BYTE bWidth;BYTE bHeight;BYTE bColorCount;BYTE bReserved;WORD wPlanes;WORD wBitCount;DWORD dwBytesInRes;WORD nID" Global Const $SS_REALSIZECONTROL = 0x40 While 1 $sTempFile = FileOpenDialog("Select resource files", @ScriptDir, "All files (*.*)|Icons (*.ico)|Bitmaps (*.bmp)", 3) If @error Then ExitLoop If $aFiles[0] = "" Then $aFiles[0] = $sTempFile Else _ArrayAdd($aFiles, $sTempFile) EndIf WEnd _CreateResourceDLL($sDLL, $aFiles) Global $aIcon = _ArrayFindAll($aFiles, ".ico", 0, 0, 0, 1, 0) Global $aBitmap = _ArrayFindAll($aFiles, ".bmp", 0, 0, 0, 1, 0) Global $aJpg = _ArrayFindAll($aFiles, ".jpg", 0, 0, 0, 1, 0) GUICreate("Resource DLL", 800, 800) If IsArray($aIcon) Then For $i = 0 To UBound($aIcon) - 1 GUICtrlCreateIcon($sDLL, $aFiles[$aIcon[$i]], 10, 10 + 40 * $i, 32, 32, $SS_SUNKEN) GUICtrlCreateLabel($aFiles[$aIcon[$i]], 50, 10 + 40 * $i, 120, 32, $SS_CENTERIMAGE) Next EndIf If IsArray($aBitmap) Then For $i = 0 To UBound($aBitmap) - 1 GUICtrlCreatePic("", 200, 30 + 120 * $i, 100, 100, BitOR($SS_REALSIZECONTROL, $SS_SUNKEN)) _SetImagefromResource(-1, $aFiles[$aBitmap[$i]], $sDLL, $RT_BITMAP) GUICtrlCreatePic("", 310, 30 + 120 * $i, 100, 100, BitOR($SS_CENTERIMAGE, $SS_SUNKEN)) _SetImagefromResource(-1, $aFiles[$aBitmap[$i]], $sDLL, $RT_BITMAP) GUICtrlCreateLabel($aFiles[$aBitmap[$i]], 200, 10 + 120 * $i, 120, 20, 0x200) Next EndIf If IsArray($aJpg) Then For $i = 0 To UBound($aJpg) - 1 GUICtrlCreatePic("", 440, 30 + 120 * $i, 100, 100, BitOR($SS_REALSIZECONTROL, $SS_SUNKEN)) _SetImagefromResource(-1, $aFiles[$aJpg[$i]], $sDLL, $RT_RCDATA) GUICtrlCreatePic("", 550, 30 + 120 * $i, 100, 100, BitOR($SS_CENTERIMAGE, $SS_SUNKEN)) _SetImagefromResource(-1, $aFiles[$aJpg[$i]], $sDLL, $RT_RCDATA) GUICtrlCreateLabel($aFiles[$aJpg[$i]], 440, 10 + 120 * $i, 120, 20, 0x200) Next EndIf GUISetState() Do Until GUIGetMsg() = -3 Func _CreateResourceDLL($sDLL, ByRef $aFiles) If Not IsArray($aFiles) Or $aFiles[0] = "" Then Return SetError(1, 0, 0) _CreateEmptyDLL($sDLL) Local $hUpdate = _WinAPI_BeginUpdateResource($sDLL, 0) If @error Then Return SetError(2, 0, 0) Local $hFile, $bFile, $lFile, $tFile, $pFile, $sName, $sExt, $RT_TYPE, $Resource_ID = 0 Local $tICONDIR, $tICONDIRENTRY, $tGRPICONDIR, $pGRPICONDIR Local $Temp Local $nSize For $i = 0 To UBound($aFiles) - 1 If Not FileExists($aFiles[$i]) Then SetError(3, 0, 0) $hFile = FileOpen($aFiles[$i], 0) $bFile = FileRead($hFile) FileClose($hFile) $lFile = FileGetSize($aFiles[$i]) $tFile = DllStructCreate("char[" & $lFile & "]") DllStructSetData($tFile, 1, $bFile) $pFile = DllStructGetPtr($tFile) $sName = StringUpper(StringTrimLeft($aFiles[$i], StringInStr($aFiles[$i], "", 0, -1))) $sExt = StringTrimLeft($aFiles[$i], StringInStr($aFiles[$i], ".", 0, -1)) $aFiles[$i] = $sName Switch $sExt Case "bmp" $RT_TYPE = $RT_BITMAP $lFile = $lFile - 14 $pFile = Ptr($pFile + 14) Case "ico" $RT_TYPE = $RT_ICON Local $tB_Input_Header = DllStructCreate("short res;short type;short ImageCount;char rest[" & $lFile - 5 & "]", $pFile) Local $pB_Input_Header = DllStructGetPtr($tB_Input_Header) Local $IconType = DllStructGetData($tB_Input_Header, "Type") Local $IconCount = DllStructGetData($tB_Input_Header, "ImageCount") Local $tB_IconGroupHeader = DllStructCreate("short Res;short Type;short ImageCount;char Rest[" & $IconCount * 14 & "]") Local $pB_IconGroupHeader = DllStructGetPtr($tB_IconGroupHeader) DllStructSetData($tB_IconGroupHeader, "Res", 0) DllStructSetData($tB_IconGroupHeader, "Type", $IconType) DllStructSetData($tB_IconGroupHeader, "ImageCount", $IconCount) For $X = 1 To $IconCount Local $pB_Input_IconHeader = DllStructGetPtr($tB_Input_Header, 4) + ($X - 1) * 16 Local $tB_Input_IconHeader = DllStructCreate($tagICONDIRENTRY, $pB_Input_IconHeader) Local $IconWidth = DllStructGetData($tB_Input_IconHeader, "bWidth") Local $IconHeigth = DllStructGetData($tB_Input_IconHeader, "bHeight") Local $IconColors = DllStructGetData($tB_Input_IconHeader, "bColorCount") Local $IconPlanes = DllStructGetData($tB_Input_IconHeader, "wPlanes") Local $IconBitPerPixel = DllStructGetData($tB_Input_IconHeader, "wBitCount") Local $IconImageSize = DllStructGetData($tB_Input_IconHeader, "dwBytesInRes") Local $IconImageOffset = DllStructGetData($tB_Input_IconHeader, "dwImageOffset") $pB_IconGroupHeader = DllStructGetPtr($tB_IconGroupHeader, 4) + ($X - 1) * 14 Local $tB_GroupIcon = DllStructCreate($tagGRPICONDIRENTRY, $pB_IconGroupHeader) DllStructSetData($tB_GroupIcon, "bWidth", $IconWidth) DllStructSetData($tB_GroupIcon, "bHeigth", $IconHeigth) DllStructSetData($tB_GroupIcon, "bColorCount", $IconColors) DllStructSetData($tB_GroupIcon, "bReserved", 0) DllStructSetData($tB_GroupIcon, "wPlanes", $IconPlanes) DllStructSetData($tB_GroupIcon, "wBitCount", $IconBitPerPixel) DllStructSetData($tB_GroupIcon, "dwBytesInRes", $IconImageSize) $Resource_ID += 1 DllStructSetData($tB_GroupIcon, "nID", $Resource_ID) Local $PB_IconData = DllStructGetPtr($tB_Input_Header) + $IconImageOffset _WinAPI_UpdateResource($hUpdate, $RT_TYPE, $Resource_ID, Int("0x" & @OSLang), $PB_IconData, $IconImageSize) Next $pB_IconGroupHeader = DllStructGetPtr($tB_IconGroupHeader) Case "jpg", "jpeg", "gif" $RT_TYPE = $RT_RCDATA ;~ Case "cur" ;~ $RT_TYPE = $RT_CURSOR ;~ Case "txt", "au3", "ini", "c", "cpp", "h" ;~ $RT_TYPE = $RT_STRING Case Else ContinueLoop EndSwitch If $RT_TYPE = $RT_ICON Then _WinAPI_UpdateResource($hUpdate, $RT_GROUP_ICON, $sName, Int("0x" & @OSLang), $pB_IconGroupHeader, DllStructGetSize($tB_IconGroupHeader)) Else $Resource_ID += 1 _WinAPI_UpdateResource($hUpdate, $RT_TYPE, $sName, Int("0x" & @OSLang), $pFile, $lFile) EndIf ;~ If @error Then SetError(4, $i, 0) $tFile = 0 Next _WinAPI_EndUpdateResource($hUpdate) If @error Then Return SetError(5, @extended) Return 1 EndFunc ;==>_CreateResourceDLL Func _CreateEmptyDLL($sFilePath) Local $bEmptyDll = _Empty_DLL() Local $hFile = FileOpen($sFilePath, 18) ;Binary mode + Write mode (Erase old content!) FileWrite($hFile, $bEmptyDll) FileClose($hFile) EndFunc ;==>_CreateEmptyDLL Func _Empty_DLL() Local $Empty_DLL $Empty_DLL &= 'TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEFAP6WNU0AAAAAAAAAAOAADiELAQIyAAQAAAAGAAAAAAAAABAAAAAQAAAAMAAAAAAAEAAQAAAAAgAABAAAAAAAAAAEAAAAAAAAAABgAAAABAAAAAAAAAMAAAAAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAAAwAAA8AAAAAFAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAC' $Empty_DLL &= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABUMAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5jb2RlAAAAYwAAAAAQAAAAAgAAAAQAAAAAAAAAAAAAAAAAACAAAGAudGV4dAAAABgAAAAAIAAAAAIAAAAGAAAAAAAAAAAAAAAAAAAgAABgLmRhdGEAAADMAAAAADAAAAACAAAACAAAAAAAAAAAAAAAAAAAQAAAwC5yZWxvYwAAIAAAAABAAAAAAgAAAAoAAAAAAAAAAAAAAAAAAEAAAEIucnNyYwAAABAAAAAAUAAAAAIAAAAMAAAAAAAAAAAAAAAAAABAAAB' $Empty_DLL &= StringRepeat("A", 598) & 'IN8JAgBdQ6LRCQEo8QwABDoIgAAAIN8JAgCdQCDfCQIAHUF6CkAAACDfCQIA3UAuAEAAADCDABoAAAAAGgAEAAAaAAAAADouw8AAKPAMAAQw+gMAAAA/zXAMAAQ6KsPAADDww' $Empty_DLL &= StringRepeat("A", 550) & '/yVUMAAQ/yVcMAAQ/yVgMAAQ/yVkMAAQ' $Empty_DLL &= StringRepeat("A", 651) $Empty_DLL &= '8MAAAAAAAAAAAAAB2MAAAVDAAAEQwAAAAAAAAAAAAALIwAABcMAAAAAAAAAAAAAAAAAAAAAAAAAAAAABsMAAAAAAAAIIwAACQMAAAnjAAAAAAAABsMAAAAAAAAIIwAACQMAAAnjAAAAAAAACZAm1lbXNldAAATVNWQ1JULmRsbAAApAJIZWFwQ3JlYXRlAAClAkhlYXBEZXN0cm95APoBR2V0TW9kdWxlSGFuZGxlVwAAS0VSTkVMMzIuZGxs' $Empty_DLL &= StringRepeat("A", 431) & 'QAAAQAAAADDBMMFgwAAAAIAAAEAAAAAIwCDAOMBQw' $Empty_DLL &= StringRepeat("A", 645) & 'BSXNk0DAAc' $Empty_DLL &= StringRepeat("A", 668) & '=' Return Binary(_Base64Decode($Empty_DLL)) EndFunc ;==>_Empty_DLL Func _Base64Decode($input_string) Local $struct = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0) If @error Or Not $a_Call[0] Then Return SetError(2, 0, "") Return DllStructGetData($a, 1) EndFunc ;==>_Base64Decode Func StringRepeat($sChar, $nCount) $tBuffer = DllStructCreate("char[" & $nCount + 1 & "]") DllCall("msvcrt.dll", "ptr:cdecl", "memset", "ptr", DllStructGetPtr($tBuffer), "int", Asc($sChar), "int", $nCount) Return DllStructGetData($tBuffer, 1) EndFunc ;==>StringRepeat Func _SetImagefromResource($CtrlID, $Resname, $Resfile = -1, $ResType = 10) ;Raupi ;Diese Funktion basiert auf der UDF von Zedna@Autitscript.com und Code von Progandy@AutoIt.de Local Const $IMAGE_BITMAP = 0 Local Const $STM_SETIMAGE = 0x0172 Local $hmod, $hwnd, $InfoBlock, $ResSize, $Mem, $pMem, $dll, $dll2, $hData, $pData, $pStream, $ret, $hBitmap, $pBitmap If $Resfile = -1 Then $hmod = _WinAPI_GetModuleHandle("") Else $hmod = _WinAPI_LoadLibrary($Resfile) EndIf If $ResType = $RT_BITMAP Then $hBitmap = _WinAPI_LoadImage($hmod, $Resname, $IMAGE_BITMAP, 0, 0, 0) If @error Then Return SetError(1, 0, 0) $hwnd = GUICtrlGetHandle($CtrlID) If $hwnd = 0 Then Return SetError(2, 0, 0) DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hwnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(3, 0, 0) Else $InfoBlock = DllCall("kernel32.dll", "int", "FindResourceA", "int", $hmod, "str", $Resname, "long", $ResType) If @error Then Return SetError(4, 0, 0) $InfoBlock = $InfoBlock[0] If $InfoBlock = 0 Then Return SetError(5, 0, 0) $ResSize = DllCall("kernel32.dll", "dword", "SizeofResource", "int", $hmod, "int", $InfoBlock) If @error Then Return SetError(6, 0, 0) $ResSize = $ResSize[0] If $ResSize = 0 Then Return SetError(7, 0, 0) $Mem = DllCall("kernel32.dll", "int", "LoadResource", "int", $hmod, "int", $InfoBlock) If @error Then Return SetError(8, 0, 0) $Mem = $Mem[0] If $Mem = 0 Then Return SetError(9, 0, 0) $pMem = DllCall("kernel32.dll", "int", "LockResource", "int", $Mem) If @error Then Return SetError(8, 0, 0) $pMem = $pMem[0] If $pMem = 0 Then Return SetError(10, 0, 0) If $Resfile <> -1 Then DllCall("Kernel32.dll", "int", "FreeLibrary", "str", $hmod) $hData = _MemGlobalAlloc($ResSize, 2) $pData = _MemGlobalLock($hData) _MemMoveMemory($pMem, $pData, $ResSize) _MemGlobalUnlock($hData) $ret = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "int", $hData, "long", 1, "Int*", 0) $pStream = $ret[3] _GDIPlus_Startup() $pBitmap = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromStream", "ptr", $pStream, "int*", 0) $pBitmap = $pBitmap[2] $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($pBitmap) $hwnd = GUICtrlGetHandle($CtrlID) If $hwnd = 0 Then Return SetError(11, 0, 0) DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hwnd, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap) If @error Then Return SetError(12, 0, 0) _GDIPlus_BitmapDispose($pBitmap) _GDIPlus_Shutdown() $dll = DllStructCreate("Uint", $pStream) $dll2 = DllStructCreate("uInt", DllStructGetData($dll, 1) + 8) DllCall("", "UInt", DllStructGetData($dll2, 1), "UInt", $pStream) _WinAPI_DeleteObject($pStream) $pStream = 0 _MemGlobalFree($hData) If $Resfile <> -1 Then _WinAPI_FreeLibrary($hmod) EndIf EndFunc ;==>_SetImagefromResource Download au3 Download au3 with function for icons, pictures(bmp, jpg, gif), fonts(only ttf tested) Download new au3 without temp file creating in example part
    1 point
  2. robcull, I am not a lawyer, but here is my take: As the interpreter is required to run the code (whether compiled or not), I would say that the answer is "Yes". The EULA as included with the install - which allows you to do anything you like with the code you write. Similarly, you can use any of the standard includes that are installed with AutoIt. As to code you find on the forum, most of it is free to use - only a very few people have attached licenses to their posted efforts and this is always clearly marked. In all cases common courtesy suggests that credit should be given to the original authors if you use all (or most) of a substantial UDF, but other than that you are clear to use anything here. Although if the end product does become "a patented commercially available product, sold for profit" a suitable donation to help Jon with server costs might be considered appropriate - and would always be welcome. I hope that helps. M23
    1 point
  3. To the OP, please use a site for your downloads that doesn't make it nearly impossible to find the download link to the correct file. I must have clicked on 6 different download buttons and none of them served up your file(s).
    1 point
  4. That's not a reliable check in my opinion.
    1 point
  5. Hello Irrelixier, Doesn't MouseDown(), MouseMove(), and MouseUp() work? MouseDown( 'left' ) Do $x1 = $x1 + Random(0, Random(0, 5), 1) MouseMove( $x1, $y1 ) Until $x1 >= Random(450, 550, 1) MouseUp( 'left' ) Happy Coding! Realm
    1 point
  6. Glad it worked out I have been messing with code like that but it just sucks you cant reference the subarray directly (only through byref func calls, and this has an obvious problem with multiple nesting) Also glad the example helped you but keep in mind it's not exactly how you're supposed to use the unmanaged autoit system (eg. avoiding the type system and does no bounds checking what so ever)..
    1 point
  7. Something like this here?: $tStruct = DllStructCreate("uint array[10]") For $i = 1 To 10 DllStructSetData($tStruct, "array", $i^2, $i) Next For $i = 1 To 10 ConsoleWrite(DllStructGetData($tStruct, "array", $i) & @LF) Next Br, UEZ
    1 point
  8. zsutton92, As you have 2 GUICtrlCreateEdit lines in both your openNew function and in the completely unnecessary code you have stuck into the script when you create the GUI initially, why are you surprised that you have 2 edit controls created? And you keep recreating the the 3 buttons - so it is little suprise that you have problems. You also have 2 GUIGetMsg idle loops. Quite frankly the script is a complete mess. Here is a tidied-up version which does work: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> ; Global variables should be declared OUTSIDE functions Global $aTabData[1][3] = [[0]] ; 0=tab 1=file 2=edit mainGUI() Func mainGUI() ; Create the GUI GUICreate("Log Viewer", 800, 700) GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) $cTab = GUICtrlCreateTab(10, 10, 780, 640) $Fing = GUICtrlCreateButton("Fing", 20, 670, 100, 20) $Find = GUICtrlCreateButton("Find", 200, 670, 100, 20) $new = GUICtrlCreateButton("Open", 600, 670, 100, 20) ; Read a file before showing the GUI so that the tab and edit are create before we show the GUI openNew() ; Now show the GUI GUISetState(@SW_SHOW) ; Note there is only the one GUIGetMsg loop in the script While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Fing Run(@ComSpec & " /c " & "C:\fing.lnk") Case $Find ; Which tab is displayed $iIndex = GUICtrlRead($cTab) + 1 ; So now we know which edit is displayed _GUICtrlEdit_Find($aTabData[$iIndex][2]) Case $new openNew() ; Every time we want a new tab we call the function again EndSwitch WEnd EndFunc ;==>mainGUI Func openNew() ; Choose a file Local $var = FileOpenDialog("", @WindowsDir & "\", "Log Files (*.txt;*.log)", 1) ; Open it Local $file = FileOpen($var) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read it $textx = FileRead($file) If @error Then ; If you check for error it must be IMEDIATELY AFTER the function you check MsgBox(4096, "", "No File(s) chosen") Else $var = StringReplace($var, "|", @CRLF) MsgBox(4096, "", "You Chose " & $var) ; Create the tab and edit for this file ONLY if it was read $aTabData[0][0] += 1 ReDim $aTabData[$aTabData[0][0] + 1][3] $aTabData[$aTabData[0][0]][0] = GUICtrlCreateTabItem($var) $aTabData[$aTabData[0][0]][1] = $var ; Sorry, you do need the NOHIDESEL style to see the found text $aTabData[$aTabData[0][0]][2] = GUICtrlCreateEdit($textx, 20, 40, 760, 600, BitOR($GUI_SS_DEFAULT_EDIT, $ES_NOHIDESEL)) ConsoleWrite("Edit: " & $aTabData[$aTabData[0][0]][2] & @CRLF) GUICtrlCreateTabItem("") EndIf ; Close file FileClose($file) EndFunc ;==>openNewLook through it and see if you can understand why this works and yours did not. If you have questions then do please ask - we want you to learn. M23
    1 point
  9. Have you ever wondered how do I create a GUI like the one shown below?! Then look no further with these Examples. I was playing around with $WS_DLGFRAME and figured that if I BitOR'd it with $WS_SIZEBOX it would create a GUI without the minimize and maximize, but what if I didn't want the re-sizing? After some playing around I realised that replacing $WS_SIZEBOX with $WS_SYSMENU would accomplish this instead of using WM_COMMAND to intercept SC_SIZE from the GUI. Then ?do=embed' frameborder='0' data-embedContent> pointed out it could be done via a different approach, so I updated using his way Examples below are for both re-sizing and non re-sizing as well as 2 Examples that don't appear in the TaskBar, this is due to using the hidden window [AutoItWinGetTitle()] as the parent handle. Any suggestions, then please post below. Thanks. Examples: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example1() ; Without Re-Sizing. Example2() ; With Re-Sizing. Example3() ; Without Re-Sizing & No TaskBar. Example4() ; With Re-Sizing & No TaskBar. Func Example1() ; Without Re-Sizing. Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example1 Func Example2() ; With Re-Sizing. Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX)) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example2 Func Example3() ; Without Re-Sizing & No TaskBar. Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), -1, WinGetHandle(AutoItWinGetTitle())) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example3 Func Example4() ; With Re-Sizing & No TaskBar. Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX), -1, WinGetHandle(AutoItWinGetTitle())) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example4Old way I was doing it: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example5() ; Old Way Of Doing It! Func Example5() ; Old Way Of Doing It! Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitOR($WS_SIZEBOX, $WS_DLGFRAME)) GUIRegisterMsg($WM_SYSCOMMAND, 'WM_SYSCOMMAND') GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example5 Func WM_SYSCOMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $ilParam Local Const $SC_MAXIMIZE = 0xF030, $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120, $SC_SIZE = 0xF000 ; $SC_MOVE = 0xF010 Switch BitAND($iwParam, 0xFFF0) Case $SC_MAXIMIZE, $SC_MINIMIZE, $SC_RESTORE, $SC_SIZE Return -1 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_SYSCOMMAND ?do=embed' frameborder='0' data-embedContent>
    1 point
×
×
  • Create New...