Hi does anyone know how to open a jpeg using shellexecuteA set for "edit".
I can do this but the only problem is that it opens the jpg with the generic
windows "Paint" program when I want to edit with "Gimp" I have jpg file options set for opening with "windows picture and fax viewer" and editing with "Gimp" in files types but still opens with "Paint".
Thanks
I do this in GIMP all the time, just right click on your JPG file and then choose properties and then make sure your in the first tab ( General ) and there is a button there that says Change. Choose GIMP and your all set. It will open GIMP anytime you double click the picture. It also should have an option when you right click that will say EDIT WITH GIMP from that point on too.
Another way if you want EDIT specifically to run GIMP only, then you goto your start menu and under Vista and Windows 7 you choose DEFAULT PROGRAMS. Its in there that you choose GIMP and tell it to OPEN JPG files as by default.
yep winwordExonar thats what you do.
But thats not the problem.
the question is how to do this via the app that i have written using shellexecuteA or similar so that
the editing application is the one that I want not the generic one. Also I cant ask everyone to change their image properties.
Is there anyone out there who has knowledge of how to do this progamaticaly.
You better detect if GIMP is installed by looking to registry, then use CreateProcess.
If it is not installed or not registered, shellexecute will fail.
modoran I am going to use your suggestion, the only reason why I mentioned "gimp" was because
thats the exe that I am testing my app with. The actual user pref exe will come from preference file.
Modoran
tried your way see below.
This will open Gimp but then throws up the 2 "Opening warnings"
I notice that the first warning the path has been truncated to end at the "and".
The second warning shows the path has been truncated at "Desktop" and an
addition partial path has been appended to this,????????
Seem to be on the right track apart from the truncating of the path.
Can you help here as have spent the whole day trying to solve this
If I set the exe to FireFox then it will open and try and search for "and" so the problem is not
with Gimp
CreateProcessA(NULL,"\"C:\\Program Files\\GIMP-2.0\\bin\\gimp-2.6.exe \"C:\\Documents and Settings\\My\\Desktop\\elefant.jpg",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS ,NULL,"C:\\Documents and Settings\\My\\Desktop\\",&si,&pi);
Opening 'C:\Documents and Settings\My\Desktop\and' failed: No such file or directory
Opening 'C:\Documents and Settings\My\Desktop\Settings\My\Desktop\elefant.jpg' failed: Could not open 'C:\Documents and Settings\My\Desktop\Settings\My\Desktop\elefant.jpg' for reading: No such file or directory
Your second argument is wrong, missing double quote after filename and after gimp exe too. Both must use double quote separate by space.
Try to declare a variable and print it to make sure you got right (if you use CreateProcessW this îs a must, as string must not be constant, but CreateProcessA will work anyway).
Modoran well done, talk about not being able to see the trees because of the forest.
Onwards to the next problem, lol.
Thanks.
For those that follow this thread in the future heres the working code.
STARTUPINFO si ={0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(si);
CreateProcessA(NULL,"\"C:\\Program Files\\GIMP-2.0\\bin\\gimp-2.6.exe\" \"C:\\Documents and Settings\\My\\Desktop\\elefant.jpg\"",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS ,NULL,NULL,&si,&pi);