Creating a new window
-
Hi, I am learning VC++ with some experience with C++, I could compile and execute some simple programs like finding a prime etc successfully. Now I am trying to learn creating a new window using MFC. Whenever I execute the code, i get the following message" "Hello.exe has encounetered a problem and needs to close..please tell Microsoft about the problem...." The appname and modname in the technical data are both Hello.exe. When I click on the Debug button in this window it gives me the following message "The instruction at "Ox0045c8fb" referenced memorry at "0x00000000". The memory could not be "read". Clik ok to terminate the program." In the Debug information I have: Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found. Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL' Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL' Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\SHLWAPI.DLL', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found. The thread 0x9F0 has exited with code 0 (0x0). The thread 0x9C4 has exited with code -1073741819 (0xC0000005). The code I am trying to execute is: // Creating a Hello.cpp win 32 application. #include class C_MyApp:public CWinApp { BOOL InitInstance(); }; class C_MainFrame:public CFrameWnd { public: C_MainFrame(); }; C_MainFrame::C_MainFrame() { Create(NULL,"Main Window"); } BOOL C_MyApp::InitInstance() { m_pMainWnd=new C_MainFrame(); m_pMainWnd->ShowWindow(m_nCmdShow); return TRUE; } void main() { //int m_pCmdShow; C_MyApp myApp; } Can anyone help me on how to successfully execute this program? Thanks in Advance, Regards, Frank Michael, "Faith is a great stimulant so is Fear"
-
Hi, I am learning VC++ with some experience with C++, I could compile and execute some simple programs like finding a prime etc successfully. Now I am trying to learn creating a new window using MFC. Whenever I execute the code, i get the following message" "Hello.exe has encounetered a problem and needs to close..please tell Microsoft about the problem...." The appname and modname in the technical data are both Hello.exe. When I click on the Debug button in this window it gives me the following message "The instruction at "Ox0045c8fb" referenced memorry at "0x00000000". The memory could not be "read". Clik ok to terminate the program." In the Debug information I have: Loaded 'C:\WINDOWS\system32\ntdll.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found. Loaded symbols for 'C:\WINDOWS\system32\MFC42D.DLL' Loaded symbols for 'C:\WINDOWS\system32\MSVCRTD.DLL' Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\advapi32.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\version.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\SHLWAPI.DLL', no matching symbolic information found. Loaded 'C:\WINDOWS\system32\apphelp.dll', no matching symbolic information found. The thread 0x9F0 has exited with code 0 (0x0). The thread 0x9C4 has exited with code -1073741819 (0xC0000005). The code I am trying to execute is: // Creating a Hello.cpp win 32 application. #include class C_MyApp:public CWinApp { BOOL InitInstance(); }; class C_MainFrame:public CFrameWnd { public: C_MainFrame(); }; C_MainFrame::C_MainFrame() { Create(NULL,"Main Window"); } BOOL C_MyApp::InitInstance() { m_pMainWnd=new C_MainFrame(); m_pMainWnd->ShowWindow(m_nCmdShow); return TRUE; } void main() { //int m_pCmdShow; C_MyApp myApp; } Can anyone help me on how to successfully execute this program? Thanks in Advance, Regards, Frank Michael, "Faith is a great stimulant so is Fear"