|
From: Noorez K. <coo...@ho...> - 2003-12-20 17:32:29
|
There is a problem with my windows application. I'v put it below
#include <windows.h>
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsgId, WPARAM wParam, LPARAM
lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
pszCmdLine, int nCmdShow)
{
static char szAppName[] = "hello";
HWND hWnd;
MSG msg;
WNDCLASSEX wndClass;
//register class
wndClass.style = 0;
wndClass.lpfnWndProc = WindowProc;
wndClass. cbClsExtra = 0;
wndClass.hInstance = hInstance;
wndClass.hIcon = LoadIcon( hInstance, szAppName);
wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = szAppName;
wndClass.hIconSm = wndClass.hIcon;
if(RegisterClassEx(&wndClass)==0)//register class...
return 0; //quit if it doesn't work
//now create window
hWnd = CreateWindow(szAppName, szAppName, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance,
NULL);
if(hWnd == NULL)
return 0;
ShowWindow(hWnd, nCmdShow);
UpdateWindow( hWnd );
while( GetMessage(&msg, NULL, 0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//process functions
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsgId, WPARAM wParam, LPARAM
lParam)
{
static char *pszHello = "Hello, world";
switch( uMsgId)
{
case WM_PAINT:
{
HDC hDC;
PAINTSTRUCT paintStruct;
hDC = BeginPaint( hWnd, &paintStruct);
TextOut(hDC, 0,0, pszHello, lstrlen(pszHello));
EndPaint( hWnd, &paintStruct );
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd,uMsgId,wParam,lParam);
}
return( 0 );
}
These are the errors:
[Linker error] undefined reference to `GetStockObject@4'
[Linker error] undefined reference to `TextOutA@20'
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
|