Game Development Community

Minimise Main Window?

by Gavin Doherty · in Torque Game Engine · 03/21/2006 (1:05 pm) · 7 replies

Is it possible to minimise the game's window in TGE?

The problem I am having is that I am trying to print a document from within my game. I am using a call to the windows api's ShellExecuteEx to print a html file. The problem is that the print properties dialog appears hidden behind the TGE window. And said dialog doesn't appear in the taskbar. So it appears to the user as if nothing has happened. So what I would like to do is have the window minimise until the user clicks on it on the task bar. (The user will have seen the print dialog at this stage).

#1
03/21/2006 (1:33 pm)
Correct me if im wrong.
but this dialog needs the handle to the parent window to modal the application.
#2
03/21/2006 (1:39 pm)
Badguy; I'm not sure what you mean.

The code I am using to print the file is:

SHELLEXECUTEINFO ShExecInfo;

ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = NULL;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = L"print";
ShExecInfo.lpFile = L"print.htm";
ShExecInfo.lpParameters = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_MAXIMIZE;
ShExecInfo.hInstApp = NULL;

ShellExecuteEx(&ShExecInfo);
#3
03/21/2006 (1:58 pm)
Ok, so I've added a minimise button to the Torque window, so I now know that it is capable of being minimised. Now I just need to figure out how to do this programatically.....any help?
#4
03/21/2006 (1:59 pm)
Try replacing SW_MAXIMIZE with SW_SHOWNORMAL ?

edit - this would be in an attempt to get the Print window to show up on top of the torque window.

if you really want to minimize torque,
you'll be wanting to call Platform::minimizeWindow(), i'll wager.
#5
03/21/2006 (2:03 pm)
Gavin:
ShExecInfo.hwnd = NULL;
this is your problem.
if you pass the hwnd of the torque app this dialog will be on top of torque .
which is what you want.
#6
03/21/2006 (2:14 pm)
Badguy: i think you're right.
i read this at MSDN:
"hwnd Window handle to any message boxes that the system may produce while executing this function.",

and i think what it should really say is:
"hwnd Window handle passed to any message boxes that the system may produce while executing this function."

@Gavin - i'd still use SW_SHOWNORMAL tho.
#7
03/21/2006 (3:33 pm)
Ok.
I've changed to SW_SHOWNORMAL and I've set ShExecInfo.hwnd = winState.appWindow
Unfortunately the behaviour is still the same. However Platform::minimizeWindow() worked perfectly. Thanks very much to both of you for your help!