#define STRICT
#include <windows.h>
#include "StdAfx.h"
int i;
i = AfxMessageBox("Simple message box\n", MB_YESNOCANCEL||MB_ICONSTOP);
return 0;
I get error:
C:\Project\msgbox.cpp(45) : error C2065: 'AfxMessageBox' : undeclared
identifier
--
Thanks
Rubber Ducky
Please reply to group or to email
To reply to email remove NOSPAM
Always put #include "stdafx.h" on the VERY FIRST LINE of your code.
The compiler ignores anything it finds before that.
The Afx... family of calls are in the MFC library but you haven't
#included the MFC definitions. You can build a Win32 API program or you
can build an MFC program, but you've got a mixed-up bit of each in your
#include's here. Whichever way you are trying to go, first build a
skeletal program using the wizard (File, New, Project,...) to get
started on the right foot.
--
Scott McPhillips [VC++ MVP]
> Can anyone point me to an example of a simple proggie that shows a message
> box, and then then finds out which button the user pressed.
> I have this code, but it seems not to work:
#include <windows.h>
int main(void)
{
rc = MessageBox(0, "Test", "Testing", MB_YESNOCANCEL);
if (rc == IDYES)
; yes pressed
else if (rc == IDNO)
; no pressed
else if (rc == IDCANCEL)
; cancel pressed
return 0;
}
HTH,
AriL