Maximising a SDI application at startup

I'm guessing this is a really easy question. I want my application to
be maximised when it is executed. At present in the PreCreateWindow(),
i'm setting cs.cx and cs.cy to appropriately large values. However, I'm
sure there must be a better way.

0
Hamish.Dean (174)
6/18/2006 6:06:07 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
426 Views

Similar Articles

[PageSpeed] 48

What's wrong with setting cx and cy in PrecreateWindow ?

Anyway, this works

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
   RECT	screen;

   SystemParametersInfo ( SPI_GETWORKAREA, 0, & screen, 0 );

   cs.cx = screen.right;
   cs.cy = screen.bottom;
   cs.y  = screen.top;
   cs.x  = screen.left;

   return CFrameWnd::PreCreateWindow(cs);
}

hamishd wrote:
> I'm guessing this is a really easy question. I want my application to
> be maximised when it is executed. At present in the PreCreateWindow(),
> i'm setting cs.cx and cs.cy to appropriately large values. However, I'm
> sure there must be a better way.
> 
0
6/18/2006 5:54:15 PM
>I'm guessing this is a really easy question. I want my application to
>be maximised when it is executed.

In your application's InitInstance, set the m_nCmdShow member,
something like this:

BOOL CTestAppApp::InitInstance()
{
	 ...
	m_nCmdShow = SW_SHOWMAXIMIZED;

	// Parse command line for standard shell commands, DDE, file
open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	return TRUE;
}

Dave
0
davidl7375 (2060)
6/18/2006 8:40:46 PM
David Lowndes wrote:
> >I'm guessing this is a really easy question. I want my application to
> >be maximised when it is executed.
>
> In your application's InitInstance, set the m_nCmdShow member,
> something like this:
>
> BOOL CTestAppApp::InitInstance()
> {
> 	 ...
> 	m_nCmdShow = SW_SHOWMAXIMIZED;
>
> 	// Parse command line for standard shell commands, DDE, file
> open
> 	CCommandLineInfo cmdInfo;
> 	ParseCommandLine(cmdInfo);
>
> 	// Dispatch commands specified on the command line
> 	if (!ProcessShellCommand(cmdInfo))
> 		return FALSE;
>
> 	return TRUE;
> }
> 
> Dave

Brilliant. Exactly what I wanted, cheers.

0
Hamish.Dean (174)
6/19/2006 4:34:04 AM
Reply:

Similar Artilces:

Outlook 2000 freezes on startup in Windows 98
When loading Outlook 2000 in Windows 98, it never gets past the splash screen. Ctrl alt del shows that it doesn't say the program is not responding (doesn't say "(Not Responding)" next to it in task list). It has worked on the computer before with that OS and software and abruptly stopped. There is no error message, it just stays at the splash screen. Any ideas? Thanks. You may have a corrupted outcmd.dat file. This is the file that stores your toolbar customizations, and when it becomes corrupted, Outlook can't use it at startup to build your toolbars, thus causi...

FD_ISSET not returning the read fdset when socket breaks in WinCE application
Hi, I have an voip application that uses winsock2. In PC when i do FD_ISSET for readFds , it returns the read fdset when the socket connection fails(network cable unplugged) and hence when i try to do a read operation on the returned set, i get an error.Thus enabling me to detect the socket failure in PC. However the same application when run in WinCE device, using the same Winsock2, does not behave the way mentioned above. I am unable to detect the socket failure in the WinCE device. Why is it that the same winsock api behave differently in PC and WinCE based device though the winsock2 ...

view email maximised
I've just upgraded to OE v6. When I double-click on an email to read it, the window returned is too small to be useful. How do I get maximised windows automatically when reading emails ? Cheers. ...

How to get the stack trace when application crashes ?
Hi, I have set a function to catch the exception when system crashes using the API SetUnhandledExceptionFilter. I used AfxDumpStack(AFX_STACK_DUMP_TARGET_DEFAULT) inside the exception handler function but didnot get the stack trace as shown by Dr.Watson. In Dr.Watson, i see funtion address, i want to know what is the funtion name. I am finding difficult to manage the PDB and corresponding binary, so thought of writing the stack trace in the exception handler which the Dr.Watson write when the crash occur. How to get the stack trace when the application has crashed similay to what the Dr.Wat...

WM_COPYDATA between two applications
Hello, I'm running VC++ 2005. I have two program and want to exchange some data, a string, between them. In the sender program I have this function: BOOL CFSGClientDlg::SendCommand(CString command) { COPYDATASTRUCT cds; LRESULT rc; TCHAR *buf; buf = new TCHAR[MAX_COPY_LENGTH]; memset(buf,'\0',MAX_COPY_LENGTH); _tcscpy_s(buf,MAX_COPY_LENGTH,sOrderno.GetBuffer()); sOrderno.ReleaseBuffer(); cds.dwData = 0; cds.cbData = sOrderno.GetLength()+1; cds.lpData = (void*)buf; rc = m_pSCMLaserCWnd->SendMessage(WM_COPYDATA, (WPARAM)AfxGetApp()->m_pMainWnd->GetSafeHwn...

Server Error in '/MobileAdmin' Application #2
I cannot remote wipe a device. I browse to http://localhost/MobileAdmin Then it brings up the web page and I type in the user mailbox. I click on wipe and it gives me this error The remote server returned an error: (404) Not Found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (404) Not Found. Source Error: An unhandled exception was generated during...

maximise
Has anyone seen it where you'll open an excel document that someone sends you, but instead of the document opening excel opens. So I have to save the attachment first then go into excel and go file open. Help!!!!!!!!!!!!!!!! Try Tools / Options / General / Uncheck 'Ignore Other Applications' -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 00/02/03 ---------------------------------------------------------------------------- It's easier to beg forgiveness than ask permission :-) ---------------------...

Run a particular application with admin privilege
Hi, How can I make sure that a limited user account can start a particular application with admin prievelege without providing any admin username and password? Around ten users, who have limited account, need to run application for their job but if the application is not run with admin privielege then it does not let the user to benefit from all available options. I don't want to elevate their account to power user or administrator and don't want to provide them with admininstarot password either. Any idea how to resolve this isssue? thanks. JohnSmith1 wrote...

CFormView SDI problem
I have three forms that are necessary for user input. How do I switch from one form to another in my SDI CFormView project? BTW there is no splitter involved. Thank you. Mark wrote: > I have three forms that are necessary for user input. How do I switch > from one form to another in my SDI CFormView project? BTW there is no > splitter involved. > > Thank you. > > The code to do this is rather unobvious. Try searching MSDN for VSWAP32 or "swap view" or "switch view" and a few examples should appear. -- Scott McPhillips [VC++ MVP] "Sco...

Application not found
im trying to open the pictures attached to my email using microsoft outlook 2003 but when i try to open it i have this error application not found. do i have to check some configuration in it? tnks. 3cky Patrick <rppmercedes@aim.com> wrote: > im trying to open the pictures attached to my email using microsoft > outlook 2003 but when i try to open it i have this error application > not found. > do i have to check some configuration in it? This sounds like either you don't have an applciation that is designed to handle the attachment file type or there's no ...

Detect if an application is running full-screen
Hi, I've found on the net a piece of code that detects if another application is running full-screen. I've tested it, but, as it is designed to compare the foreground window and the monitor rectangles, it returns TRUE also if the foreground window is the desktop. I've tried to compare the HWND returned by GetForegroundWindow() to GetDesktopWindow(), but it doesn't work. Can someone help me? Thanks very much This is the code: BOOL IsUserPlayingFullscreen() { HWND hwnd = GetForegroundWindow(); RECT rcWindow; GetWindowRect(hwnd,&rcWindow); HMONITOR hm = MonitorFromR...

Calling exe from MFC application and storing out in buffer for further processing.
Dear All, I m developing a application in which i need to call a exe whose results/output, i wanna store in buffer for further processing. Please give me the solution fo doing that. Thanx in advance. regards, dinesh spawn, createprocess, system, winexec, etc. "Dinesh" <dinesh@netplexusindia.com> wrote in message news:%23TgbQQFLEHA.3332@TK2MSFTNGP10.phx.gbl... > Dear All, > I m developing a application in which i need to call a exe whose > results/output, i wanna store in buffer for further processing. Please give > me the solution fo doing that. > Thanx in a...

voip application
Hi all, Is there any voip application that is available for ARM platform and windows ce 6.0? I had tried the microsoft provided demo application, but we need some other application that has dial up etc with good GUI. Please help on this. So, there's nothing wrong with the Microsoft demo, but you want "a few other things"? Think we might need to know what those are to make a recommendation? Paul T. "San" wrote: > Hi all, > Is there any voip application that is available for ARM platform and windows > ce 6.0? I had tried the microsoft provid...

Money 2006 startup delayed
whenever I start my money 2006 program, the program accesses something on the internet which slows down the program functions for several minutes. I also can not download any bank updates until this access completes (several minutes). Is there a way to setup money so it does not access the internet upon starting?? I do not have any bank files I synchronize with MSN Money In microsoft.public.money, Don wrote: >whenever I start my money 2006 program, the program accesses something on >the internet which slows down the program functions for several minutes. I >also can not...

Converting a dialog box application into a dll
I have a dialog box mfc application and I would like to convert it into a regular or extended mfc dll. Is it possible and how? Regards Galia I forgot to indicate that that I have the original source of the dialog box. The enviroment is VC 6.0. Regards Galia "Galia" <galia@mandi.com> wrote in message news:#4VCCF5GIHA.4112@TK2MSFTNGP05.phx.gbl... > I have a dialog box mfc application and I would like to convert it into a > regular or extended mfc dll. > > Is it possible and how? > > Regards > > Galia > > Applications have a lot of "bagg...

Deadlock with Single Threaded Application
I am using MS Visual C++ 6.0 (Professional edition) on Win XP 5.1 SP 2. I am developing a Windows application that calls vanilla C/C++ classes. I have gone to Project:Settings:C/C++:Code Generation and selected Debug Single-Threaded under Use Run-Time Library Despite the fact that I use exactly the same code every time, the program sometimes runs through to completeion w/o any problems and sometimes hangs in random places. Both of these outcomes occurs both when I am doing other work on the PC and when I leave the PC with a single application running. I know that it is hanging when it is...

Problem quitting excel when it is used by ASP.NET application
Hi I have a question about quitting excel.exe when it is used by browser to display the excel file from within asp.net application. Currently, my company is using aspose excel object which opens a session of excel within internet explorer session to display the excel file to the user. The object can open the file either within the browser, or it can actually open an excel session on the user's workstation. If browser is used, when user clicks on Back button after reviewing the file, Excel.exe remains running in the process tab in Task Manager. This then prevents the user from utilizing a...

Application-defined or object-defined error
I need help with this error. I get the error on line "ws.Range("E7").Value = mondaysDate(Weekday(Date)) - 7" The function run fine, its just that the erroe comes up when control is returned to the subroutine. And I don't know what the problem is. Any help will be appreciated. Thanks. Private Sub Workbook_Open() Dim ws As Worksheet Const PWORD As String = "Ayo" Application.ScreenUpdating = False If Me.Name = "Northeast AAV Project Outlook_ver2.xls" Then If Weekday(Date) = 2 Then For Each ws In Worksheets ...

how to lower application priority
Hello, I created a win2k service application. It is a little app that writes to 2 files every 30secs. But this thing is taking up 98% of cpu. How do I lower the cpu priority of appliations? Ray d_phi_rc@yahoo.ca "Raymond Choy" <raymond_choy@mrcsi.com> wrote in message news:erFp17moDHA.3256@tk2msftngp13.phx.gbl... > Hello, > > I created a win2k service application. It is a little app that writes to 2 > files every 30secs. But this thing is taking up 98% of cpu. How do I lower > the cpu priority of appliations? Are you sitting there in a loop waiting ...

Maximising mainframe window maximises modelss child windows!
Environment : Windows 2000 , VC++ 6.0 (SP5) , MFC Hello, In my MDI application, a modeless dialog box gets displayed on selecting a particular menu item. The parent of the modeless dialog box is the Mainframe Window. Now in this modeless dialog, a particular action should minimize the models dialog and show the application in a special state and a different cursor, he can exit from this state only after selecting the required parameters, till then the dialog needs to be in the minimized form. This is being achieved by calling the ShowWindow(SW_MINIMIZE); function of the modeless dialog for ...

How can I identify a web application given its guid?
I am investigating a warning in the 12 hive log files. I am trying to figure out what specific part of SharePoint is having the issue. The application appears to be: 02/24/2010 02:00:52.26 OWSTIMER.EXE (0x093C) 0x098C SharePoint Portal Server Business Data 7pls Monitorable Importing usage data for Web Application a5f6e661-8c06-4b4f-96c4-c280017425a3. I'm trying to figure out how to go backwards from that GUID to the specific application that is running. I'm not certain where to find what the GUID represents. Does anyone have a g...

Making Excel look like one application
Just got a new computer at work. Excel used to appear to be one application at the bottom of the screen - Now each spreadsheet appears to be a seperate application and it clutters up the bottom of the screen. Do I have the option to change this back to the old view? Thanks - DT Hi David Tools>Options On the View tab change Windows in Taskbar -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "David Thompson" <dbthom@solutia.com> wrote in message news:1c7f01c3882c$1306fef0$a401280a@phx.gbl... > Just got a new computer at work. > Excel us...

multithreaded dialog application
My application is a dialog app, with one parent dialog with spawns several (up to 20 or so) child dialogs. There are basically three channels of input to the dialogs: user actions and messages that come in on two seperate threads via socket connections. At this point, all the socket messages are posted to the main thread to be processed. Nearly all the socket messages are simply passed on to a child dialog (or 3 or 4 in some instances) to be processed. The number of messages received from the sockets can be quite large and since they come in on two seperate threads, I think it would be more...

MFC in SDK Application
Is it possible to use MFC classes in SDK Application. If it is. Let Somebody tell me how to do that. Thanks. Thank You. I will see the file. "Frank Hickman" <fhickman_nosp@m_noblesoft.com> wrote in message news:5bCdnRBIE9c-wC6iRVn-sw@comcast.com... > Hi, > > Take a look at the attached project, it shows how to initialize MFC in a > standard "old" style Windows Program. > > HTH > -- > ============ > Frank Hickman > NobleSoft, Inc. > ============ > Replace the _nosp@m_ with @ to reply. > > > "Me" <x@x.x> ...

Profit maximising allocations
Hi all First post here so PLEASE HELP a new boy I have a project to complete. I need to find the best allocation of planes to maximise profit There are 6 routes & 6 types of plane (3 Boeing, 2 DCs, 1 Airbus) Can Excel automatically calcualte the best allocation? Each flight has fixed and variable crew costs & variable fuel costs Thank you to anyone who can help me Mark -- mark_b2410 ------------------------------------------------------------------------ mark_b2410's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=16848 View this thread: http://ww...