Solved

since win98 install bitmaps are loaded into the incorrect folder

Posted on 1998-12-28
7
149 Views
Last Modified: 2010-04-04
Using D4 and having just installed Win98 now the default folder for storing and saving bitmaps has been changed to 'my documents' folder.
Before this win98 install the default folder was the program folder and the  Win95 D4 code was    Form1.Image2.Picture.LoadFromFile(openDialog1.FileName);

Now using Win98 I have to give the instructions as to the location of the bitmap

Form1.Image1.Picture.LoadFromFile('C:\WINDOWS\Desktop\CustomPuzzMicrMve1Unit\PuzzForm'+ IntToStr(ArayOfRandom[I]+1) + '.bmp');
If I share the program with someone then the code with win98 is not correct.  I need a relocatable instruction for the new Win98, D4.

Delphi3
0
Comment
Question by:delphi3
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1353438
You can do this:

Form1.Image1.Picture.LoadFromFile(extractfilepath(Application.exename) +'\PuzzForm'+ IntToStr(ArayOfRandom[I]+1) + '.bmp');

It that helps. This will always read the file from the location of the .EXE

Cheers,

Raymond.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1353439
Or you can do this:

chdir(ExtractFilePath(Applicaiton.Exename));

Then your previous code should work just fine...

Cheers,

Raymond.

0
 
LVL 4

Author Comment

by:delphi3
ID: 1353440
Raymond,
What is in your answer  above is partly correct. While using  ExtractFilePath(Application.exeName) it will  SaveToFile or LoadFromFile and it does make a specific path to that file folder for that one item named that I am presently using. This I thank you for.

 But specifically

  What I wanted to do was redirect the Open Dialog box, as  in the code lines

  if  OpenDialog1.Execute then
    begin
      Form1.Image2.Picture.LoadFromFile(OpenDialog1.FileName);

 the problem of when  opening the dialog box named above in the code it immediately looks  at the folder titled 'My Documents'. This is  not the folder with the program in it and all the pictures in it.  I did try all sorts of combinations trying to redirect the OpenDialog1.Execute but nothing seems to work.

Thanks in advance for your reply

delphi3
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1353441
Set the InitialDir property to the directory you want the open file dialog to start in.

Cheers,

Raymond.
0
 
LVL 4

Author Comment

by:delphi3
ID: 1353442
Raymond,

I have to feel that you have made sufficient effort to answer the problem, and thus deserve the points. Still, with your most recent reply I still have to programmatically state where open dialog is to OPEN or SAVE in the Project Options.... Directories/Conditionals. I think that this is where you intended me to insert the InitialDir. But this is  Not a default statement for all users regardless of their system   Yet, the answer maybe is somewhere else.

 My research shows that in Win98 Help, looking for the topic My Documents in  HELP  the following is quoted.

" Using My Documents

My Documents is a desktop folder that provides you with a convenient place to store documents, graphics, or other files you want to access quickly. On your desktop, it is represented by a folder with a sheet of paper in it. When you save a file in a program such as WordPad or Paint, the file is automatically saved in My Documents unless you choose a different location.

Notes
To change the default folder for My Documents, right-click My Documents, click Properties, and, in Target, type or browse for the path and folder name where you want to save files......."

Raymond, the gripe must be  with the authors of Win98...... after a click Properties there is NO box  to specify .....in Target where you want to save files......

So this may be a dead issue.

Thanks for your efforts

Delphi3


0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1353443
Delphi3,

The initialdir property is also very useful for allowing users to go back to the place they were last. eg: after saving a document and they save again its nice for them to default to the last location they saved to.

Sadly Mickeysoft still have the power to do whatever they damn well please...

Cheers,

Raymond.
0
 
LVL 4

Author Comment

by:delphi3
ID: 1353444
For those who read carefully, the My Documents folder,  as by the notes above state  IS  ASSUMED  to be ON THE DESKTOP, and then  a click  of Properties, then  TARGET will  appear.  Oops, I missed that small point.  If it is anywhere else, as mine was and it was  in C:\  then TARGET does not appear. Hope my mistake  didn't mess up your WIN98 happiness.
As some persons who sign off wirte,
Enjoy,
Delphi3

PS    A lot of programmatic spaghetti.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question