|
Post by dazzab73 on Aug 23, 2007 9:18:26 GMT -5
Hi all, I only came across Brutus2d a few days ago and purchased it straight away. So, first of all I just want to say hello. I have started writing a simple example game which is an updated version of a sliding block puzzle game I wrote for the original Blitz2d CD. I am running my game in windowed mode. I noticed while running from within the editor that after clicking on the X close button, the editor thought my game was still running. So, I wanted to disable the close button. After looking at the windows API, I found a few API functions which does just that. In case somebody may find it useful, here is the code. It basically removed the close option from the system menu. In doing so, it also disables the close button. sub DisableCloseButton Const MF_BYPOSITION = &H400& Const MF_REMOVE = &H1000& dim hSysMenu, nCnt handle = system.GethWnd() hSysMenu = dll.callapi("user32", "GetSystemMenu", system.GethWnd(), False) if hSysMenu then nCnt = dll.CallAPI("user32", "GetMenuItemCount", hSysMenu) if nCnt then dll.callAPI "user32", "RemoveMenu", hSysMenu, nCnt -1, MF_BYPOSITION or MF_REMOVE dll.callAPI "user32", "RemoveMenu", hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE dll.callAPI "user32", "DrawMenuBar", system.GethWnd() end if end if end sub
Cheers. Daz.
|
|
|
Post by matthew on Aug 23, 2007 10:11:53 GMT -5
Hi Daz, welcome to the Forum. Thank's for the Code it looks interesting and could come in useful.
|
|
|
Post by hartnell on Sept 3, 2007 11:18:42 GMT -5
dazzab73, this is one of my main issues with B2d. I really don't see why pressing window x should do ANYTHING except close the game. --hartnell
|
|
|
Post by u9 on Sept 3, 2007 17:36:17 GMT -5
Ah.. it took me a while to get your point hartnell, but i gather you mean that the program should terminate if one presses the x? I kinda agree, but this function is excellent though. I haven't tried it, but if it works as i hope, i'm probably gonna use it in the future. It will help a lot with the problem where one thinks the game terminated, but actually there is a loop somewhere where it gets stuck, or one forgets to read key.press( windowx ) at some point. I always end up having several processes laying around after a b2d session hehe...
|
|
|
Post by hartnell on Sept 4, 2007 16:15:32 GMT -5
It's just annoying. I'm used to it as it's the single biggest wart B2D has. However, my concern is for the noob that can't figure out why his game doesn't run after he's run it once. At that point he thinks "screw this" and goes and downloads Game Maker.
If guilect is willing, I think we should begin to talk about a solution. --hartnell
|
|