Window close button
BlitzMax Forums/BlitzMax Beginners Area/Window close button
| ||
When creating a window with the "CreateGraphics" command you get a window with a close button on the top right side. Is it possible to create a window without that button, and if so, how? |
| ||
I think that with the standard MaxGUI commands this is not possibile: the only solution maybe is using the QueryGadget() or some other hack (neither I can use...) |
| ||
Zawran, If you are using MaxGUI then it is possible to create windows w/o the close button. See my tutorial on CreateWindow Othewise as degac pointed out you will need to do some hacking. There's a working example by Kev on this thread http://www.blitzmax.com/Community/posts.php?topic=50175 |
| ||
Hei assari I read your tutorial and they are great! But where are you write how obtaing window WITHOUT close-gadget? I would like to know 'a clear & standard' way to do it too. |
| ||
I couldn't find it either, and the examples in that thread you linked to, none of them could run in bmax v1.14. They all fail with errors. I am sure that the windows api would have to be used, but I am not that familiar with it to know what to look for. |
| ||
My apologies guys, I thought you meant Minimize, now I know you mean CLOSE (duh!) Try this. Stop with the IDE stop button. Don't know how safe this is though :) hwnd=CreateWindowExA(0,ClassName(),"Hello World".ToCString(),WS_CAPTION|WS_VISIBLE, .. 0,100,640,480,0,0,GetModuleHandleA(Null),Null) While Not KeyDown(KEY_ESCAPE) Wend End Function ClassWndProc(hwnd,msg,wp,lp) "win32" Return DefWindowProcA( hwnd,msg,wp,lp ) End Function Function ClassName:Byte Ptr() Global _name:Byte Ptr Global _wc:WNDCLASS Global _icon If _name=Null _name="BLITZMAX_WINDOW_CLASS".toCString() _icon=LoadIconA(GetModuleHandleA(Null),Byte Ptr(101)) _wc=New WNDCLASS _wc.style=CS_OWNDC|CS_HREDRAW|CS_VREDRAW _wc.lpfnWndProc=ClassWndProc _wc.hInstance=GetModuleHandleA(Null) _wc.hIcon=_icon _wc.hCursor=LoadCursorA( 0,Byte Ptr( IDC_ARROW ) ) _wc.hbrBackground=COLOR_BTNFACE+1 _wc.lpszMenuName=Null _wc.lpszClassName=_name RegisterClassA(_wc) EndIf Return _name End Function I pinched the 2 functions from skidracer's axe module. BlitzMax CreateGraphics function uses WS_CAPTION|WS_VISIBLE|WS_SYSMENU style. If you're game, you can modify the d3d7graphics.bmx source and remove the WS_SYSMENU from Function CreateHWND |
| ||
Thanks, I'll give it a try. Happy New Year. :) |
| ||
thanks. Happy new year... |
| ||
The following code works for me as far as disabling the close button. It won't remove it, but it dims it and the window won't be closed if clicking on it.Extern "win32" Function GetSystemMenu%(hWnd%, bRevert%) Function GetMenuItemCount%(hwnd%) Function RemoveMenu%(hMenu%, uPosition%, uFlags% ) Function DrawMenuBar%( hMenu% ) End Extern Const MF_BYPOSITION:Int = $400 const MF_DISABLED:int = $2 Local hndThisWindow:Int = GetActiveWindow() Local hndMenu:Int = GetSystemMenu( hndThisWindow, 0 ) Local cnt:Int = GetMenuItemCount(hndMenu) RemoveMenu(hndMenu, cnt-1, MF_DISABLED | MF_BYPOSITION ) DrawMenuBar( hndThisWindow) The last five lines are called after creating the window. |