May 12, 2024, 02:48:33 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Built-in "WINDOW" type definition

Started by okchoir, June 04, 2009, 02:08:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

okchoir

I am trying to understand the example program, "proportional_scrollbar.eba".  I see this: "WAITUNTIL win.hwnd=0"

Does the built-in type, "WINDOW", have only the one member, "hwnd", as in:

TYPE WINDOW
   DEF hwnd AS UINT
ENDTYPE

Or, is this just confusion?  Can someone explain the use of "win" in some contexts, and the use of "win.hwnd" in other contexts?

Ionic Wind Support Team

Open up your "bin" directory where ebasic is installed and open ebstd.incc in notepad.  Don't modify it though, it is essential to the operation of the compiler.


TYPE WINDOW
DEF hWnd as UINT
DEF hBitmap as UINT
DEF hFont as UINT
DEF hPen as UINT
DEF hClient as UINT
DEF m_pos as POINT
DEF m_iBkMode as INT
DEF m_iROP2 as INT
DEF m_nPenStyle as INT
DEF m_nPenWidth as INT
DEF m_cBack as UINT
DEF m_cWindow as UINT
DEF m_bAutoDraw as INT
DEF m_bTabEnable as UINT
DEF m_hCursor as UINT
DEF m_hBackDC as UINT
DEF m_hCacheDC as UINT
DEF m_nCacheCount as INT
DEF m_bDialog as INT
DEF m_pDlgTemplate as POINTER
DEF m_pIB2DScreen as POINTER
DEF m_pIB2DSurface as POINTER
DEF hProcedure as UINT
DEF m_pBrowser as POINTER
DEF m_hPrintDC as UINT
ENDTYPE


A little more complicated than you thought ;)

the hwnd member is the handle to the OS window, which is returned by the API function CreateWindowEx.   When you use CLOSEWINDOW, it sets the hwnd member to NULL, among a whole bunch of other clean up stuff. 

The  WAITUNTIL win.hwnd=0 is my way of not having to use a global variable, like "run = 0" in the older examples.  You should really use the IsWindowClosed command now though,

WAITUNTIL IsWindowClosed(win)

As for the rest of the members, consider them read-only, they are internal to the operation of the Emergence BASIC created window.  Mucking about with the UDT will cause you no end of headaches and crashes unless you really know what you are doing.

Paul.
Ionic Wind Support Team

okchoir

OK.  Now I understand the use of "win.hwnd" in this example.

I'm wanting to write a window handler, based on the example, "mcidemo", except there is too little information about handling child window messages, expecially since I want up to 16 child windows.  So I'm looking at various examples online and gleaning what is available.

Thanks for the clue about "ebstd.incc".  Seeing the complete UDT helps alot.