Click here to Skip to main content
15,925,661 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: adding an image Pin
Mel Feik26-Oct-02 19:21
Mel Feik26-Oct-02 19:21 
GeneralRe: adding an image Pin
Paul M Watt26-Oct-02 19:35
mentorPaul M Watt26-Oct-02 19:35 
GeneralRe: adding an image Pin
Mel Feik26-Oct-02 19:41
Mel Feik26-Oct-02 19:41 
GeneralRe: adding an image Pin
Mel Feik26-Oct-02 19:33
Mel Feik26-Oct-02 19:33 
GeneralRe: adding an image Pin
Michael Dunn26-Oct-02 19:35
sitebuilderMichael Dunn26-Oct-02 19:35 
GeneralRe: adding an image Pin
Mel Feik26-Oct-02 19:41
Mel Feik26-Oct-02 19:41 
GeneralRe: adding an image Pin
peterchen27-Oct-02 7:57
peterchen27-Oct-02 7:57 
GeneralRe: adding an image Pin
Mel Feik27-Oct-02 8:28
Mel Feik27-Oct-02 8:28 
QuestionAny other C++ forum?? Pin
vishwadev26-Oct-02 15:09
vishwadev26-Oct-02 15:09 
AnswerRe: Any other C++ forum?? Pin
Mel Feik26-Oct-02 15:59
Mel Feik26-Oct-02 15:59 
GeneralRe: Any other C++ forum?? Pin
vishwadev26-Oct-02 16:30
vishwadev26-Oct-02 16:30 
AnswerRe: Any other C++ forum?? Pin
David Gao26-Oct-02 16:09
David Gao26-Oct-02 16:09 
AnswerRe: Any other C++ forum?? Pin
Anonymous26-Oct-02 19:09
Anonymous26-Oct-02 19:09 
AnswerRe: Any other C++ forum?? Pin
Christian Graus26-Oct-02 21:09
protectorChristian Graus26-Oct-02 21:09 
GeneralLoadImage... Out of Memory!! HELP! Pin
devvvy26-Oct-02 14:12
devvvy26-Oct-02 14:12 
GeneralRe: LoadImage... Out of Memory!! HELP! Pin
Michael Dunn26-Oct-02 18:31
sitebuilderMichael Dunn26-Oct-02 18:31 
GeneralRe: LoadImage... Out of Memory!! HELP! Pin
devvvy28-Oct-02 11:20
devvvy28-Oct-02 11:20 
GeneralProblem with CreateThread memory allocation Pin
devvvy26-Oct-02 13:10
devvvy26-Oct-02 13:10 
GeneralRe: Problem with CreateThread memory allocation Pin
Neville Franks26-Oct-02 13:42
Neville Franks26-Oct-02 13:42 
GeneralRe: Problem with CreateThread memory allocation Pin
devvvy26-Oct-02 14:19
devvvy26-Oct-02 14:19 
Thanks for the feedback first of all. LoadImage return a BITMAP hBitmap which is stored in a variable (of type BITMAP of course) in the "thread function". The images sequence is stored in a CBitmap array in the document class, which is separate from the thread... so, all I need is just enuf memory for ONE bitmap (700kB), and yes 10MB is an overkill, but I really dont understand why LoadImage results in memory error:

long WINAPI LoadFrames(LPARAM lparam)
{ //*

CString sPath;
HBITMAP hBitmap = NULL;

CAutoPlayMFCDoc * pDoc = NULL;

pDoc = (CAutoPlayMFCDoc*) lparam;

//Load the rest of the frames!
for(int i=NUM_PRELOAD; i<num_bitmap; i++)
="" {="" **

="" spath="pDoc-">GetPath();
if( sPath.GetLength() > 0 )
{ //***

hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), sPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );

if( hBitmap != NULL)
{
pDoc->GetBitmapSeq(i).Attach(hBitmap);
}
else
{
//That's the problem: dwError==8 implies "ERROR_NOT_ENOUGH_MEMORY"
DWORD dwError = GetLastError();
pDoc->SetLoadState(1);
i = i -1; //reload the frame
break;
}

//Increment m_nTargetDocFrame:
pDoc->SetTargetDocFrame(i);

} //***
} //**

return 1;

} //*



norm
GeneralRe: Problem with CreateThread memory allocation Pin
Neville Franks26-Oct-02 14:41
Neville Franks26-Oct-02 14:41 
GeneralRe: Problem with CreateThread memory allocation Pin
devvvy26-Oct-02 14:50
devvvy26-Oct-02 14:50 
GeneralRe: Problem with CreateThread memory allocation Pin
Neville Franks26-Oct-02 14:59
Neville Franks26-Oct-02 14:59 
GeneralRe: Problem with CreateThread memory allocation Pin
devvvy26-Oct-02 15:08
devvvy26-Oct-02 15:08 
GeneralMSHTML Table Insertion using CHtmlEditView Pin
Member 5194326-Oct-02 12:25
Member 5194326-Oct-02 12:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.