Jump to content

Newbie with GUI


jimg
 Share

Recommended Posts

I have a simple little window that contains some RSS feed information. It works fine, except whenever the window get buried under another window, it gets "erased" and doesn't refresh when it's re-exposed. I know I'm missing some key concept here...

I eventually need to re-execute the script every hour, but first things first.

#include <GuiConstantsEx.au3>

#include <GDIPlus.au3>

; Create GUI

$hGUI = GUICreate("Buoys", 200, 205)

$hWnd = WinGetHandle("Buoys")

GUISetState(@SW_SHOW)

_GDIPlus_Startup ()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)

_GDIPlus_GraphicsDrawLine ($hGraphic, 100, 5, 100, 200)

$hPen = _GDIPlus_PenCreate (0xff000000,3,2)

_GDIPlus_GraphicsDrawString($hGraphic, " Pt St George", 5, 5)

_GDIPlus_GraphicsDrawString($hGraphic, " Port Orford", 105, 5)

_GDIPlus_GraphicsDrawEllipse ($hGraphic, 110, 55, 80, 80, $hPen)

_GDIPlus_GraphicsDrawEllipse ($hGraphic, 10, 55, 80, 80, $hPen)

; Loop until user exits

Do

Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources

_GDIPlus_PenDispose ($hPen)

_GDIPlus_GraphicsDispose ($hGraphic)

_GDIPlus_Shutdown ()

Link to comment
Share on other sites

Could require some tweaking:

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

; Create GUI
$hGUI = GUICreate("Buoys", 200, 205)
$hWnd = WinGetHandle("Buoys")
GUISetState(@SW_SHOW)
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
_GDIPlus_GraphicsDrawLine ($hGraphic, 100, 5, 100, 200)
$hPen = _GDIPlus_PenCreate (0xff000000,3,2)
_GDIPlus_GraphicsDrawString($hGraphic, " Pt St George", 5, 5)
_GDIPlus_GraphicsDrawString($hGraphic, " Port Orford", 105, 5)
_GDIPlus_GraphicsDrawEllipse ($hGraphic, 110, 55, 80, 80, $hPen)
_GDIPlus_GraphicsDrawEllipse ($hGraphic, 10, 55, 80, 80, $hPen)
GUIRegisterMsg($WM_PAINT, "Paint")
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

Func Paint()
    _GDIPlus_GraphicsDrawLine ($hGraphic, 100, 5, 100, 200)
    _GDIPlus_GraphicsDrawString($hGraphic, " Pt St George", 5, 5)
_GDIPlus_GraphicsDrawString($hGraphic, " Port Orford", 105, 5)
_GDIPlus_GraphicsDrawEllipse ($hGraphic, 110, 55, 80, 80, $hPen)
_GDIPlus_GraphicsDrawEllipse ($hGraphic, 10, 55, 80, 80, $hPen)
endFunc
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...