run with window on top?
BlitzMax Forums/BlitzMax Programming/run with window on top?
| ||
so I have an app that runs another full screen bmax program. It works great and all but the problem is sometimes the full screen program initially runs underneath the other windows or even underneath the start bar. IS there a way I can assure that the window will be pushed to the top initially. I DONT want to lock the window in the front like the task manager is I just want it to run in front of the other windows so the user can see it when it is run. It actually runs on top on my desktop, but it runs behind the other windows about half the time on my laptop and its really getting annoying. Thanks, also if anyone could link to where you find all of these commands you can call via win32 that would answer many of my future questions because I find myself needing these more and more as I experiment with different things but I cant figure out where yall find these things. Hey, I can write tiny! Last edited 2010 |
| ||
Maybe this code from Koriolis will help: http://www.blitzbasic.com/Community/posts.php?topic=78175#876491 ?Win32 Extern "os" Function win32_LoadLibrary:Int(lpFileName$z) = "LoadLibraryA@4" Function win32_GetProcAddress:Byte Ptr(hModule:Int, lpProcName$z) = "GetProcAddress@8" End Extern ? Function SetAlwaysOnTop(win:TGadget, bState:Int = True) ?Win32 Local hModule:Int = win32_LoadLibrary("user32.dll") If hModule = 0 Then Return EndIf Local SetWindowPos:Int(hWnd:Int, hWndInsertAfter:Int, X:Int, Y:Int, cx:Int, cy:Int, uFlags:Int) "os" = win32_GetProcAddress(hModule, "SetWindowPos") Const HWND_TOPMOST = -1 Const HWND_NOTOPMOST = -2 Const SWP_NOSIZE = $0001 Const SWP_NOMOVE = $0002 'Const SWP_NOZORDER = $0004 'Const SWP_NOREDRAW = $0008 Const SWP_NOACTIVATE = $0010 Local hwnd% = QueryGadget(win, QUERY_HWND) If hwnd <> 0 Then If bState SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE) Else SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE) EndIf EndIf ? End Function I suppose that if you don't permanently want it on top, you can call it once forcing it to the top, and then again turning it off? Last edited 2010 |
| ||
thanks xlsior It works with a maxgui window but I can't figure out how to convert tgraphics to a tgadget. or rather get the tgadget object out of the tgraphics that the graphics command returns. edit: made a new thread for this since its a different issue nevermind Last edited 2010 |