11.07.2015 Views

QP and Win32 - Quantum Leaps

QP and Win32 - Quantum Leaps

QP and Win32 - Quantum Leaps

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Application Note:<strong>QP</strong>/QM <strong>and</strong> <strong>Win32</strong> (Windows)state-machine.com/win323.4 The win32_gui.h Header FileThe win32_gui.h header file specifies the interface for GUI programming, which includes creating themain custom dialog box for the front panel as well as various useful facilities for owner-drawn buttons,graphical displays, segment displays, <strong>and</strong> LEDs.#ifndef win32_gui_h#define win32_gui_hListing 5: win32_gui.h header file.#define WIN32_LEAN_AND_MEAN(1) #include /* <strong>Win32</strong> API *//* create the custom dialog hosting the embedded front panel ................*/(2) HWND CreateCustDialog(HINSTANCE hInst, int iDlg, HWND hParent,WNDPROC lpfnWndProc, LPCTSTR lpWndClass);/* OwnerDrawnButton "class" ................................................*/(3) typedef struct OwnerDrawnButtonTag {HBITMAP hBitmapUp;HBITMAP hBitmapDown;HCURSOR hCursor;} OwnerDrawnButton;enum OwnerDrawnButtonAction {BTN_NOACTION,BTN_PAINTED,BTN_DEPRESSED,BTN_RELEASED};void OwnerDrawnButton_init(OwnerDrawnButton * const me,HBITMAP hBitmapUp, HBITMAP hBitmapDwn,HCURSOR hCursor);void OwnerDrawnButton_xtor(OwnerDrawnButton * const me);enum OwnerDrawnButtonAction OwnerDrawnButton_draw(OwnerDrawnButton * const me,LPDRAWITEMSTRUCT lpdis);/* GraphicDisplay class for drawing graphic displays with up to 24-bit color*/(4) typedef struct GraphicDisplay Tag {UINT width;UINT xScale;UINT height;UINT yScale;HBITMAP hBitmap;HWND hItem;BYTE *bits;BYTE bgColor[3];} GraphicDisplay;void GraphicDisplay_init( GraphicDisplay * const me,UINT width, UINT xScale,UINT height, UINT yScale,Copyright © <strong>Quantum</strong> <strong>Leaps</strong>, LLC. All Rights Reserved.19 of 42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!