AdmiralAlkex Posted August 4, 2007 Share Posted August 4, 2007 (edited) EDIT (9 JUNI/JUNE 2008): DONT USE THIS!! I AM SERIOUS IT WILL MAKE YOUR WIFE EXPLODE AND YOUR COMPUTER WILL CHEAT ON YOU WITH ANOTHER WOMAN!!Once upon a time... () i saw Lod3n's script that used .png files to get extremely nice guis with shadows and transparency, so i immediately started playing with them. But the flickering was really annoying But now i think i found a good way to get rid of it!! (except you must press on the first gui to be able to move it )Unless yours computer are too diferent from mine the script should take 5-25% of your processor without flickering!!This is the first script i publish here so i hope you like it!!(Put this .Png in the same directory as the script)expandcollapse popup#include <A3LGDIPlus.au3> #Include <Misc.au3> Global Const $AC_SRC_ALPHA = 1 Global Const $ULW_ALPHA = 2 Dim $Splitted[3] _GDIP_Startup() $pngSrc = @scriptdir&"\Bakgrund.png" $hImageExperiment2 = _GDIP_ImageLoadFromFile($pngSrc) $Width = _GDIP_ImageGetWidth ($hImageExperiment2) $Height = _GDIP_ImageGetHeight($hImageExperiment2) $GuiExperiment2 = GUICreate("Experiment2", $Width, $Height, 200, 200, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW)) SetBitMap($GuiExperiment2, $hImageExperiment2, 0) GUISetState(@SW_SHOW, $GuiExperiment2) WinSetOnTop($GuiExperiment2,"",1) SetBitMap($GuiExperiment2, $hImageExperiment2, 255) $ControlGuiExperiment2 = GUICreate("ControlGuiExperiment2", 350, 80, 50, 25, $WS_POPUP, BitOR($WS_CLIPCHILDREN, $WS_EX_MDICHILD), $GuiExperiment2) GUISetState() GUISetBkColor (0x000000) GUICtrlCreateLabel("RAM=", 5, 5, 70, 25) GUICtrlSetFont(-1, 18) GUICtrlSetColor(-1, 0x0000ff) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $mem=MemGetStats() $memstat1 = GUICtrlCreateLabel(Round(($mem[1]-$mem[2])/1024,1) & " MB in use", 75, 5, 275, 25) GUICtrlSetFont(-1, 18) GUICtrlSetColor(-1, 0x00ff00) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $memstat2 = GUICtrlCreateLabel(Round($mem[2]/1024,1) & " MB available", 75, 30, 275, 25) GUICtrlSetFont(-1, 18) GUICtrlSetColor(-1, 0x00ff00) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) $memstat3 = GUICtrlCreateLabel($mem[0] & "% Percent Used", 75, 55, 275, 25) GUICtrlSetFont(-1, 18) GUICtrlSetColor(-1, 0x00ff00) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect GUISetState(@SW_SHOW, $ControlGuiExperiment2) $mem = MemGetStats() GUICtrlSetData($memstat1,Round(($mem[1]-$mem[2])/1024,1) & " MB in use") GUICtrlSetData($memstat2,Round($mem[2]/1024,1) & " MB available") GUICtrlSetData($memstat3,$mem[0] & "% Percent Used") WEnd Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) if ($hWnd = $GuiExperiment2) and ($iMsg = $WM_NCHITTEST) And _IsPressed(01) then GUISetState(@SW_HIDE, $ControlGuiExperiment2) Return $HTCAPTION EndIf EndFunc Func OnAutoItExit() GUIDelete($ControlGuiExperiment2) _API_DeleteObject($hImageExperiment2) _GDIP_Shutdown() EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _API_GetDC(0) $hMemDC = _API_CreateCompatibleDC($hScrDC) $hBitmap = _GDIP_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _API_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize ) DllStructSetData($tSize, "X", _GDIP_ImageGetWidth ($hImage)) DllStructSetData($tSize, "Y", _GDIP_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha" , $iOpacity ) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _API_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _API_ReleaseDC (0, $hScrDC) _API_SelectObject($hMemDC, $hOld) _API_DeleteObject($hBitmap) _API_DeleteDC ($hMemDC) EndFunc Edited June 9, 2008 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Achilles Posted August 7, 2007 Share Posted August 7, 2007 That's pretty cool, I might try making some fancy GUI's.... This does flicker if you try dragging the central box part on top of the picture My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
idusy Posted August 7, 2007 Share Posted August 7, 2007 I never had any flickering problems with the original? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 9, 2007 Author Share Posted August 9, 2007 (edited) Sry for not posting sooner but i kinda lost track of time....That's pretty cool, I might try making some fancy GUI's.... This does flicker if you try dragging the central box part on top of the picture Well since this is just a byproduct of something else i am doing i didn't really test everything, but i see what you mean, also i have noted strange things happening on Win Vista. Since i am working on 3 projects at the same time it is going a bit slowly but i should have it fixed before school starts (in two weeks).I never had any flickering problems with the original?Try putting my code for the memory in Lod3n's script and you should see extreme flickering at this speed.WOW 2 replies!! well atleast better than nothing! Edited August 9, 2007 by TzarAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Achilles Posted August 9, 2007 Share Posted August 9, 2007 school starts (in two weeks) x 1000000000000000000000000000 My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
lordicast Posted August 14, 2007 Share Posted August 14, 2007 kind of newbie ques but how would i put somthing like that in a simple gui like this? #include <GUIConstants.au3> GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode",2) $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100) $Button_2 = GUICtrlCreateButton ( "Button Test", 0, -1) GUISetState () ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Run('Notepad.exe') ; Will Run/Open Notepad Case $msg = $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed') ; Will demonstrate Button 2 being pressed EndSelect Wend [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
Achilles Posted August 14, 2007 Share Posted August 14, 2007 kind of newbie ques but how would i put somthing like that in a simple gui like this? #include <GUIConstants.au3> GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode",2) $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100) $Button_2 = GUICtrlCreateButton ( "Button Test", 0, -1) GUISetState () ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Run('Notepad.exe') ; Will Run/Open Notepad Case $msg = $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed') ; Will demonstrate Button 2 being pressed EndSelect Wendexpandcollapse popup#include <GUIConstants.au3> #include <A3LGDIPlus.au3> #Include <Misc.au3> Opt("OnExitFunc","OnAutoItExit") Global Const $AC_SRC_ALPHA = 1 Global Const $ULW_ALPHA = 2 Dim $Splitted[3] _GDIP_Startup() $pngSrc = @scriptdir&"\Bakgrund.png" $hImageExperiment2 = _GDIP_Image($pngSrc) $Width = _GDIP_ImageGetWidth ($hImageExperiment2) $Height = _GDIP_ImageGetHeight($hImageExperiment2) $GuiExperiment2 = GUICreate("Experiment2", $Width, $Height, 200, 200, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW)); will create a dialog box that when displayed is centered SetBitMap($GuiExperiment2, $hImageExperiment2, 0) GUISetState(@SW_SHOW, $GuiExperiment2) WinSetOnTop($GuiExperiment2,"",1) SetBitMap($GuiExperiment2, $hImageExperiment2, 255) $ControlGuiExperiment2 = GUICreate("ControlGuiExperiment2", 350, 80, 50, 25, $WS_POPUP, BitOR($WS_CLIPCHILDREN, $WS_EX_MDICHILD), $GuiExperiment2) GUISetBkColor (0x000000) $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100, 30) $Button_2 = GUICtrlCreateButton ( "Button Test", 110, 30, 100, 30) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState (); will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 Switch GuiGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 Run('Notepad.exe'); Will Run/Open Notepad Case $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed'); Will demonstrate Button 2 being pressed EndSwitch GUISetState(@SW_SHOW, $ControlGuiExperiment2) Wend Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) if ($hWnd = $GuiExperiment2) and ($iMsg = $WM_NCHITTEST) And _IsPressed(01) then GUISetState(@SW_HIDE, $ControlGuiExperiment2) Return $HTCAPTION EndIf EndFunc Func OnAutoItExit() GUIDelete($ControlGuiExperiment2) _API_DeleteObject($hImageExperiment2) _GDIP_Shutdown() EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _API_GetDC(0) $hMemDC = _API_CreateCompatibleDC($hScrDC) $hBitmap = _GDIP_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _API_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize ) DllStructSetData($tSize, "X", _GDIP_ImageGetWidth ($hImage)) DllStructSetData($tSize, "Y", _GDIP_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha" , $iOpacity ) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _API_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _API_ReleaseDC (0, $hScrDC) _API_SelectObject($hMemDC, $hOld) _API_DeleteObject($hBitmap) _API_DeleteDC ($hMemDC) EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Michel Claveau Posted August 15, 2007 Share Posted August 15, 2007 Hi, Piano_Man! Change your line 15, from $hImageExperiment2 = _GDIP_Image($pngSrc) to $hImageExperiment2 = _GDIP_ImageLoadFromFile($pngSrc) Link to comment Share on other sites More sharing options...
Achilles Posted August 15, 2007 Share Posted August 15, 2007 (edited) Hi, Piano_Man! Change your line 15, from $hImageExperiment2 = _GDIP_Image($pngSrc) to $hImageExperiment2 = _GDIP_ImageLoadFromFile($pngSrc)That depends on what version of AutoItLib your using. I think, correct me if I'm wrong, that GaFrost when through and changed the names to a lot of the function and some of the function, and he changed _GDIP_ImageLoadFromFile to _GDIP_Image... When I last updated AutoItLib it came with all these name changes, which successfully gave some of my lots of errors EDIT: I think this is where he says he did the changes... Edited August 15, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
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