Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I've got an MFC project that was originally developed under VC++6, and it used to set up file associations perfectly under XP.

Now with the same program converted to VS2005 and running under Windows 7, it is exhibiting strange behaviour: when you double-click on a file, nothing happens for a while then a message box comes up saying "There was a problem sending a command to the program." The program eventually starts up, but it doesn't load the file. If I then double-click on a file, the running program loads it correctly.

I've created a new C++ MDI project with VS2005, and checked that my program adds the same Registry entries, and they are correct, and I've run out of ideas as to where the problem lies.

Any suggestions as to why double-clicking doesn't load the file into my program would be gratefully received!


You may not be passing the correct arguments to the program... do a search in the registry to see if the default command line arguments are correct. Also, you can probably do a mini-dump of the initialization data in your executable to see why it's failing (send debug information to file).

Good luck! :)
Share this answer
hairy_hats 16-Dec-11 9:38am    
The default command line arguments are the same in both cases, so I don't think it's that. I'll try to dump the parameters - thanks for the suggestion!
hairy_hats 16-Dec-11 10:57am    
OK, so the problem is that the DDE Open command isn't being received following the first double-click, but it is with the second. Does that help narrow it down?
Albert Holguin 16-Dec-11 14:38pm    
Not sure what you mean by dde open command... when you double click on a file, the file open stuff is passed via the command arguments (I think, I haven't looked at this in a bit).
hairy_hats 16-Dec-11 17:25pm    
The run command argument can be /dde, in which case the program starts and waits for a DDE open command to load the file, instead of passing the filename. This is one easy way you can load multiple files into one MDI. I think the problem I have encountered could be due to my InitInstance taking too long to load, and the OS claiming there is a problem, when really the program is just not ready to accept the DDE command. I am going to try to restructure the code on Monday to see if that helps.
No idea which specific thing fixed it - I've moved code around in InitInstance(), which I think was the solution.
Share this answer
Chuck O'Toole 19-Dec-11 13:04pm    
Generically, if a program takes a long time to start up the first time and then starts up faster the 2nd thru nth time, the reason is probably loading DLLs or assemblies into memory. The first time, the cost of doing this is high, subsequent loads probably get the DLL / assembly from cache (disk cache or memory cache). So, unless you are really sure of what fixed your problem, you may just be seeing that it loads faster this time but the underlying problem may still be around.
hairy_hats 19-Dec-11 16:47pm    
I've spent 3 solid days trying to find out what was causing it! What was very slow was verifying and reloading the docked bar status. Without them it is much quicker-it was nothing to do with DLLs loading as it was slow every time. Anyway, it is working now so I will keep testing it.
Albert Holguin 19-Dec-11 15:34pm    
I'm with Chuck on this one... you should try to figure out what was the cause... could save you some grief later on.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900