How to make TProcess to open any files? lazarus / 13-General ---------------------------------------------------------------------- Satya · 2008-01-29 01:08 Hi, How do you make the TProcess opening any file in Windows by automatically using it's associated file? Just like we do with the ShellExecute call: ShellExecute(handle, 'open', SelectedFile, nil, nil, SW_SHOWNORMAL); The TProcess appears to be working like this only for the executable files. In case of non-executable files, I have to explicitly supply the associated executable for that file type. Something like AProcess.CommandLine := 'C:\Program Files\Windows NT\Accessories\wordpad.exe "' + ReadmeFile + '"'; assuming the readme file in this example is a readme.rtf file. But I want this happening automatically, without I supplying the wordpad.exe file. For example, ShellExecute would open this by using Word or WordPad based on what's associated to .rtf file in end users system. If there is no direct solution, I'll probably find the associated file programmatically and supply it everytime or better stick with the ShellAPI for Windows. Thanks, Satya ---------------------------------------------------------------------- Bart · 2008-01-29 16:47 Us yje old way if you develop for Win only. TProcess is platform independent, and running files by extension is not. Bart ---------------------------------------------------------------------- hy · 2008-02-27 10:39 I think you cann not do it with TProcess but there is another solution: [untested - yet] In Delphi I've looked up the Registry Reg.OpenKeyReadonly('Software\Microsoft\Windows\CurrentVersion\Explore r\FileExts\' + '.' + ext + '\OpenWithProgids') Another possibility is to run cmd.exe [with parameter filename] e.g. Code: [Select] cmd.exe myImage.jpg which should load the associated program.