I have been trying for the last few days to get a system of windows running correctly in PB and Blitz3D.
What I am doing is launching a Blitz3D program which opens a full screen window (no titlebar or toolbar visible) with 3D graphics on it. Then this launches a PB program which opens a small window on top of the Blitz3D window. However, when I close the PB window the toolbar becomes visible over the top of my Blitz3D window. Also if I launch the Blitz3D program from a desktop window, when I close the PB window the desktop window becomes visible over the top of the Blitz3D window.
What I want to have happen is that Blitz windows always stay on top of any desktop windows and PB windows always stay on top of Blitz windows.
Does anyone know how I might stop my desktop windows/toolbar from interfering with the PB\Blitz setup.
I have tried a few methods, like hidden windows and removing the toolbar entry for PB windows, but none seem to work.
Any info would be much appreciated.
pure basic windows running on top of blitz3d
You're not supposed to be able to display windows on top of a full-screen DirectX display as far as I know, but perhaps forcing your window to the front takes away the Blitz window's topmost flags...? Maybe if you re-set it as a topmost window on closing your PB window, it will work correctly? Might have to mess with SetForegroundWindow_, SetActiveWindow_, SetWindowLong_, etc, to get the right result, as I never quite figured out which command does what...
Hi,
take a look on:
http://www.purearea.net/pb/english/userlibs.php
There are a lib calls "AppBar":

take a look on:
http://www.purearea.net/pb/english/userlibs.php
There are a lib calls "AppBar":
I dont tested it, but it seems like a easy way to hold your window on topLibrary for easy creating of your own start bar, similar to the one of MS Office.
-
Codemonger
- Enthusiast

- Posts: 384
- Joined: Sat May 24, 2003 8:02 pm
- Location: Canada
- Contact:
I have managed to get PB windows on top of Blitz3D DirectX screen. Thankyou for your replies and sorry I could not respond sooner. Here's a test which works well. It puts PB windows on top of the Blitz3D teapot example. I know the code isn't very tidy and there's a lot of unneeded code in this but it was only a test to see if this 'windows on blitz3d' feature is possible. I have done this test in view of a larger application I wish to develop that requires windows on a full-screen DirectX surface.
The great thing about this method is that you can open and close any windows in PB without needing to set the blitz3d window to the background every time or anything like that.
The disadvantage is that the windows toolbar appears whenever a PB window is clicked, and then disappears when the blitz3d window is clicked.
Does anyone know a way of preventing the toolbar from appearing??
Anyway, you should get the idea of what I'm trying to get working.
To start with you need a few declarations in Blitz3D. Put the following into a notepad file and save it as 'Blitz3D\userlibs\user32.decls'
Now here is the Pure Basic code:
and here is the Blitz3D code:
Compile both of these to the same directory and put the 'teapot.x' model there. Make sure to compile the PB code as 'PBWin.exe'.
Now run the Blitz code to see it working. Works on Blitz3D v1.85, PB3.80, XP Pro SP1, DirectX 9.
The great thing about this method is that you can open and close any windows in PB without needing to set the blitz3d window to the background every time or anything like that.
The disadvantage is that the windows toolbar appears whenever a PB window is clicked, and then disappears when the blitz3d window is clicked.
Does anyone know a way of preventing the toolbar from appearing??
Anyway, you should get the idea of what I'm trying to get working.
To start with you need a few declarations in Blitz3D. Put the following into a notepad file and save it as 'Blitz3D\userlibs\user32.decls'
Code: Select all
.lib "user32.dll"
User32_GetActiveWindow%():"GetActiveWindow"
User32_SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
User32_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"
User32_MoveWindow% (hwnd%, x%, y%, nWidth%, nHeight%, bRepaint%) : "MoveWindow"
User32_GetWindowRect% (hwnd%, lpRect*) : "GetWindowRect"
User32_GetClientRect% (hwnd%, lpRect*) : "GetClientRect"
User32_ClientToScreen% (hwnd%, lpwndpl*): "ClientToScreen"
User32_ScreenToClient% (hwnd%, lpwndpl*): "ScreenToClient"
User32_GetCursorPos%( lpwndpl* ):"GetCursorPos"
User32_LockSetForegroundWindow( x% ):"LockSetForegroundWindow"
User32_SetForegroundWindow( hwnd% ):"SetForegroundWindow"
User32_SetActiveWindow( hwnd% ):"SetActiveWindow"
Code: Select all
If ReadFile(1,"BlitzWndwHndl.txt")<>0
a.l=ReadLong()
OpenWindow(10,100,100,50,50,#PB_Window_SystemMenu |#PB_Window_TitleBar,"Not needed",a.l)
OpenWindow(11,125,125,50,50,#PB_Window_SystemMenu | #PB_Window_TitleBar,"Not needed",a.l)
CloseFile(1)
time.l=0
Repeat
EventID.l = WindowEvent()
If EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
CloseWindow(EventWindowID())
Quit = Quit + 1
EndIf
Delay(1)
Until Quit = 2
EndIf
End
Code: Select all
Const LSFW_LOCK = 1
Const LSFW_UNLOCK = 2
; Set Window Long
Const GWL_STYLE =(-16)
Const GWL_EXSTYLE =(-20)
; Window Style
Const WS_VISIBLE =$10000000
Const WS_SYSMENU =$80000
Const WS_DISABLED =$8000000
Const WS_EX_TOPMOST =$00000008
Const WS_EX_NOACTIVATE =$08000000
Const WS_EX_TOOLWINDOW =$00000080
Const WS_EX_NOINHERITLAYOUT =$00100000
Type win
Field hWindow
Field WindowStyle
Field WindowExStyle
End Type
;
; This function initializes the actual blitz window
Function InitBlitzWindow()
Graphics3D 1280,1024,0,3
win\hWindow = User32_GetActiveWindow()
win\WindowStyle = WS_VISIBLE
win\WindowExStyle = WS_EX_NOACTIVATE
User32_SetWindowLong(win\hWindow,GWL_STYLE,win\WindowStyle)
User32_SetWindowLong(win\hWindow,GWL_EXSTYLE,win\WindowExStyle)
; Resize and center Blitz Window
User32_MoveWindow(win\hWindow,0,0,1280,1024,True)
If FileType("BlitzWndwHndl.txt")=1
DeleteFile("BlitzWndwHndl.txt")
EndIf
fileout=WriteFile("BlitzWndwHndl.txt")
WriteInt(fileout,win\hWindow)
CloseFile(fileout)
End Function
User32_LockSetForegroundWindow(LSFW_LOCK)
; Example
Global win.win = New win
InitBlitzWindow()
SetBuffer BackBuffer()
Global info1$="Teapot demo"
Global info2$="Features spherical reflection mapping"
ExecFile("PBWin.exe")
SetBuffer BackBuffer()
teapot=LoadMesh( "teapot.x" )
tex=LoadTexture( "spheremap.bmp",64+1 )
EntityTexture teapot,tex
EntityFX teapot,3
camera=CreateCamera()
PositionEntity camera,0,0,-3
While Not KeyHit(1)
TurnEntity teapot,.5,.7,1.1
UpdateWorld
RenderWorld
Flip
Delay(1000/85) ;85 should be the current monitor refresh rate
Wend
End
Now run the Blitz code to see it working. Works on Blitz3D v1.85, PB3.80, XP Pro SP1, DirectX 9.



