Solved

since win98 install bitmaps are loaded into the incorrect folder

Posted on 1998-12-28
7
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mobile Keyboard covers the display of the TMemo 3 113
Run video youtube webbrowse 10 85
Working with hours 3 85
Delphi...Split view - idea? 1 139
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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