black out background at any rez

Blitz3D Forums/Blitz3D Programming/black out background at any rez

Greetings all:
I am finishing up a project, developed at 800x600 16 bit, Windowed, using F-UI to do some of the graphics window stuff. The client now wants a black background, like director or powerpoint does, where regardless of the graphics settings/rez of the user machine, the app will appear centered on screen, in an 800x600 window, surrounded by black, effectively blocking all the stuff on the desktop or open apps, windows, etc. The application also has buttons that call external files, like pdfs and wmvs, which play on top of blitz when the come up.
I don't know how to do this in a way that will be compatible with a wide variety of graphics cards, etc.
Any ideas would be greatly appreciated.
thanks

You probably need to use some win api calls using a userlib, like the SetWindowPos thingy that allows not only to set the position, but also to make it always-on-top etc. There are several win api references in the web, like:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowpos.asp

(jfk got there before me but nevermind.)

There are ways (painful), but does your client not realise that any user will be able to Alt-Tab another window on top?

I've tried this for a previous employer and it was nightmare.

You would have to use a user lib to create your black borderless window, then set your Blitz window as 'topmost' over that.

You need a seriously outlined spec covering all eventualities agreed with the client before you begin this.
Or else it'll be 'Oh, it does this.' and 'It doesn't do that.' - Yeah been there before.

I had this to hand and it was easy to modify to do some of what you require, so...
;---------------------------------------------------------------------------------
; User32.decls
;==============
;
;.lib "user32.dll"
;
;FindWindow%( class$,Text$ ):"FindWindowA"
;GetWindowLong%(hwnd%, nIndex%) : "GetWindowLongA"
;GetSystemMetrics%(nIndex%) : "GetSystemMetrics"
;MoveWindow%(hwnd%, x%, y%, nWidth%, nHeight%, bRepaint%) : "MoveWindow"
;SetWindowLong%(hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
;ShowWindow%(hwnd%, nCmdShow%) : "ShowWindow"
;
;---------------------------------------------------------------------------------

Const title$ = "blitzapp"

Const SM_CXSCREEN		= 0
Const SM_CYSCREEN		= 1
Const SM_CXVSCROLL		= 2
Const SM_CYHSCROLL		= 3
Const SM_CYCAPTION		= 4
Const SM_CXBORDER		= 5
Const SM_CYBORDER		= 6
Const SM_CXDLGFRAME		= 7
Const SM_CYDLGFRAME		= 8
Const SM_CYVTHUMB		= 9
Const SM_CXHTHUMB		= 10
Const SM_CXICON			= 11
Const SM_CYICON			= 12
Const SM_CXCURSOR		= 13
Const SM_CYCURSOR		= 14
Const SM_CYMENU			= 15
Const SM_CXFULLSCREEN	= 16
Const SM_CYFULLSCREEN	= 17
Const SM_CYKANJIWINDOW	= 18
Const SM_MOUSEPRESENT	= 19
Const SM_CYVSCROLL		= 20
Const SM_CXHSCROLL		= 21
Const SM_DEBUG			= 22
Const SM_SWAPBUTTON		= 23
Const SM_RESERVED1		= 24
Const SM_RESERVED2		= 25
Const SM_RESERVED3		= 26
Const SM_RESERVED4		= 27
Const SM_CXMIN			= 28
Const SM_CYMIN			= 29
Const SM_CXSIZE			= 30
Const SM_CYSIZE			= 31
Const SM_CXFRAME		= 32
Const SM_CYFRAME		= 33
Const SM_CXMINTRACK		= 34
Const SM_CYMINTRACK		= 35
Const SM_CXDOUBLECLK	= 36
Const SM_CYDOUBLECLK	= 37
Const SM_CXICONSPACING	= 38
Const SM_CYICONSPACING	= 39
Const SM_MENUDROPALIGNMENT=40
Const SM_PENWINDOWS		= 41
Const SM_DBCSENABLED	= 42
Const SM_CMOUSEBUTTONS	= 43
Const SM_CMETRICS		= 44
Const SM_CXSIZEFRAME	= SM_CXFRAME
Const SM_CYSIZEFRAME	= SM_CYFRAME
Const SM_CXFIXEDFRAME	= SM_CXDLGFRAME
Const SM_CYFIXEDFRAME	= SM_CYDLGFRAME

Const GWL_STYLE		= -16
Const GWL_EXSTYLE	= -20

Const WS_OVERLAPPED 	= $0
Const WS_POPUP			= $80000000
Const WS_CHILD			= $40000000
Const WS_MINIMIZE		= $20000000
Const WS_VISIBLE		= $10000000
Const WS_DISABLED		= $8000000
Const WS_CLIPSIBLINGS	= $4000000
Const WS_CLIPCHILDREN	= $2000000
Const WS_MAXIMIZE		= $1000000
Const WS_CAPTION		= $C00000
Const WS_BORDER			= $800000
Const WS_DLGFRAME		= $400000
Const WS_VSCROLL		= $200000
Const WS_HSCROLL		= $100000
Const WS_SYSMENU		= $80000
Const WS_THICKFRAME		= $40000
Const WS_GROUP			= $20000
Const WS_TABSTOP		= $10000
Const WS_MINIMIZEBOX	= $20000
Const WS_MAXIMIZEBOX	= $10000

Const WS_TILED 				= WS_OVERLAPPED
Const WS_ICONIC 			= WS_MINIMIZE
Const WS_SIZEBOX 			= WS_THICKFRAME
Const WS_OVERLAPPEDWINDOW 	= (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
Const WS_TILEDWINDOW 		= WS_OVERLAPPEDWINDOW
Const WS_POPUPWINDOW 		= (WS_POPUP Or WS_BORDER Or WS_SYSMENU)
Const WS_CHILDWINDOW 		= WS_CHILD

Const WS_EX_DLGMODALFRAME 	= $1
Const WS_EX_NOPARENTNOTIFY	= $4
Const WS_EX_TOPMOST			= $8
Const WS_EX_ACCEPTFILES		= $10
Const WS_EX_TRANSPARENT		= $20

Const SW_HIDE			= 0
Const SW_SHOWNORMAL		= 1
Const SW_NORMAL			= 1
Const SW_SHOWMINIMIZED	= 2
Const SW_SHOWMAXIMIZED	= 3
Const SW_MAXIMIZE		= 3
Const SW_SHOWNOACTIVATE	= 4
Const SW_SHOW			= 5
Const SW_MINIMIZE		= 6
Const SW_SHOWMINNOACTIVE= 7
Const SW_SHOWNA			= 8
Const SW_RESTORE		= 9
Const SW_SHOWDEFAULT	= 10
Const SW_MAX			= 10

Const SWP_NOSIZE		= $1
Const SWP_NOMOVE		= $2
Const SWP_NOZORDER		= $4
Const SWP_NOREDRAW		= $8
Const SWP_NOACTIVATE	= $10
Const SWP_FRAMECHANGED	= $20
Const SWP_SHOWWINDOW	= $40
Const SWP_HIDEWINDOW	= $80
Const SWP_NOCOPYBITS	= $100
Const SWP_NOOWNERZORDER	= $200
Const SWP_DRAWFRAME		= SWP_FRAMECHANGED
Const SWP_NOREPOSITION	= SWP_NOOWNERZORDER

window_w = GetSystemMetrics(SM_CXSCREEN) ;640
window_h = GetSystemMetrics(SM_CYSCREEN) ;480

Graphics3D window_w, window_h, 0, 2

AppTitle title$

; Find this window
blitz_hnd = FindWindow("Blitz Runtime Class", title$)


; Set the windows style flags
SetWindowLong(blitz_hnd, GWL_STYLE, WS_VISIBLE)

; Centre window on desktop
MoveWindow(blitz_hnd, (GetSystemMetrics(SM_CXSCREEN) - window_w) / 2, (GetSystemMetrics(SM_CYSCREEN) - window_h) / 2, window_w, window_h, 1)

; --------------------------------------------------- test code ---------------------------------------------

Viewport (window_w - 800) / 2, (window_h - 600) / 2, 800, 600
Origin (window_w - 800) / 2, (window_h - 600) / 2

cam = CreateCamera()
PositionEntity cam, 0, 0, -5
CameraClsColor cam, 0, 0, 100

cube = CreateCube()
EntityColor cube, 200, 200, 0

Repeat
	TurnEntity cube, 1, 1.5, 2
	
	RenderWorld
	
	Rect 0, 0, 800, 600, 0
	
	Flip
Until GetKey()

End


Thanks TwoEyedPete, you've also answer my question in the other thread about getting rid of the Titlebar:
Viewport and Origin eh?

Dena? You ok now?

Well, I don't known yet if I am ok, do these solutions mean I have to reposition all 2d and 3d coordinates, buttons, mouseovers, etc.....Let me give TwoEyedPete's example above a look, and I will get back to you. Boy John, I do appreciate your advice regarding client stuff, as we are at the end of this project, and I told project manager that this was not going to happen early on, but it appears he did not share that with the client, and now, when we are 95% done, the client comes back with this....

TwoEyedPete, I uncommented and saved the lines at the top between the ;-----------------------------------------'s as User32.decls into my userlibs folder, and saved the rest and tried to compile...no workie, I am very very tired and not thinking too clearly; what do I need to do to run this thing, Please?

Ignore the last post, I am an idiot, I got it to run, no problem. So, what about calling an external file using ExecFile (filename1$), it will be in the background, right?

dena, my condolences.
I still don't know how you would handle this situation without foaming at the mouth.

I once had a Japanese client 'who will be at your shoulder for two weeks while you program' - Ahh!!!
Can you imagine???

I guess I'm old enough now (53) that if it ever happened again I'd throw my weight around and refuse.
(You get to do that when you're older.)

As it was, the company folded and I started my own (just me). Wonder if there was a connection?