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

Adding your program to open specific .ext

Status
Not open for further replies.

Ante0

Programmer
Apr 19, 2007
98
SE
This has been bugging me for a long time now, but I can't figure out how to do it...
I just made a simple image viewing program, like the one that comes with Windows for previewing images.
So I thought, I'll add .gif to be opened with my prog. But when I click any .gif my program opens, but the picture doesn't get opened.
It works good if you just open from inside the program, just not when associating .ext with it.
What am I doing wrong?
I'm using
Code:
if OpenDialog1.execute then
begin
Image1.Picture.LoadFromFile(Opendialog1.FileName);
end;
Do I need to use something else to make Association enabled for my program?
 
My smart brother, who's 4 years younger than me, told me to use ParamStr... and it works fine..
OnFormShow
Image1.picture.loadfromfile(Paramstr(1));

that's all.
Well, remove this thread or something, I did google alot to find something useful though, but who'd think the answer was so close :)
 
Hmm, one strange thing though.
When I add this to Classes root it should show "Gif viewer" in shell, but it doesn't.

HKEY_CLASSES_ROOT\giffile\shell\Gif Viewer\command
@="D\Programs\GifViewer\GifViewer.exe" "%1"
But doesn't.
I've added other things too, i.e Command Promt.
And that works OK.
Oh well.
I eally wish they had a Edit button here,would save alot of space :)
 
I always use TGifImage when I want to display GIFs. You can find it in google search. It is now part of rhe JVCL as TJvGIFImage. (Unit JvGif.pas) Originally Ander Melander's TGIFImage.

Roo
Delphi Rules!
 
Yea, I'm using GifImage component.
That's what my program is for, to view gifimages without having it open in Photoshop, which wont show any animation :)
So Gif viewer opens a gif image, then animates it, and you can use a slider to set how fast/slow to animate.
But, adding it to shell just won't work...
Might it be cause I use WinXP64?
I managed to add it to shell by using the File Associations from Explorer, but I want to add a procedure in Gif Viewer to add/remove it from shell if the user wants to.
I'm about to install Win xp 32 just to see if that fixes it (and to fix some other things too;) )
 
Ah yes, that helped a bit. It now opens when clicking on Open, but it still won't add 'Gif Viewer' to shell :(
Oh well, I guess that's better than nothing. Thanks for your help :)
 
I don't know if its just how you typed it or whether it's meant to be like that, but you have no colon after D!!!!

Is it meant to read D:\Programs??

Just a passing thought

Hope it helps
 
Ah yes, it was just a typo :)
I'm using a program that I made that copies the fullpath of filename to clipboard. So rightclick -> Copy Filename would be = "C:\Test\Test.exe" or w/e file I clicked.
When I wrote that I was at work, where I don't have this program so I had to type it manually.
Honest typo :)
I still haven't figured why it won't show at shell...
I can add alot of other programs for other fileext's. Like OllyDbg when I rightclick on any .exe/.dll. It's only GIF that doesn't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top