Solved

since win98 install bitmaps are loaded into the incorrect folder

Posted on 1998-12-28
7
147 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now