Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've recently updated our PCs to run Windows 7 32-bit from Windows XP. The code I had used in the past has stopped working and I was wondering what I could do to get it working again.

C++
FileStr.Format("Microsoft Excel - %s  [Read-Only]", pathStr);
HWND hWnd= ::FindWindow(NULL,FileStr);
if (hWnd == NULL)
	ShellExecute(NULL, "open", pseMULTI.m_tProductionTaskfBriefPath, NULL, NULL, SW_SHOWNORMAL);


Obviously Windows have changed the way it window names, and I appreciate that the way I had been doing it was a complete fudge.

Any help appreciated.

Thanks.
Posted
Updated 7-Feb-13 23:26pm
v2
Comments
Matthew Faithfull 8-Feb-13 5:30am    
You might have more luck going the COM route, using the Running Object Table to find instances of the root Excel Application Object. You'd need it's ClassId which is public and some IROT client code. I've never actually done it although I've several times thought I would need to and then found an easier way. Maybe that's an indication that you will too.
Richard MacCutchan 8-Feb-13 5:34am    
Try opening the file manually with Excel, and check the string you are using is valid. If it still fails then use your debugger to step through your code and see exactly what is happening.

Check for the windows version and do it the "Windows 7" way.

Use Spy++ to detect the right name of the excel-doc
 
Share this answer
 
Hi You must check Process in Task manager by VC++ and use for statement. use GetmoduleFilename and GetModuleHandle.
 
Share this answer
 

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