0x22b
03.12.2007, 15:28
Вообщем вот кодес файла заготовки пустова окна:
#define APPNAME "http://www.firststeps.ru Первые Шаги Урок 01 - Инициализцаия Приложения"
#define APPTITLE "http://www.firststeps.ru Первые Шаги Урок 01 - Инициализация Приложения"
#define _RELEASE_(p) { if(p) { (p)->Release(); (p)=NULL; };};
#define _DELETE_(p) { if(p) { delete (p); (p)=NULL; };};
#include <windows.h>
HWND hWnd;
//---------------------------------
// Name: WindowProc ()
// Desc:
//---------------------------------
LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_SETCURSOR:
SetCursor (NULL);
break;
};
return DefWindowProc(hWnd, message, wParam, lParam);
};
//---------------------------------
// Name: WindowInit ()
// Desc:
//---------------------------------
bool WindowInit (HINSTANCE hThisInst, int nCmdShow)
{
WNDCLASS wcl;
wcl.hInstance = hThisInst;
wcl.lpszClassName = APPNAME;
wcl.lpfnWndProc = WindowProc;
wcl.style = 0;
wcl.hIcon = LoadIcon (hThisInst, IDC_ICON);
wcl.hCursor = LoadCursor (hThisInst, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
RegisterClass (&wcl);
hWnd = CreateWindowEx (
WS_EX_TOPMOST,
APPNAME,
APPTITLE,
WS_OVERLAPPEDWINDOW,
0, 0,
640,
480,
NULL,
NULL,
hThisInst,
NULL);
if(!hWnd) return false;
return true;
};
//---------------------------------
// Name: AppInit()
// Desc: Initializes Aplication
//---------------------------------
bool AppInit (HINSTANCE hThisInst, int nCmdShow)
{
if(!WindowInit (hThisInst, nCmdShow)) return false;
ShowWindow (hWnd, nCmdShow);
UpdateWindow (hWnd);
return true;
};
//---------------------------------
// Name: WinMain ()
// Desc:
//---------------------------------
int APIENTRY WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
if(!AppInit (hThisInst, nCmdShow)) return false;
while (1)
{
if(PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(!GetMessage (&msg, NULL, 0, 0)) break;
TranslateMessage (&msg);
DispatchMessage (&msg);
}
};
return 0;
};
Visual Studio ругается:
Error 1 error C2440: '=' : cannot convert from 'const char [72]' to 'LPCWSTR' f:\source\c++\initial\initial.cpp 39
Error 2 error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [72]' to 'LPCWSTR' f:\source\c++\initial\initial.cpp 64
кто кодил графику помогите пожалуйста.. Заранее благодарен!
#define APPNAME "http://www.firststeps.ru Первые Шаги Урок 01 - Инициализцаия Приложения"
#define APPTITLE "http://www.firststeps.ru Первые Шаги Урок 01 - Инициализация Приложения"
#define _RELEASE_(p) { if(p) { (p)->Release(); (p)=NULL; };};
#define _DELETE_(p) { if(p) { delete (p); (p)=NULL; };};
#include <windows.h>
HWND hWnd;
//---------------------------------
// Name: WindowProc ()
// Desc:
//---------------------------------
LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_SETCURSOR:
SetCursor (NULL);
break;
};
return DefWindowProc(hWnd, message, wParam, lParam);
};
//---------------------------------
// Name: WindowInit ()
// Desc:
//---------------------------------
bool WindowInit (HINSTANCE hThisInst, int nCmdShow)
{
WNDCLASS wcl;
wcl.hInstance = hThisInst;
wcl.lpszClassName = APPNAME;
wcl.lpfnWndProc = WindowProc;
wcl.style = 0;
wcl.hIcon = LoadIcon (hThisInst, IDC_ICON);
wcl.hCursor = LoadCursor (hThisInst, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH);
RegisterClass (&wcl);
hWnd = CreateWindowEx (
WS_EX_TOPMOST,
APPNAME,
APPTITLE,
WS_OVERLAPPEDWINDOW,
0, 0,
640,
480,
NULL,
NULL,
hThisInst,
NULL);
if(!hWnd) return false;
return true;
};
//---------------------------------
// Name: AppInit()
// Desc: Initializes Aplication
//---------------------------------
bool AppInit (HINSTANCE hThisInst, int nCmdShow)
{
if(!WindowInit (hThisInst, nCmdShow)) return false;
ShowWindow (hWnd, nCmdShow);
UpdateWindow (hWnd);
return true;
};
//---------------------------------
// Name: WinMain ()
// Desc:
//---------------------------------
int APIENTRY WinMain (HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
if(!AppInit (hThisInst, nCmdShow)) return false;
while (1)
{
if(PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(!GetMessage (&msg, NULL, 0, 0)) break;
TranslateMessage (&msg);
DispatchMessage (&msg);
}
};
return 0;
};
Visual Studio ругается:
Error 1 error C2440: '=' : cannot convert from 'const char [72]' to 'LPCWSTR' f:\source\c++\initial\initial.cpp 39
Error 2 error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [72]' to 'LPCWSTR' f:\source\c++\initial\initial.cpp 64
кто кодил графику помогите пожалуйста.. Заранее благодарен!