Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Problem with initializing Main args! Pin
Game-point23-Sep-09 18:40
Game-point23-Sep-09 18:40 
AnswerRe: Problem with initializing Main args! Pin
Saurabh.Garg23-Sep-09 18:56
Saurabh.Garg23-Sep-09 18:56 
AnswerRe: Problem with initializing Main args! Pin
«_Superman_»23-Sep-09 19:23
professional«_Superman_»23-Sep-09 19:23 
AnswerRe: Problem with initializing Main args! Pin
Richard MacCutchan23-Sep-09 22:32
mveRichard MacCutchan23-Sep-09 22:32 
QuestionC++ with in-code Assembly Pin
paolosh23-Sep-09 10:22
paolosh23-Sep-09 10:22 
AnswerRe: C++ with in-code Assembly Pin
ied23-Sep-09 10:28
ied23-Sep-09 10:28 
AnswerRe: C++ with in-code Assembly Pin
Rick York23-Sep-09 10:37
mveRick York23-Sep-09 10:37 
QuestionLoadImage fails to locate file Pin
raich23-Sep-09 8:32
raich23-Sep-09 8:32 
Hi All,

I have a problem with LoadImage method in my small Visual C++ project in Visual Studio 2008. No matter what I pass as filename, The GetLastError always returns "The System Cannot find the File Specified".

I've tried with Loading from the resource:

m_pBitmap->LoadBitmap(IDB_BITMAP1); //THIS WORKS PERFECTLY

But I've commented out this line and instead using the following code in OnInitialUpdate() method. But It fails. I've placed the bmp file in C: also in the Debug directory from where I run the executable. (While running from Debug the filename is simply "barcode.bmp" and I've placed the bmp file in the Debug directory.)

But I always get the error: The System Cannot find the File Specified. Definitely, I'm missing something but I'm unable to find out....

----------------------------------------------------------------------------------
void CMymfcBitmapView::OnInitialUpdate()
{
.
.
.

//m_hBitmap is a HBITMAP Member Variable in the my View Class
m_hBitmap = (HBITMAP)LoadImage(NULL, (LPCWSTR)"c:\\barcode.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);

if(m_hBitmap == NULL)
{
//DWORD err = ::GetLastError();

LPVOID lpMsgBuf;

::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);

::MessageBox( NULL, (LPCTSTR)lpMsgBuf, (LPCWSTR)"Error", MB_OK | MB_ICONINFORMATION );

// Free the buffer.
LocalFree( lpMsgBuf );

}
--------------------------------------------------

Thanking you all in Advance....
QuestionRe: LoadImage fails to locate file Pin
David Crow23-Sep-09 9:03
David Crow23-Sep-09 9:03 
AnswerRe: LoadImage fails to locate file Pin
raich23-Sep-09 9:42
raich23-Sep-09 9:42 
QuestionRe: LoadImage fails to locate file Pin
David Crow23-Sep-09 10:00
David Crow23-Sep-09 10:00 
AnswerRe: LoadImage fails to locate file Pin
norish23-Sep-09 21:43
norish23-Sep-09 21:43 
AnswerRe: LoadImage fails to locate file Pin
ied23-Sep-09 9:56
ied23-Sep-09 9:56 
GeneralRe: LoadImage fails to locate file Pin
raich23-Sep-09 10:02
raich23-Sep-09 10:02 
AnswerRe: LoadImage fails to locate file Pin
CPallini23-Sep-09 10:02
mveCPallini23-Sep-09 10:02 
QuestionOverriding void AFXAPI SerializeElements [modified] Pin
al250023-Sep-09 7:22
al250023-Sep-09 7:22 
AnswerRe: Overriding void AFXAPI SerializeElements [modified] Pin
al250023-Sep-09 10:24
al250023-Sep-09 10:24 
GeneralRe: Overriding void AFXAPI SerializeElements Pin
al250023-Sep-09 12:47
al250023-Sep-09 12:47 
QuestionShell notification when opening a folder Pin
mkoroudjiev23-Sep-09 6:15
mkoroudjiev23-Sep-09 6:15 
QuestionRe: Shell notification when opening a folder Pin
David Crow23-Sep-09 6:37
David Crow23-Sep-09 6:37 
AnswerRe: Shell notification when opening a folder Pin
Stuart Dootson23-Sep-09 11:53
professionalStuart Dootson23-Sep-09 11:53 
AnswerRe: Shell notification when opening a folder Pin
kilt24-Sep-09 7:05
kilt24-Sep-09 7:05 
QuestionHow to determine the desktop type?? Pin
Sunil P V23-Sep-09 3:09
Sunil P V23-Sep-09 3:09 
QuestionRe: How to determine the desktop type?? Pin
David Crow23-Sep-09 3:47
David Crow23-Sep-09 3:47 
Questionexcel automation not starting Pin
prithaa23-Sep-09 3:03
prithaa23-Sep-09 3:03 

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.