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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening TIFF from delphi 7 1

Status
Not open for further replies.

Jonah86

Programmer
Dec 11, 2003
152
US
I'm using Delphi 7 and I'm trying to make a program that will allow users to search through a large list of arbitrarily named tiffs and then open them in their defaul program.

The searching is no problem, I just don't know how to open the tiff once they've selected it. I can get the name of the tiff from the search, but don't know what command to use to simply open the file in their default windows program.

Thanks for any help!
 
Hi,

this should work (untested) :
include windows unit in your uses list

Code:
ShellExecute(handle, "open", pchar('c:\test.tif', 0, 0, SW_SHOWNORMAL);

--------------------------------------
What You See Is What You Get
 
Hmm, I couldn't get that exact line to work, but I got this from another thread:

ShellExecute(0,'open','C:\test.tif','','',SW_SHOWNORMAL);

but if I use a string in place of the path I get an error about PAnsiChar, and I can't find a way to convert anything to PAnsiChar. The data I'm getting is out of a DBGrid, and even moving it to a text field I can't find a way to convert the data.

Any ideas?
 
Ah ha. I used to "Pchar()" from your example and got just what I wanted. I think I just needed to add a Parentheses to that...my bad.

Thanks again!
 
np man :)

so just for the record :
this should work:

Code:
ShellExecute(handle, pchar('open'), pchar('c:\test.tif', 0, 0, SW_SHOWNORMAL);


--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top