I wrote this prorgam, but when I try and compile I get the error "Unresolved external '_main' referenced from D:\BORLAND\BCC55\LIB\COX32.OBJ". The compile does generate the .obj, and .tds files, but not the .exe. Here is the program:
#define STRICT
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {
switch (iMsg) {
case WM_LBUTTONDOWN:
MessageBox(hWnd, "Left mouse button pressed", "6E69636F6C65282A29", MB_OK);
return 0;
case WM_RBUTTONDOWN:
MessageBox(hWnd, "Right mouse button pressed", "6E69636F6C65282A29", MB_OK);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, int iCmdShow) {
const char *const szAppName = "Windows";
WNDCLASSEX wndclass;
HWND hWnd;
MSG msg;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wndclass);
hWnd = CreateWindow(szAppName, "Windows", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg, NULL,0,0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
#define STRICT
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {
switch (iMsg) {
case WM_LBUTTONDOWN:
MessageBox(hWnd, "Left mouse button pressed", "6E69636F6C65282A29", MB_OK);
return 0;
case WM_RBUTTONDOWN:
MessageBox(hWnd, "Right mouse button pressed", "6E69636F6C65282A29", MB_OK);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, iMsg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, int iCmdShow) {
const char *const szAppName = "Windows";
WNDCLASSEX wndclass;
HWND hWnd;
MSG msg;
wndclass.cbSize = sizeof(wndclass);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wndclass);
hWnd = CreateWindow(szAppName, "Windows", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while (GetMessage(&msg, NULL,0,0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}