Hi, again, to all!
I have had hard time with my little application development, and, when I finally thought next steps would be easy, I faced a
new problem...
I have an Image component on my form where I load pictures through openpicture dialog, like this:
Then, I do something with this picture or not, and then I want to make Paint programme open that picture for me on Main menu
item execution or buttonclick. I do that like this:
And that's where problems begin. I have been using ShellExecute for some time and I've never had problems before. But, I have
never tried to open Paint with image which is already loaded in my app.
Problems:
-this above doesn't work, usually I get error message e.g. like this:
"C:\Documents and Settings\BoMi\My Documents\My Pictures\sdff.bmp was not found."
Sometimes this message doesn't contain the whole address of a picture, but only a part of it, and sometimes picture extension
given in the message is wrong (like above, when I tried to open sdff.jpeg image from my app in Paint)
-this code above doesn't work even if I change PChar(ImgName) to PChar('C:\Documents and Settings\BoMi\My Documents\My
Pictures\sdff.jpeg') or any else address at all
-in some cases code above works if I change PChar(ImgName) to PChar(ExtractFileName(ImgName)), but only with some pictures
and doesn't with others (I can't see the difference between those pictures)
There's no problem with openning Paint with this:
What I really need is to make Paint open with image which is alredy loaded in my app this way or another, but I still would
like to see explanations/solutions of the mentioned problems.
I use Delphi 6.
Thanks to everyone who wants to help me (and who even read this a mile long question
)
I have had hard time with my little application development, and, when I finally thought next steps would be easy, I faced a
new problem...
I have an Image component on my form where I load pictures through openpicture dialog, like this:
Code:
public
{ Public declarations }
ImgName:string;
...
procedure TForm1.FileOpenImageExecute(Sender: TObject);
begin
if (OpenPictureDialog1.Execute) then
begin
ImgName:=OpenPictureDialog1.FileName;
Image1.Picture.Create;
Image1.Picture.LoadFromFile(ImgName);
StatusBar1.SimpleText:=ImgName;
end;
end;
Then, I do something with this picture or not, and then I want to make Paint programme open that picture for me on Main menu
item execution or buttonclick. I do that like this:
Code:
procedure TForm1.FileOpenPaintExecute(Sender: TObject);
begin
ShellExecute(Handle,
'open',
PChar('mspaint'),
PChar(ImgName),
nil,
SW_MAXIMIZE);
end;
And that's where problems begin. I have been using ShellExecute for some time and I've never had problems before. But, I have
never tried to open Paint with image which is already loaded in my app.
Problems:
-this above doesn't work, usually I get error message e.g. like this:
"C:\Documents and Settings\BoMi\My Documents\My Pictures\sdff.bmp was not found."
Sometimes this message doesn't contain the whole address of a picture, but only a part of it, and sometimes picture extension
given in the message is wrong (like above, when I tried to open sdff.jpeg image from my app in Paint)
-this code above doesn't work even if I change PChar(ImgName) to PChar('C:\Documents and Settings\BoMi\My Documents\My
Pictures\sdff.jpeg') or any else address at all
-in some cases code above works if I change PChar(ImgName) to PChar(ExtractFileName(ImgName)), but only with some pictures
and doesn't with others (I can't see the difference between those pictures)
There's no problem with openning Paint with this:
Code:
ShellExecute(Handle,
'open',
PChar('mspaint'),
nil,
nil,
SW_MAXIMIZE);
What I really need is to make Paint open with image which is alredy loaded in my app this way or another, but I still would
like to see explanations/solutions of the mentioned problems.
I use Delphi 6.
Thanks to everyone who wants to help me (and who even read this a mile long question