Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ prog, open a file with a specific program

Status
Not open for further replies.

wootowl

Programmer
Jun 23, 2004
2
US
I'm looking to make a C++ program that accepts command line arguments for a file name, and opens a specific program to view the file.

My files are going to be .jpg, .pdf, and .tiff, so i basically want lets say you have this command line arguments:

program doc.pdf


it will know to open the file with acrobat reader



a few things:

this could probably be done by having the program execute the actual .exe file of the program and supply the file to it (somehow) .. but what if the program is in a different directory? say a user installed acrobat in a different directory .. windows itself knows what file extensions go with what programs .. would it be so hard to make a c++ program do it too (with the programs i specify)?

are there any viewers built in windows that basically any user would have to view .jpg files? i was thinking internet explorer but it always comes up with the full view and the address bar and that wouldnt work .. even supplying IE with the -k command line option doesnt work because you cant close the window .. and i think the windows image viewer is windows XP only



any help in this matter such as any C++ classes or functions that can help me do this .. or .. anything .. would be helpful :) thanks all


 
Open InternetExplorer first as a COM object. After that use method Navigate2 and give the path. You also may change the look of InternetExplorer when using it in a such way.

Ion Filipski
1c.bmp
 
whats a COM object? how do you open IE as one? .. whats navigate2?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top