| | |
OpenPictureDialog killing LoadFromFile
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 23
Reputation:
Solved Threads: 0
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")
this is my reopen code
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.
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")
C++ Syntax (Toggle Plain Text)
if(!OpenPictureDialog1->Execute()) return; AnsiString FilePath = OpenPictureDialog1->FileName; AnsiString FileType = ExtractFileExt(FilePath); AnsiString FileLoc = ExtractFileDir(FilePath); AnsiString FileName = ExtractFileName(FilePath); if(FileType.LowerCase() == ".jpg") { TJPEGImage *jpgImage = new TJPEGImage(); jpgImage->LoadFromFile(FilePath); jpgImage->DIBNeeded(); // Decompress to Device Indepandant Bitmap BackBuffer->Assign(jpgImage); // Deep copy delete jpgImage; img_mainimg->Picture->Bitmap->Assign(BackBuffer); img_mainimg->Width = img_mainimg->Picture->Width; img_mainimg->Height = img_mainimg->Picture->Height; AddFileDetails = true; } else if(FileType.LowerCase() == ".bmp") { BackBuffer->LoadFromFile(FilePath); img_mainimg->Picture->Bitmap->Assign(BackBuffer); img_mainimg->Width = img_mainimg->Picture->Bitmap->Width; img_mainimg->Height = img_mainimg->Picture->Bitmap->Height; AddFileDetails = true; };
this is my reopen code
C++ Syntax (Toggle Plain Text)
TMemo *mem_RecentFiles = new TMemo(this);//creates a new memo to store file names mem_RecentFiles->Visible = false; mem_RecentFiles->Parent = this; mem_RecentFiles->ScrollBars = ssHorizontal; History(); mem_RecentFiles->Lines->LoadFromFile("history.pix"); AnsiString File = mem_RecentFiles->Lines->operator [](1); PFileHandles.FileReopen(File, img_mainimg, BackBuffer, PImgFileData, ImageArray, OriginalArray, imgcount); 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.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Can some one point me to Message Maps property sheet in VC 2008?
- Next Thread: How do I flush the input stream?
| Thread Tools | Search this Thread |
api array based beginner bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project python random read recursion recursive return sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





