twitchyliquid64 Posted November 17, 2010 Share Posted November 17, 2010 (edited) Hi all, Im trying to make a line sweep down from the top of the users screen to the bottom to symbolise the end of a virus scan. Obviously, It cannot be in a window. To do this in a window it would be easy, create a window, create the drawing area from HWND, then draw the line, clear, and redraw. But how would you do this NOT in a window? Edited November 18, 2010 by hyperzap ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
JohnOne Posted November 17, 2010 Share Posted November 17, 2010 But how would you do this in a window?"create a window, create the drawing area from HWND, then draw the line, clear, and redraw."Sorry I couldnt resist. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Ascend4nt Posted November 18, 2010 Share Posted November 18, 2010 (edited) Another easy one =) $hBarGUI=GUICreate("",@DesktopWidth,20,0,0,0x80000000,0x08000080) GUISetBkColor(0xFF,$hBarGUI) WinSetTrans($hBarGUI,'',0) WinSetState($hBarGUI,'',@SW_SHOWNOACTIVATE) WinMove($hBarGUI,'',0,-19) WinSetTrans($hBarGUI,'',100) For $i=-18 To @DesktopHeight Step 5 WinMove($hBarGUI,'',0,$i) Sleep(10) Next *edit: sorry, not a GDI line - but it seemed like it would do the job Edited November 18, 2010 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted November 18, 2010 Author Share Posted November 18, 2010 "create a window, create the drawing area from HWND, then draw the line, clear, and redraw."Sorry I couldnt resist.My apologies Mr One (sorry couldnt resist) I had an exam in 10 mins and I wanted to cram a bit more.Ive updated the post. ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted November 18, 2010 Author Share Posted November 18, 2010 (edited) Another easy one =) $hBarGUI=GUICreate("",@DesktopWidth,20,0,0,0x80000000,0x08000080) GUISetBkColor(0xFF,$hBarGUI) WinSetTrans($hBarGUI,'',0) WinSetState($hBarGUI,'',@SW_SHOWNOACTIVATE) WinMove($hBarGUI,'',0,-19) WinSetTrans($hBarGUI,'',100) For $i=-18 To @DesktopHeight Step 5 WinMove($hBarGUI,'',0,$i) Sleep(10) Next *edit: sorry, not a GDI line - but it seemed like it would do the job I dont understand; You dont write it in GDI. Are you saying I should just do $hBarGUI=GUICreate("",@DesktopWidth,20,0,0,0x80000000,0x08000080) GUISetBkColor(0xFF,$hBarGUI) WinSetTrans($hBarGUI,'',0) WinSetState($hBarGUI,'',@SW_SHOWNOACTIVATE) WinMove($hBarGUI,'',0,-19) WinSetTrans($hBarGUI,'',100) and that will make all objects in the window operate with transperancy around them? Also what are those GUI styles? Edited November 18, 2010 by hyperzap ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
Ascend4nt Posted November 18, 2010 Share Posted November 18, 2010 Well it was my bad for not realizing you wanted to do it with GDI. You can certainly go that route - but you'll need to save the background and possibly just use it as a full-screen GUI image to draw your GDI lines on.. its just much more easier to simulate 'hovering' boxes, circles, lines and whatnot using these simple 'popup' style windows. Here's the styles for that GUI: ; Basic: WS_POPUP (0x80000000), Extended: WS_EX_NOACTIVATE 0x08000000 + WS_EX_TOOLWINDOW (0x80) The rest of the code is just working with the GUI background and transparency. No GUI controls are needed. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted November 18, 2010 Author Share Posted November 18, 2010 Well it was my bad for not realizing you wanted to do it with GDI. You can certainly go that route - but you'll need to save the background and possibly just use it as a full-screen GUI image to draw your GDI lines on.. its just much more easier to simulate 'hovering' boxes, circles, lines and whatnot using these simple 'popup' style windows. Here's the styles for that GUI: ; Basic: WS_POPUP (0x80000000), Extended: WS_EX_NOACTIVATE 0x08000000 + WS_EX_TOOLWINDOW (0x80) The rest of the code is just working with the GUI background and transparency. No GUI controls are needed. Hmm. Even with your GUI styles, Its still not transparent. Heres my code. It just make it not have the title bar, but how do you make the whitespace transparent to show the window behind?" expandcollapse popup#include <GuiConstantsEx.au3> #include <GDIPlus.au3> ;Opt('MustDeclareVars', 1) HotKeySet( "q", "it") $val = 0 _Main() Func _Main() Local $hGUI, $hGraphic, $hPen ; Create GUI $hGUI = GUICreate("GDI+", 400, 300, 0, 100, 0x80000000, 0x08000000 + 0x80);, -1, 0x00CF0000);0x00080000);0x00000020) GUISetState() ; Draw line _GDIPlus_Startup () global $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI) _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) draw( 30) Do draw( $val + Random( -2, 2, 1)) Sleep(10) Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_PenDispose ($hPen) _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_ShutDown () EndFunc ;==>_Main Func draw( $xval) $val = $xval _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF) $calcy = 200-Sqrt( (150*150)-($xval*$xval));-900 So basically, the formula for a circle is radius = x*x + y*y _GDIPlus_GraphicsDrawArc ($hGraphic, 50, 50, 300, 330, -179.9, 180) $hPen = _GDIPlus_PenCreate () _GDIPlus_GraphicsDrawLine ($hGraphic, $xval+200, $calcy, 200, 200, $hPen) EndFunc Func it() $it = InputBox( "Gauge", "enter the value", "") draw( $it) EndFunc ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
JohnOne Posted November 18, 2010 Share Posted November 18, 2010 (edited) Here is a crude and very poor example using winapi udf, is crap but might give you an idea. #include <WindowsConstants.au3> #include <WinAPI.au3> _line() Func _line() Local $hDC, $hPen, $obj_orig, $x1 = 0, $x2 = @DesktopWidth, $y1 = 0, $y2 = 0 $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0x00ff) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) While $y1 < @DesktopHeight _WinAPI_DrawLine($hDC, $x1, $y1, $x2, $y1) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) $y1 += 1 WEnd _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc Edited November 18, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Ascend4nt Posted November 18, 2010 Share Posted November 18, 2010 Hmm.Even with your GUI styles, Its still not transparent.Heres my code. It just make it not have the title bar, but how do you make the whitespace transparent to show the window behind?"...You wanted a horizontal line that moved from the top to the bottom of the screen, I gave you the alternate option to do it without any graphics drawing. You can't then add graphics to it and expect it to work. Try my code as it was posted, and you'll see the effect. Otherwise, just go the harder/slower/flickering route of using line-drawing/erasing. I think JohnOne gave you something that might work. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) 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