OpenPictureDialog killing LoadFromFile

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 23
Reputation: OnIIcE is an unknown quantity at this point 
Solved Threads: 0
OnIIcE OnIIcE is offline Offline
Newbie Poster

OpenPictureDialog killing LoadFromFile

 
0
  #1
Dec 28th, 2008
Hi,

im trying to create a image editor and Im currently working on a "history/reopen" image part in my menu.

ive read loads into dynamicly creating menu items but have always failed when it has come to adding a function to it, but that is a differnt story all together (maybe a different thread )

well currently what i have is working, and my program opens up a "history" file and reads the last 5 images opend and adds them to the menu list. they all open well through this.

my problem comes when i use the my normal open function. the openpicturedialog seems to "kill" my loadfromfile and it cant read from the history text file.

This is my open image code (ive removed some parts due to length, but this is the "guts")

  1. if(!OpenPictureDialog1->Execute()) return;
  2.  
  3. AnsiString FilePath = OpenPictureDialog1->FileName;
  4. AnsiString FileType = ExtractFileExt(FilePath);
  5. AnsiString FileLoc = ExtractFileDir(FilePath);
  6. AnsiString FileName = ExtractFileName(FilePath);
  7.  
  8.  
  9. if(FileType.LowerCase() == ".jpg")
  10. {
  11. TJPEGImage *jpgImage = new TJPEGImage();
  12. jpgImage->LoadFromFile(FilePath);
  13. jpgImage->DIBNeeded(); // Decompress to Device Indepandant Bitmap
  14. BackBuffer->Assign(jpgImage); // Deep copy
  15. delete jpgImage;
  16. img_mainimg->Picture->Bitmap->Assign(BackBuffer);
  17. img_mainimg->Width = img_mainimg->Picture->Width;
  18. img_mainimg->Height = img_mainimg->Picture->Height;
  19. AddFileDetails = true;
  20. }
  21. else
  22. if(FileType.LowerCase() == ".bmp")
  23. {
  24. BackBuffer->LoadFromFile(FilePath);
  25. img_mainimg->Picture->Bitmap->Assign(BackBuffer);
  26. img_mainimg->Width = img_mainimg->Picture->Bitmap->Width;
  27. img_mainimg->Height = img_mainimg->Picture->Bitmap->Height;
  28. AddFileDetails = true;
  29. };

this is my reopen code

  1. TMemo *mem_RecentFiles = new TMemo(this);//creates a new memo to store file names
  2. mem_RecentFiles->Visible = false;
  3. mem_RecentFiles->Parent = this;
  4. mem_RecentFiles->ScrollBars = ssHorizontal;
  5. History();
  6. mem_RecentFiles->Lines->LoadFromFile("history.pix");
  7. AnsiString File = mem_RecentFiles->Lines->operator [](1);
  8. PFileHandles.FileReopen(File, img_mainimg, BackBuffer, PImgFileData, ImageArray, OriginalArray, imgcount);
  9. Caption = PROGRAM_TITLE + " " + PROGRAM_VERSION + " - " + PImgFileData[imgcount].F_Name;

its on the LoadFromFile where my problem then starts to occur - it acts as if nothing is in the history file.

ive attached a zip file of all the full code if anyone could care to have alook since ive spent hours commenting things out to investigate and have come down to somthing with the opendialog interfears with the loadfile stream after its been opend.
Last edited by OnIIcE; Dec 28th, 2008 at 9:42 pm.
Attached Files
File Type: zip Pixiev2.zip (1.13 MB, 1 views)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC