PolledInput with a blank user created window

BlitzMax Forums/BlitzMax Programming/PolledInput with a blank user created window

Damien Sturdy(Posted 2007) [#1]
Hi All,

I need to create a clean window with no graphics context, but it needs to work with PolledInput.. How would I handle this?

In the past I've tried creating a window using the windows API- and then sending win32 message pump messages through to the blitz event system, but polledInput doesnt pick them up? (If this is the way forward, anyone have any working code samples to play with?)

Also, unfortunately, MaxGUI isnt an option here, this needs to work in plain blitzmax with no modules.


skidracer(Posted 2007) [#2]
In the past I've tried creating a window using the windows API- and then sending win32 message pump messages through to the blitz event system,


How exactly, by calling bbSystemEmitOSEvent?


Damien Sturdy(Posted 2007) [#3]
Hi Skid,

Yes I remember you bringing it up before. I no longer have the code used to see what we did but that function was definitely used, and we couldnt fathom out what we were supposed to do to get it working properly. In the end more important things came up and we put this on the "to-do" list, now it's time to tackle this problem again.

Effectively we need a window like blitz creates but without the graphics context. I guess the problem might be that I just don't know how to use bbSystemEmitOSEvent.


skidracer(Posted 2007) [#4]
The following shows a basic example, not sure why the window is not drawing but it is definitely passing on events back to blitz:

Strict

Function ClassWndProc(hwnd,msg,wp,lp) "win32"
	bbSystemEmitOSEvent hwnd,msg,wp,lp,Null
	Return DefWindowProcW( hwnd,msg,wp,lp )
End Function
			
Global _wc:WNDCLASSW
Global ClassAtom
		
_wc=New WNDCLASSW
_wc.style=CS_OWNDC|CS_HREDRAW|CS_VREDRAW
_wc.lpfnWndProc=ClassWndProc
_wc.hInstance=GetModuleHandleW(Null)
_wc.lpszClassName="MyClass".ToWString()
_wc.cbWndExtra=DLGWINDOWEXTRA

ClassAtom=RegisterClassW(_wc)

Local style=WS_VISIBLE|WS_POPUP

Local hwnd=CreateWindowExW(0,"MyClass","My Window",style,0,0,200,200,0,0,GetModuleHandleW(Null),Null)

While WaitEvent()
	DebugLog CurrentEvent.ToString()
Wend



Damien Sturdy(Posted 2007) [#5]
Excelent, thanks Skid!

That seems to work- For the invisible window, it shows when I remove WS_POPUP.

Nice, and I suspect this code will be handy to others in the future too.


[edit]

OK, things got more challenging-
Now we need to tackle the same issue on the Mac (and Linux.)
Any pointers as to tackle that? Skids got the windows code spot on!