-
Code:
--------------------Configuration: win32 Class Practice - Win32 Debug--------------------
Compiling...
class.cpp
C:\Windows\Profiles\Steve\Desktop\C c++\win32 Class Practice\class.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
win32 Class Practice.exe - 1 error(s), 0 warning(s)
I don't know what to do :confused: Do I Have to re-install it? :confused:
Here's the code I'm using...(class practice)
PHP Code:
// Class Practice For A Win32 Application
// By Steve Mack\
// March 9, 2001 (09.03.01)
#include <windows.h>
HWND ghWnd_Main; // this is the main window
HWND ghWnd_enter;
HWND ghWnd_Text;
class NAME {
public:
char setname(char myname[40]);
void showname();
char finalname[40];
}
NAME::setname {
finalname = myname;
return finalname;
}
NAME::showname {
MessageBox(hWnd, finalname, "name:", MB_OK);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch(uMsg) {
case WM_CLOSE:
DestroyWindow(ghWnd_Main); // Destroy the main window
return 0;
case WM_DESTROY:
NAME::~showname {
}
NAME::~setname {
}
PostQuitMessage(0); // Quit the application
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_enter) {
NAME steve;
steve.setname("Steveman");
steve.showname;
}
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); // Not handled - let the system deal with it
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wcxMyClass;
wcxMyClass.cbSize = sizeof(WNDCLASSEX); // Size of structure in bytes
wcxMyClass.style = 0; // Extra style information
wcxMyClass.lpfnWndProc = WndProc; // Pointer to window procedure
wcxMyClass.cbClsExtra = 0; // Extra bytes in class definition
wcxMyClass.cbWndExtra = 0; // Extra bytes for each window
wcxMyClass.hInstance = hInstance; // Instance handle for the class
wcxMyClass.hIcon = NULL; // Default icon - use system
wcxMyClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the system arrow
wcxMyClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); // Background brush
wcxMyClass.lpszMenuName = NULL; // Menu name [MAKEINTRESOURCE(IDM_MAINMENU)] - none here
wcxMyClass.lpszClassName = "TESTCLASS"; // Class name
wcxMyClass.hIconSm = NULL; // Small icon
RegisterClassEx(&wcxMyClass); // Register the class
ghWnd_Main = CreateWindow("TESTCLASS", "Steve's Class Practice", WS_OVERLAPPEDWINDOW, 100, 100, 400, 445, NULL, NULL, hInstance, NULL);
if(ghWnd_Main) {
ghWnd_Text = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "Enter Your Name Here...", WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL, 0, 40, 330, 40, ghWnd_Main, NULL, hInstance, NULL);
ghWnd_enter = CreateWindow("Button", "Enter Info", WS_CHILD | WS_VISIBLE, 0, 0, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
ShowWindow(ghWnd_Main, nCmdShow); // Show using the specific show style
}
/////////////////////////
// Handle message loop //
/////////////////////////
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); // Translate keycode messages
DispatchMessage(&msg); // Send to the window
}
UnregisterClass("TESTCLASS", hInstance); // Unregister our window class
return msg.wParam; // msg.wParam contains the code passed to PostQuitMessage()
}
-
Code:
// Class Practice For A Win32 Application
// By Steve Mack\
// March 9, 2001 (09.03.01)
#include <windows.h>
HWND ghWnd_Main; // this is the main window
HWND ghWnd_enter;
HWND ghWnd_Text;
class NAME {
public:
char setname(char myname[40]);
void showname();
char finalname[40];
};
char NAME::setname {
finalname = myname;
return finalname;
}
void NAME::showname {
MessageBox(hWnd, finalname, "name:", MB_OK);
}
//finalname needs to be declared
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch(uMsg) {
case WM_CLOSE:
DestroyWindow(ghWnd_Main); // Destroy the main window
return 0;
case WM_DESTROY:
NAME::~showname {
}
NAME::~setname {
}
PostQuitMessage(0); // Quit the application
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_enter) {
NAME steve;
steve.setname("Steveman"); //hehehehehehehe
steve.showname;
}
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); // Not handled - let the system deal with it
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wcxMyClass;
wcxMyClass.cbSize = sizeof(WNDCLASSEX); // Size of structure in bytes
wcxMyClass.style = 0; // Extra style information
wcxMyClass.lpfnWndProc = WndProc; // Pointer to window procedure
wcxMyClass.cbClsExtra = 0; // Extra bytes in class definition
wcxMyClass.cbWndExtra = 0; // Extra bytes for each window
wcxMyClass.hInstance = hInstance; // Instance handle for the class
wcxMyClass.hIcon = NULL; // Default icon - use system
wcxMyClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the system arrow
wcxMyClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); // Background brush
wcxMyClass.lpszMenuName = NULL; // Menu name [MAKEINTRESOURCE(IDM_MAINMENU)] - none here
wcxMyClass.lpszClassName = "TESTCLASS"; // Class name
wcxMyClass.hIconSm = NULL; // Small icon
RegisterClassEx(&wcxMyClass); // Register the class
ghWnd_Main = CreateWindow("TESTCLASS", "Steve's Class Practice", WS_OVERLAPPEDWINDOW, 100, 100, 400, 445, NULL, NULL, hInstance, NULL);
if(ghWnd_Main) {
ghWnd_Text = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "Enter Your Name Here...", WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL, 0, 40, 330, 40, ghWnd_Main, NULL, hInstance, NULL);
ghWnd_enter = CreateWindow("Button", "Enter Info", WS_CHILD | WS_VISIBLE, 0, 0, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
ShowWindow(ghWnd_Main, nCmdShow); // Show using the specific show style
}
/////////////////////////
// Handle message loop //
/////////////////////////
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); // Translate keycode messages
DispatchMessage(&msg); // Send to the window
}
UnregisterClass("TESTCLASS", hInstance); // Unregister our window class
return msg.wParam; // msg.wParam contains the code passed to PostQuitMessage()
}
-
I didn't notice a few things.
Code:
// Class Practice For A Win32 Application
// By Steve Mack\
// March 9, 2001 (09.03.01)
#include <windows.h>
#include <string.h>
HWND ghWnd_Main; // this is the main window
HWND ghWnd_enter;
HWND ghWnd_Text;
class NAME {
public:
NAME();
~NAME();
char* setname(char myname[40]);
void showname();
private:
char finalname[40];
};
char* NAME::setname(char myname[40]) {
strcpy(finalname, myname);
return finalname;
}
void NAME::showname() {
MessageBox(ghWnd_Main, finalname, "name:", MB_OK);
}
NAME::NAME()
{
}
NAME::~NAME()
{
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
NAME steve;
switch(uMsg) {
case WM_CLOSE:
DestroyWindow(ghWnd_Main); // Destroy the main window
return 0;
case WM_DESTROY:
PostQuitMessage(0); // Quit the application
return 0;
case WM_COMMAND:
if(LOWORD(wParam) == BN_CLICKED && (HWND)lParam == ghWnd_enter) {
steve.setname("Steveman");
steve.showname();
}
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam); // Not handled - let the system deal with it
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wcxMyClass;
wcxMyClass.cbSize = sizeof(WNDCLASSEX); // Size of structure in bytes
wcxMyClass.style = 0; // Extra style information
wcxMyClass.lpfnWndProc = WndProc; // Pointer to window procedure
wcxMyClass.cbClsExtra = 0; // Extra bytes in class definition
wcxMyClass.cbWndExtra = 0; // Extra bytes for each window
wcxMyClass.hInstance = hInstance; // Instance handle for the class
wcxMyClass.hIcon = NULL; // Default icon - use system
wcxMyClass.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the system arrow
wcxMyClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); // Background brush
wcxMyClass.lpszMenuName = NULL; // Menu name [MAKEINTRESOURCE(IDM_MAINMENU)] - none here
wcxMyClass.lpszClassName = "TESTCLASS"; // Class name
wcxMyClass.hIconSm = NULL; // Small icon
RegisterClassEx(&wcxMyClass); // Register the class
ghWnd_Main = CreateWindow("TESTCLASS", "Steve's Class Practice", WS_OVERLAPPEDWINDOW, 100, 100, 400, 445, NULL, NULL, hInstance, NULL);
if(ghWnd_Main) {
ghWnd_Text = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "Enter Your Name Here...", WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL, 0, 40, 330, 40, ghWnd_Main, NULL, hInstance, NULL);
ghWnd_enter = CreateWindow("Button", "Enter Info", WS_CHILD | WS_VISIBLE, 0, 0, 100, 30, ghWnd_Main, NULL, hInstance, NULL);
ShowWindow(ghWnd_Main, nCmdShow); // Show using the specific show style
}
/////////////////////////
// Handle message loop //
/////////////////////////
MSG msg;
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg); // Translate keycode messages
DispatchMessage(&msg); // Send to the window
}
UnregisterClass("TESTCLASS", hInstance); // Unregister our window class
return msg.wParam; // msg.wParam contains the code passed to PostQuitMessage()
}