Older Version Newer Version

Zack_Z_ Zack_Z_ Jan 2, 2008

Here's some code to create a fake (but functioning) window.

[[code]]
 'Create a fake window
 nomainwin
 WindowWidth = 335
 WindowHeight = 260
 UpperLeftX=int((DisplayWidth-WindowWidth)/2)
 UpperLeftY=int((DisplayHeight-WindowHeight)/2)
 graphicbox #main.titlebar, -5, -5, 2000, 25
 stylebits #main, _WS_THICKFRAME,0,0,0 'or if you dont want your window to be resizable put _WS_DLGFRAME
 open "Window" for window_popup as #main
 hwnd = hwnd(#main)
 print #main, "trapclose [quit]"
 TitleCaption$ = "Custom Window -->Right Click Here<--"
 TitleBarBackColor$="darkgreen"'Can be any colour lb alows.
 TitleBarForeColor$="white"'Can be any colour lb alows.
 CallDLL #user32, "SetWindowTextA", hwnd As ulong, TitleCaption$ As ptr, ret As void
 print #main.titlebar, "down; fill ";TitleBarBackColor$;";color ";TitleBarForeColor$
 print #main.titlebar, "backcolor ";TitleBarBackColor$;";place 10 18;|";TitleCaption$
 print #main.titlebar, "flush"
 print #main.titlebar,"color white;place ";WindowWidth-20;" 5;backcolor red;boxfilled ";WindowWidth-3;" 23;place ";WindowWidth-16;" 19;|X"
 print #main.titlebar, "flush Exit"
 print #main.titlebar, "when leftButtonMove [move]"
 print #main.titlebar, "when rightButtonUp [rightclick]"
 print #main.titlebar, "when leftButtonDouble [double]"
 print #main.titlebar, "when leftButtonUp [check]"
 print #main, "resizehandler [resize]"
 wait
[move]
 r = 0
 calldll #user32, "ReleaseCapture", r as void
 calldll #user32, "SendMessageA",hwnd as ulong,161 as long,2 as long, r as long
 wait
[rightclick]
 popupmenu " Restore",[restore],"_ Minimize",[minimize],"[_] Maximize",[maximize],|,"X Close Alt-F4",[quit]
 wait
[restore]
 Flag = 0
 CallDLL #user32, "ShowWindow",hwnd As ulong, 9 As Long, ret As long
 wait
[minimize]
 Flag = 1
 CallDLL #user32, "ShowWindow",hwnd As ulong, 6 As Long, ret As long
 wait
[maximize]
 Flag = 2
 CallDLL #user32, "ShowWindow",hwnd As ulong, 3 As Long, ret As long
 wait
[double]
 select Flag
 case 0:goto [maximize]
 case 1,2:goto [restore]
 end select
 wait
[check]
 if MouseX >(WindowWidth-21) and MouseX<(WindowWidth-1) and MouseY>5 and MouseY<22 then goto [quit]
 wait
[resize]
 if lastw=WindowWidth and lasth=WindowHeight then wait
 print #main.titlebar,"delsegment Exit;redraw;color white;place ";WindowWidth-14;" 5;backcolor red;boxfilled ";WindowWidth+3;" 23;place ";WindowWidth-10;" 19;|X"
 print #main.titlebar,"flush Exit"
 lastw=WindowWidth
 lasth=WindowHeight
 wait
[quit]
 close #main
 end
[[code]]