Second or third instance of MFC app wont run - LoadMenu returns NULL

I have an app where LoadFrame fails when I start about 3 or more
instances of
it. It fails in the InitInstance function of the app when calling
pMainFrame->LoadFrame(IDR_MAINFRAME))

The actual point of failure is a call to ::LoadMenu in
CFrameWnd::Create() that returns NULL. GetLastError() returns 0, so no
help there.

I am using VC++ 6 on Windows XP. It's an MFC app with quite a lot of
document templates. It seems to be related to the document templates.
If I reduce the
the number of calls to AddDocTemplate, then I can open more instances
of my program.

Why should this be a problem? Is there some maximum limit on the
number of menu handles or something? Is there a way of solving this?

Thanks
Bruce
0
b.chapman (3)
1/28/2005 5:19:30 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
482 Views

Similar Articles

[PageSpeed] 1

Hi,
It sounds as if you need to change the design of your application. How many 
templates are you using? 

Do you have any success if you increase the desktop heap?
http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b126962

Also, look at the gdiobj exe from http://www.fengyuan.com/download.html
What are your figures like from that?

Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for 
newsgroup purposes only

This posting is provided "AS IS" with no warranties, and confers no rights. 
OR if you wish to include a script sample in your post please add "Use of 
included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm" 


0
andmort (67)
1/31/2005 12:02:03 PM
We have 29 templates. I can see that there might be a way to combine
some of these into a smaller number of more generic types, but why?
What are the restrictions?

Thanks for the tips about the desktop heap and gdiobj. I will be trying
them out over the next few days.

Bruce



Andy Mortimer [MS] wrote:
> Hi,
> It sounds as if you need to change the design of your application.
How many
> templates are you using?
>
> Do you have any success if you increase the desktop heap?
> http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b126962
>
> Also, look at the gdiobj exe from
http://www.fengyuan.com/download.html
> What are your figures like from that?
>
> Andy Mortimer [MS]
> Please do not send email directly to this alias. This alias is for
> newsgroup purposes only
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> OR if you wish to include a script sample in your post please add
"Use of
> included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm"

0
b.chapman (3)
2/1/2005 4:59:15 PM
Yes there are limitations, and chances are you are hitting one of them. The 
investigative steps I have already outlined should help determine the 
problem. We don't usually advise you create that many templates.


Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for 
newsgroup purposes only

This posting is provided "AS IS" with no warranties, and confers no rights. 
OR if you wish to include a script sample in your post please add "Use of 
included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm" 


0
andmort (67)
2/4/2005 11:55:07 AM
Reply:

Similar Artilces:

Run Unix shell script from VB.NET
I have the need to run couple Unix shell scripts (in IBM AIX box) from a VB.NET windows app. Please help! Thanks a million. Bill Bill, With Process start you can start everything as long as it is reachable and you have the rights. http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx Success, Cor "Bill N" <billn@jaco.com> wrote in message news:OmUi#MZ4KHA.3844@TK2MSFTNGP05.phx.gbl... > I have the need to run couple Unix shell scripts (in IBM AIX box) from a > VB.NET windows app. > Please help! > > Than...

Script in customer report not running on user's machine
Hello, I am using GP for the first time, and I just got into the report writer about 30 minutes ago, so I apologize in advance if this is a newbie question. We have a custom report. There is a script in the Window_AfterActivate event sets these options: Printer.Value = 0 Screen.Value = 1 File.Value = 1 FileName.Value = "c:\temp\test.txt" FileFormat.Value = 1 IfFileExisting.Value = 1 This works on my machine, but it does not work on the user's machine. Is there some sort of runtime I need to install on her machine to make this work? There could be...

Create an instance of new Customized entity by Workflow
I created an entity named E1 under Account entity(Many-to-1 relationship with Account) then I want to create a workflow Rule that after creating an Account an instance of E1 entity is created automatically. It seems Activity creation is possible in workflow automatically! Is any soloution for this issiue? -- Mohsen Ahmadi you can create activities but not custom entities. You would need to either do this by using a callout or by creating a workflow .net assembly that can create the custom entity for you. ======================= John O'Donnell Microsoft CRM MVP http://codegallery.g...

Question regarding Exchange 5.5 and 2003 running at the same time
I recently upgraded my domain from NT 4.0 to 2003 in mix mode. I still have a few BDCs and Exchange 5.5 running with no problems. To prepare for Exchange 2003 install I ran forest prep, domain prep and ADC connector. Can I install Exchange 2003 with Exchange 5.5 running at the same time. What downtime should I expect? What could go wrong?? If anyone has any insight or comments feel free to pass it on. DC There are a bunch of documents and good books available on that subject. Search on the microsoft site for keywords "5.5 migrate 2003" I followed the instructions carefully,...

How to spwan(in MFC)?
how to spwan??? Hello, WinExec() system() ShellExecute[Ex]() CreateProcess() Regards, Elias http://www.codeproject.com/system/newbiespawn.asp -- Regards, Nish [VC++ MVP] "�Ϲο�" <fuerza@kebi.com> wrote in message news:bh79mv$m1n$1@news1.kornet.net... > how to spwan??? > > ...

how to organize several class and their instance in windows programming
Hi, everyone, I'm designing a project which could do some image processing, motion control and networking using MFC. nowadays I'm puzzled how to organize so many class and their instances. Though I think the "design pattern" could solve my problem, but what I only want is to get a simple method or a belief understand. suppose these class are like this: CImageProc (class deal with image processing) CMotionControl (class deal with motion control) CNetwork (class deal with networking) CXXXClass (class doing other work) This is the way I use, in the CMainFrame( I'm...

Run Time Error '1004' Application or Onject-defined
Hi all. I am having a strange problem with the below code in that it produces the run time error when trying to Paste the Selection. However, if I perform the action manually in exactly the same way, as in recording the macro in the first place, it works!? How can I get this to run - it is after all, a really simple code. (Most frustrating) Thanks, Wes. Windows("Transaction_Record.xlsm").Activate Sheets("DETAILED_PMNTS_REC").Select Range("N2077:QV2089").Select Application.CutCopyMode = False Selection.Copy Windows("AUDIT_TR...

Multiple Outlook 2003 instances launched
I'm running Outlook 2003 on my home machine to access my Verizon email account. It does not matter how I launch Outlook, from the Start Menu, from a Desktop shortcut, or from the Launch Bar, I always get multiple instances of Outlook running. Does anyone know what is going on here and how I can prevent the multiple launch? TIA Jim Outlook will only display one instance under normal circumstances. Did you perhaps in a previous session elect to open other folders in a new window? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Al...

outlook running on XP Pro in workgroup mode prompts for password on exchange 2003
we have a windows 2000 network with exchange 2000 local user are members of the domain, remote offices connect via Lan to Lan VPN with 5 or more computers running in workgroup mode. The users in the workgroup have local accounts on there XP pc that match the domain username/password. Currently they local to the exchange server with any issues. Outlook passes there username/password to the exchange server and logs then on. I have added a windows 2003 server and promoted it to a backup ADS server, added another windows 2003 server as a member server. Installed Exchange 2003 SP2. Move all the lo...

Help.. Please! Outlook 2003 using 100% CPU every few seconds.. run out of ideas!
Hi anyone with an idea! I have a 1.2 Ghz/800Meg PC with Outlook 2003 running on it. I said teh first bit to show that its not on a small system. Outlook 2K3 is behaving really badly. its installed on XP SP1 with all the most up to date patches. Every 5 or 6 seconds Outlook simply locks the CPU at 100%. Watching this in Task manager is like watching a square wave. Regular as closckwork, and its Outlook.exe thats peaking at 100% CPU usage every few seconds. I use a pop3 acount so no exchange issues here, and I am not using business contact manager This locks outlook and makes it almost ...

tenths of a second ... #2
How (if possible) can I handle time values down to tenths of a second in Excel2000? For example, how can I get the value of "11:00:00,00" ? Format/Cells/Number/Custom hh:mm:ss,00 In article <291301c49b19$75ff2680$a301280a@phx.gbl>, "mcano" <anonymous@discussions.microsoft.com> wrote: > How (if possible) can I handle time values down to tenths > of a second in Excel2000? For example, how can I get the > value of "11:00:00,00" ? ...

Running a .bat file with spaces in the path.
I am trying to run a .bat file from a macro. The shell command works okay most of the time - but I cannot seem to make it work if there is a space in the path. (So, running C:\Apps\BFIle.bat works, but not C:\My Apps\BFile.bat) As the .bat file I want to run will change, I want to enter the path in a cell, and then run the macro with a button. This means simply enteing the path in double quotation marks in the Shell command will not work. BFile = Range("A2").Value i = Shell (BFile, 1) Any ideas? Odd that a space is giving you a problem. This works for me whether the path has a ...

adding hours and minutes ignoring seconds
I have a column of cells which displays the results of a formula i hours and minutes (no seconds). For instance A1 shows 3:04 and A2 show 0:18. When I sum these two cells I get 3.23 instead of 3:22. Excel seem to be counting the seconds too, which results in the additional minut being added. How can I make excel add only the hours and minutes without th seconds? Thanks - cmiller@keithandschnars.co -- cb ----------------------------------------------------------------------- cbm's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2824 View this thread: http://www.ex...

Return to Column A #2
There was a post almost a month ago on this subject. The question posed was a good one though the answers returned didn't really answer the need. It's easy to move to the right on enter but how do you move to the next row and first column if you are at the end of the first row. Yes one can hit down arrow/home or Home/down arrow but this is a little annoying. If a sheet is protected and cells are locked, isn't there an easier way to do this more elegantly? Thanks in advance for your thoughts, Greg Say you start with A1 selected. Type something in A1 and hit the Tab key...

Alt S wont send anymore
I can't be dreaming - installed outlook 2003 about 2 weeks ago. After creating a message, I was able to just hit alt S and the message would be sent. Now, I have to hit enter after alt S. What changed? Any ideas? thanks, larry ...

getting rid of the standard mfc icon (in taskbar)
i made an application based on mfc, and used the standard mfc icon up until now. i thought changing it would be a simple task. in the resource editor i got rid of all mfc icons in various resolutions, and replaced it with my own icon in 3 different resolutions. it does work in almost all the places: the main window is shown with the correct icon, the taskbar shows correctly with the icon, even MessageBox() shows the icon now, but as soon as i do open a MessageBox while my main-window is shown, the counter in taskbar moves up to two (you know how windows xp groups together tasks with th...

Portable app and mfc42u.dll
I am writing an application that is to run from a USB. It links dynamically with mfc42u.dll and I cant be sure it will be available on every system. So, I plan on including a copy of mfc42u.dll in the same directory as the app. Is this the way to proceed? Will this cause any conflict, problem, or whatever dll-hellish situation? I think this is ok. The dll is special and not on every system, so you should release a copy of it in the app directory. That's what I do with dlls to be used, too. Regards "Alexander" <the44secs@yahoo.com> schrieb im Newsbeitrag news:1172037426.1...

Finding Desktop region in MFC
I am working on a commercial application, and recently discovered a bug I have been asked to fix (they threw it back in my lap). Run the application on a 2-monitor system, such as a laptop in a dock with an external monitor. Drag the main window to the second (non-taskbar) window and quit. Now move the laptop to a different dock with the second menu on the other side (or without a second monitor at all) and launch the app. Oops. The app continues to want to go on the side it was last put, even though there is now no monitor there. (Yes, my dock in the office and at home have the second ...

CAsyncSocket()::OnReceive() will not be fired !!! -> MFC BUG ?!?
Hello peoples i have wrotten a FTP-Client with a own Class of CAsyncSocket. Sometime the messagge from the Server will NOT BE reveiced, but the server have ben sendet to the Client ( the OnReceive() of the Client is not called !!) I use MSVS6.0 OR can´t use the CAsyncSocket for a FTP-Client ? ( the CInternetConnetion can´t use, why i need ALL sended and received data for displaying regard Nico van Halobar Nico van Halobard wrote: > Hello peoples, > > i have wrotten a FTP-Client with a own Class of CAsyncSocket. Sometime the messagge from the Server will NOT BE revei...

Initial Account Sync with Fifth Third Bancorp
Program: Microsoft Money 2007 Deluxe OS: XP Bank: Fifth Third Bancorp I just purchased and installed the software. I added a credit card account (Chase), which synced fine on the first try. I then added my banking information (checking and savings). That account is with Fifth Third Bancorp. I have tried several times to sync and it always gives me the following error: Microsoft Money could not receive information from your bank or brokerage. Please set up this account again. if the problem continues contact customer support. Money was unable to complete the opreation. The Internet, bank...

Multiple Instances of Manager Program
Greetings I have a situation where it might become necessary to have multiple people running the SO Manager program at the same time. Doing edits and changes primarily. Has anyone run up against any performance/stability issues under such circumstances. Does this cause any instability problems with the POS frontend also operating at the same time? The reason I mention this is that we did some experimentation with having an MS Access forms app try and edit some data in the Customer table and it would cause the frontend to crash if we were operating on the same record. We we...

(Advance Programming) Parameter Returned as Value
Hi, I wish some body could Help Me, I have being loocking for a solution for 2 days. I need to make a simple Query to check if the parameter values are in a Table. I want the Query to return "Founds" and "Not Founds". For Example: Table Definition: TName CREATE TABLE [dbo].[TName] ( [IdName] [bigint] IDENTITY (0, 1) NOT NULL , [Name] [nvarchar] (30) COLLATE Traditional_Spanish_CI_AS NOT NULL ) ON [PRIMARY] Values: Insert Into TName (Name) Values ('Paul') Insert Into TName (Name) Values ('Peter') Insert Into TName (Name) Valu...

Enter key will no longer return to begining of next row
From one worksheet to the next, the enter key will only activate the cell directly below the current cell. What Have I done to change the direction? Have checked the direction selection in Options and as suggested by MS Help made sure the Down was selected. Doesn't change a thing. Help! Sandy look in Tools | Options | and on the Edit tab check what's in "Move selection after Enter" Regards Trevor "Sandy" <anonymous@discussions.microsoft.com> wrote in message news:212b01c3e06b$ac7afe50$a401280a@phx.gbl... > From one worksheet to the next, the ent...

Public Function not running
Hey, I have a public function that I call from a cell. The function is: Public Function QuitTime(strQuitTime As String) As Date Dim strHour, strMin As String Dim intHour, intMin As Integer Dim dtTime As Date strHour = Left(strQuitTime, 2) strMin = Right(strQuitTime, 2) dtTime = strHour & ":" & strMin dtTime = dtTime + Range("MainSheet!B2") ' this cell contains the value today() QuitTime = dtTime End Function Anyway, I run a vlookup on this array from another sheet and when ever i run that vlookup, it makes all the cells in th...

running external program, waiting for completion
I'm trying to start an external utility from a C++ program, but I'm having some problems I've tried various approaches, but all seem to suffer from the same problem: I can start the utility but if I try to wait for it to exit, then I'll wait forever (& the utility never seems to start running). One example: SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = _T("open"); ShExecInfo.lpFile = "c:\\xxx\\yyy\\zzz.exe"; ShExecInfo.lpPar...