I'm trying to build a simple win32 application with CEF in it.
Yesterday i was struggling with a tons of errors.
I downloaded 64bit CEF binary, i was changing progect properties from win32 to x64, downloading and installing last SDK for win 7 (i'm using VC++ 2010 Express), getting errors again, realising that i'm on Win 8 (doh) and installing SDK for 8, i was building cefclient app to get win_dll_wrapper.lib, then took libcef.lib and ..wrapper.lib to my progect folder and link VC to them, now as all windows header and x64 related errors are gone i'm struck at this:
- Code: Select all
1> Testing2.cpp
1>c:\users\max\documents\visual studio 2010\projects\testing\testing\include/cef_dom.h(274): warning C4003: not enough actual parameters for macro 'GetNextSibling'
1>c:\users\max\documents\visual studio 2010\projects\testing\testing\include/cef_dom.h(274): error C2059: syntax error : ','
1>c:\users\max\documents\visual studio 2010\projects\testing\testing\include/cef_dom.h(286): warning C4003: not enough actual parameters for macro 'GetFirstChild'
My code:
- Code: Select all
#include <Windowsx.h>
#include "include/cef_app.h"
#include "bareboneshandler.h"
#pragma comment(lib,"user32.lib")
CefRefPtr<BareBonesHandler> cf_handler;
LRESULT CALLBACK WinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrevInst,LPSTR lpCmdLine,int nShowCmd)
{
WNDCLASSEX wClass;
CefSettings settings;
cf_handler = new BareBonesHandler();
CefMainArgs main_args(hInst);
ZeroMemory(&wClass,sizeof(WNDCLASSEX));
wClass.cbClsExtra=NULL;
wClass.cbSize=sizeof(WNDCLASSEX);
wClass.cbWndExtra=NULL;
wClass.hbrBackground=(HBRUSH)COLOR_WINDOW;
wClass.hCursor=LoadCursor(NULL,IDC_ARROW);
wClass.hIcon=NULL;
wClass.hIconSm=NULL;
wClass.hInstance=hInst;
wClass.lpfnWndProc=(WNDPROC)WinProc;
wClass.lpszClassName="Window Class";
wClass.lpszMenuName=NULL;
wClass.style=CS_HREDRAW|CS_VREDRAW;
if(!RegisterClassEx(&wClass))
{
int nResult=GetLastError();
MessageBox(NULL,
"Window class creation failed",
"Window Class Failed",
MB_ICONERROR);
}
int exitCode = CefExecuteProcess(main_args, NULL);
if (exitCode >= 0) {
return exitCode;
}
CefInitialize(main_args, settings, NULL);
HWND hWnd=CreateWindowEx(NULL,
"Window Class",
"Testing Window",
WS_OVERLAPPEDWINDOW,
200,
200,
1280,
768,
NULL,
NULL,
hInst,
NULL);
if(!hWnd)
{
int nResult=GetLastError();
MessageBox(NULL,
"Window creation failed",
"Window Creation Failed",
MB_ICONERROR);
}
ShowWindow(hWnd,nShowCmd);
MSG msg;
ZeroMemory(&msg,sizeof(MSG));
CefRunMessageLoop();
CefShutdown();
return 0;
}
LRESULT CALLBACK WinProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
{
CefQuitMessageLoop();
PostQuitMessage(0);
return 0;
}
break;
case WM_CREATE:
{
RECT rect;
GetClientRect(hWnd, &rect);
CefWindowInfo info;
info.SetAsChild(hWnd, rect);
CefBrowserSettings settings;
CefBrowserHost::CreateBrowserSync(info, cf_handler.get(),
"http://code.google.com", settings);
}
break;
case WM_COMMAND:
{
}
break;
}
return DefWindowProc(hWnd,msg,wParam,lParam);
}