Trouble with FindExecutable and Excel on NT 4.0

Hi:

I have some code for spawning Excel from my VB3 app.
It runs successfully on dozens of PCs, under all flavors of Windows.

I now have a Windows NT 4.0 user for which the code doesn't fully work.

after setting strFullExcelPathAndName = "C:\CIRCLY4\apsdsxl5.xls"

the API call
r = FindExecutable(strFullExcelPathAndName, "C:\", strEXCELPath)

gives strEXCELPath = "C:\RECYCLED\DC1\EXCEL.EXE"

then:

with strFullExcelCommandLine = "C:\RECYCLED\DC1\EXCEL.EXE  /p C:\CIRCLY4 C:\CIRCLY4\apsdsxl5.xls"

r = WinExec(strFullExcelCommandLine, 2)

returns r=3 (Invalid path error).

My user can double click on a .xls file from File Explorer and Excel starts OK.

Help please?

Regards

Leigh
LVL 1
LeighWardleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
Instead of using FindExecutable and WinExec, simply call ShellExecute.

ShellExecute(hWnd, NULL, strFullExcelPathAndName, NULL, NULL, SW_SHOWNORMAL);

The reason why WinExec fails with that particular command line is likely that there is ambiguity due to long file names. You may also try using CreateProcess with executable name and command line parameters seperately.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.