我不知道这个主题的主题是否有意义。 我正在努力尝试CEF3。 我刚开始使用C ++而且我很难过。对不起。
初始目标是按照本主题中的说明使弹出窗口全屏显示:http://www.magpcss.org/ceforum/viewtopic.php?f=10&t=11706
我也认为这是一种更好的方法:http://magpcss.org/ceforum/viewtopic.php?f=6&t=10772。但是,没有充分的解释。 您认为需要在下面的代码段中添加什么才能使浏览器在基于WINAPI的窗口中运行。
#include <windows.h>
// Source taken here: http://www.winprog.org/tutorial/simple_window.html
const char g_szClassName[] = "MultiscreenProject";
// Step 4: the Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch(msg) {
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
//Full-screen mode
RECT desktop;
// Get a handle to the desktop window
const HWND hDesktop = GetDesktopWindow();
// Get the size of screen to the variable desktop
GetWindowRect(hDesktop, &desktop);
// The top left corner will have coordinates (0,0)
// and the bottom right corner will have coordinates
// (horizontal, vertical)
int horizontal = desktop.right;
int vertical = desktop.bottom;
//Step 1: Registering the Window Class
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if( !RegisterClassEx(&wc) ) {
MessageBox( NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK );
return 0;
}
hwnd = CreateWindowEx(
0,
g_szClassName,
"Multiscreen Project",
WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT, horizontal, vertical,
NULL, NULL, hInstance, NULL
);
if( hwnd == NULL ){
MessageBox( NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK );
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
// Step 3: The Message Loop
while( GetMessage(&Msg, NULL, 0, 0) > 0 ) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
非常感谢。
答案 0 :(得分:2)
我想你需要这样做:
不要忘记将CEF消息的循环集成到您应用的WndProc中:Message_Loop_Integration