Red de conocimiento informático - Problemas con los teléfonos móviles - Cómo configurar la ventana a pantalla completa en Win32api

Cómo configurar la ventana a pantalla completa en Win32api

En primer lugar, considere el momento del procesamiento de pantalla completa, ya sea que se realice cuando se crea la ventana o cuando se muestra la ventana. Si es lo primero, puede:

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)

 {

 HWND hWnd;

 hInst = hInstance // Almacena el identificador de instancia en una variable global

UINT ancho = GetSystemMetrics( SM_CXSCREEN);

UINT alto = GetSystemMetrics(SM_CYSCREEN);

//Crear ventana

hWnd= CreateWindow(

szWindowClass,

 szTitle,

 WS_POPUP,

 0,0,

 ancho,alto ,

 NULL,NULL,

hInstancia,

NULL);

if (!hWnd)

{

devuelve FALSO;

 }

ShowWindow(hWnd, nCmdShow);

UpdateWindow(hWnd);

devuelve TRUE;

}

Si el procesamiento se realiza cuando se muestra la ventana:

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)

{

HWND hWnd;

hInst = hInstance; // Almacena el identificador de instancia en una variable global

hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,

CW_USEDEFAULT, 0, CW_USEDEFAULT , 0, NULL, NULL, hInstance, NULL);

if (!hWnd)

{

devuelve FALSO;

}

HWND hDesk;

RECT rc;

hDesk = GetDesktopWindow();

GetWindowRect( hDesk, &rc );

SetWindowLong( hWnd, GWL_STYLE, WS_BORDER );

SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, rc.right, rc. abajo, SWP_SHOWWINDOW);

ShowWindow( hWnd, nCmdShow);

UpdateWindow(hWnd);

devuelve VERDADERO;

}

También permite al usuario controlar el tiempo de pantalla completa, por ejemplo, presione la tecla "ESC" para ingresar a pantalla completa

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)

{

HWND hWnd;

 hInst = hInstance; // Almacena el identificador de instancia en una variable global

hWnd = C

reateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,

CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

if (!hWnd)

{

devuelve FALSO;

}

ShowWindow(hWnd, nCmdShow);

UpdateWindow(hWnd)

Devuelve VERDADERO;

}

Procesa la tecla ESC en la función de procesamiento de ventana:

cambiar (mensaje)

{

caso WM_KEYDOWN:

cambiar(wParam)

{

caso VK_ESCAPE:

{

HWND hDesk;

RECT rc;

hDesk = GetDesktopWindow();

GetWindowRect( hDesk, &rc );

SetWindowLong( hWnd, GWL_STYLE, WS_BORDER );

SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, rc.right, rc.bottom, SWP_SHOWWINDOW);

}

 romper;

 }

devolver 0;

 }