Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

okay

Clueless

This topic is 6939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Sounds like u need to brush up on your win32 api
check out the win32 sdk.

Hint: The funtion u need is CreateWindowEx()

Good Luck

Share this post


Link to post
Share on other sites
Learn Win32 API... creating a window is rather long, but here''s my version of a window that I constantly use... don''t rip it off me completely, change some notes so it least LOOKS like you did something! :

// a windows skeleton
#include

LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);

char szWinName[] = "MyWin"; // name of window class

int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgs, int nWinMode)
{
HWND hwnd;
WNDCLASSEX wcl;
MSG msg;

// define the window class
wcl.cbSize = sizeof(WNDCLASSEX);
wcl.lpszClassName = szWinName;
wcl.lpfnWndProc = WinProc;
wcl.style = 0;

wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcl.hIconSm = NULL;
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);

wcl.lpszMenuName = NULL; // no menu
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hInstance = hThisInstance;

// make the background of the window black
wcl.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
// register the window class
if(!RegisterClassEx(&wcl)) return 0; // if the class doesn''t register, break it

// the window has been defined and registered,
// but now it''s time to create it
hwnd = CreateWindow(szWinName, // name of window class
"Windows Skeleton", //title
WS_OVERLAPPEDWINDOW, //style
CW_USEDEFAULT, // x
CW_USEDEFAULT, // y
CW_USEDEFAULT, // width
CW_USEDEFAULT, // height
NULL, // no parent window
NULL, // no menu
hThisInstance, //instance handle
NULL // no additional arguments
);

// diplay the window
ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);

// create a message loop
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}

// the message handler
LRESULT CALLBACK WinProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
switch(message){
case WM_DESTROY: // terminate the program
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}

GO LEAFS GO!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!