Quote: "In fullscreen mode only directx is rendered into the screen.Therefor,Windows GUI components will not work until minimized or resized."
Yes, mostly true. But, if you run the gui components as "their own thing" meaning they aren't necessarily children of the darkbasic window, you can get away with using some of them.
This code adds a Windows status bar at the bottom of a DBC window in fullscreen mode. Without it being in Window mode, you'll notice the mouse passes behind the status bar:
rem win32 api Status Window example
rem by Latch
rem dec 11 2008
`set window on
`maximize window
set display mode 800,600,16
cls 255
sync on
sync rate 0
rem load dll
user32=1
comctl32=2
load dll "user32.dll",user32
load dll "comctl32.dll",comctl32
rem get main window handle
hwnd=call dll(user32,"GetActiveWindow")
WS_CHILD = 1073741824
WS_VISIBLE = 268435456
WS_POPUP = 2147483648
CCS_TOP = 1
SB_SETPARTS = 1024 + 4
SB_SETTEXT = 1024 + 1
rem make status window
call dll comctl32,"InitCommonControls"
stext$="Dark BASIC Status Window Text"
statushwnd=call dll(comctl32,"CreateStatusWindowA",WS_CHILD|WS_VISIBLE|WS_POPUP,stext$,hwnd,1)
rem add 5 boxes
make memblock 1,5*4
write memblock dword 1,0,text width(stext$)
write memblock dword 1,4,400
write memblock dword 1,8,500
write memblock dword 1,12,600
rem the last box I want to extend to the edge so I have to write -1
rem only way to do that with a DBC memblock is to write a float or
rem 4 bytes
write memblock byte 1,16,255
write memblock byte 1,17,255
write memblock byte 1,18,255
write memblock byte 1,19,255
memptr=get memblock ptr(1)
call dll user32,"SendMessageA",statushwnd,SB_SETPARTS,5,memptr
rem put different text in the boxes
a$="Box 2"
b$="box 3"
c$="box 4"
d$="box 5"
call dll user32,"SendMessageA",statushwnd,SB_SETTEXT,1,a$
call dll user32,"SendMessageA",statushwnd,SB_SETTEXT,2,b$
call dll user32,"SendMessageA",statushwnd,SB_SETTEXT,3,c$
call dll user32,"SendMessageA",statushwnd,SB_SETTEXT,4,d$
rem move focus from status window to main window
call dll user32,"SetFocus",hwnd
make object cube 1,25
do
a$="THE TIME IS "+get time$()
call dll user32,"SendMessageA",statushwnd,SB_SETTEXT,1,a$
turn object left 1,.1
text 0,0,str$(screen fps())
sync
loop
DBC is able to talk to the status bar because we have the window handle (memory pointer) to it so we can use a Windows API function to make a call to that handle.
Now similarly, we can access the common dialogs (like choose color, or choose font, or file select) if we get the right handles, create the right memory pointers for the structures that the dialogs need , and so forth. But if we are in fullscreen mode, we won't be able to easily control these dialogs with the mouse. We can't see it! DBC fullscreen mode has changed the pointer to a Direct x sprite or something. But you should still be able to control the dialogs with the arrow keys, the tab key and ESC and ENTER. You could try controlling it with the mouse, but you won't know where you are pointing or clicking until you see something change.
Here's a font dialog. In full screen mode, use the tab key to move between fields. Use the arrow keys to highlight the selection. Press Enter to accept ALL of the changes, or ESC to leave the dialog box.
rem choosefont winapi function
rem by latch
rem 07/03/2008
`set window on
user32=1
comdlg32=2
load dll "user32.dll",user32
load dll "comdlg32.dll",comdlg32
hwnd=call dll(user32,"GetActiveWindow")
mem1=1
mem2=2
mem3=3
print font_dialog(comdlg32,mem1,mem2,mem3,hwnd)
end
function font_dialog(comdlg32,mem1,mem2,mem3,hwnd)
rem mem1 = choosefont structure
rem mem2 = logfont structure
rem mem3 = style buffer
rem logfont info
make memblock mem2,255
logptr=get memblock ptr(mem2)
rem style pointer string
make memblock mem3,32
styleptr=get memblock ptr(mem3)
rem choosefont positions
lStructSize = 0
poshwnd = 4
hdc = 8
lpLogFont = 12
iPointSize = 16
Flags = 20
rgbColors = 24
lCustData = 28
lpfnHook = 32
lpTemplateName = 36
hInstance = 40
lpszStyle = 44
nFontType = 48
MA = 50
nSizeMin = 52
nSizeMax = 56
rem choosefont structure
make memblock mem1,60
memsize=get memblock size(mem1)
chooseptr=get memblock ptr(mem1)
CF_SCALABLEONLY = 131072
CF_SCREENFONTS = 1
CF_INITTOLOGFONTSTRUCT = 64
rem populate choose font structure
write memblock dword mem1,lStructSize,memsize
write memblock dword mem1,poshwnd,hwnd
write memblock dword mem1,lpLogFont,logptr
write memblock dword mem1,Flags,CF_SCREENFONTS
write memblock dword mem1,lpszStyle,styleptr
rem call the choosefont functions
call dll comdlg32,"ChooseFontA",chooseptr
temp$=""
for n=28 to get memblock size(mem2)-1
if memblock byte(mem2,n)=0 then exit
temp$=temp$+chr$(memblock byte(mem2,n))
next n
rem cleanup
delete memblock mem1
delete memblock mem2
delete memblock mem3
endfunction temp$
Enjoy your day.