Archived

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

olle55

Window resize question.

Recommended Posts

Hello. I am writing a ddraw application in windowe mode, and when you put the mouse cursor on a edge of it, you get the resize cursor and you can resize it. I dont want that to be possible. How do i create a window that is not resizeable? This is my code for creating a window:
  
WNDCLASS	wc;
	HWND		hWnd;

	// Register the Window Class

	wc.lpszClassName	= TEXT("Tetris");
	wc.lpfnWndProc		= MsgProc;
	wc.style			= CS_VREDRAW | CS_HREDRAW;
	wc.hInstance		= hInst;
	wc.hIcon			= LoadIcon( hInst, MAKEINTRESOURCE(IDI_ICON1) );;
	wc.hCursor			= LoadCursor( NULL, IDC_ARROW );
	wc.hbrBackground	= (HBRUSH) GetStockObject(BLACK_BRUSH);
	wc.lpszMenuName		= NULL;
	wc.cbClsExtra		= 0;
	wc.cbWndExtra		= 0;

	if( !RegisterClass( &wc ) )
		return E_FAIL;

	hWnd = CreateWindowEx( 0, TEXT("Tetris"), TEXT("Tetris"),
							WS_OVERLAPPEDWINDOW | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT,
							CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL );
  
Thanks in advance!

Share this post


Link to post
Share on other sites
Sure, it compiles fine, but when i try to run it nothing happens, but if i press alt+ctrl-del i see the program there, i have to kill it if i want to compile again. I can''t alt+tab to it either.


This is the code i use to create the window:

  
hWnd = CreateWindowEx( 0, TEXT("Tetris"), TEXT("Tetris"),
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_THICKFRAME, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL );

Share this post


Link to post
Share on other sites
The problem was in ddutil.cpp which i used to initialize ddraw.

Just comment the following lines in ddraw.cpp and it will work.


  
// If we are still a WS_POPUP window we should convert to a normal app

// window so we look like a windows app.

dwStyle = GetWindowStyle( hWnd );
dwStyle &= ~WS_POPUP;
dwStyle |= WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX;
SetWindowLong( hWnd, GWL_STYLE, dwStyle );

Share this post


Link to post
Share on other sites