Tema: Win32 Api
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/10/2006, 15:38
FlyFox
 
Fecha de Ingreso: octubre-2006
Mensajes: 7
Antigüedad: 18 años, 4 meses
Puntos: 0
Win32 Api

Estoy haciendo el siguiente programa, que lo unico que tiene que hacer es abrir una ventana sin menu ni nada, pero quiero que parta maximizada, pero no funciona. Si alguien me puede ayudar, estaria muy agradecido.El codigo es:
Código:
#include <windows.h>
#include <commctrl.h>

#define _WIN32_IE 0x0500

LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch (msg)
	{
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hwnd,msg,wParam,lParam);
	}
	return 0;
}

HWND CreateMainWindow(HINSTANCE hInstance)
{
	InitCommonControls();
	HWND hTmp; // Temporary handle to a window
	WNDCLASSEX wcx;
	ZeroMemory(&wcx,sizeof(WNDCLASSEX));
	wcx.cbSize = sizeof(WNDCLASSEX); 
	wcx.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS; // Class styles
	wcx.lpfnWndProc = (WNDPROC)MainWndProc; // Pointer to the callback proc
	wcx.cbClsExtra = 0; 
	wcx.cbWndExtra = 0;
	wcx.hInstance = hInstance; // Instance of the application
	wcx.hIcon = NULL; // Class Icon
	wcx.hCursor = LoadCursor(NULL, IDC_ARROW); // Class Cursor
	wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW); // Background brush
	wcx.lpszMenuName = NULL; // Menu resource
	wcx.lpszClassName = "Draw"; // Name of this class
	wcx.hIconSm = NULL; // Small icon for this class
	if (!RegisterClassEx(&wcx))
		return 0;
	hTmp = CreateWindowEx(0, //Extended window style
			"Draw", // Window class name
			"Draw 1", // Window title
			WS_OVERLAPPEDWINDOW | WS_MAXIMIZE, // Window style
			CW_USEDEFAULT,CW_USEDEFAULT, // (x,y) pos of window
			CW_USEDEFAULT,CW_USEDEFAULT, // Width, height of window
			HWND_DESKTOP, // HWND of the parent
			NULL, // Handle to menu
			hInstance, // Handle to application instance
			NULL); // Pointer to window creation data
	return hTmp;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, INT nCmdShow)
{
	MSG msg; // MSG structure to store messages
	hwndMain = (HWND)CreateMainWindow(hInstance);
	if (!hwndMain)
		return 0;
	ShowWindow(hwndMain,SW_SHOW);
	while (GetMessage(&msg,NULL,0,0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return msg.wParam;
}