rodecomp/Source/Client/Browser/BrowserCreation.cpp
ragnarok-clanker d842cee831 Maintenance: [forced, user-approved] Collapse the Browser port's adapter structs into the original code (follow-up to 30cdd441). Evid
Batch #10110 by ragnarok-clanker: forced by an admin (0 lower score(s), 40 changed function(s)); checked with 495 compiled unit(s), including every includer of Source/Client/Application/ApplicationActivation.h, Source/Client/Application/Launcher.h, Source/Client/Browser/BrowserClientSite.h, Source/Client/Browser/BrowserPopupDispatch.h, Source/Client/Browser/WebBrowser.h, Source/Client/Browser/WebEventReceiver.h, Source/Client/Mode/CLoginMode.h, Source/Client/Mode/CMode.h, Source/Client/Mode/ModeTooltip.h, Source/UI/Window/UIWindowMgr.h, Source/Client/Browser/BrowserAddressBar.h, Source/Client/Browser/BrowserAddressEdit.h, Source/Client/Browser/BrowserClose.h, Source/Client/Browser/BrowserCreation.h, Source/Client/Browser/BrowserCursor.h, Source/Client/Browser/BrowserFactory.h, Source/Client/Browser/BrowserFrame.h, Source/Client/Browser/BrowserHostWindow.h, Source/Client/Browser/BrowserInputHandoff.h, Source/Client/Browser/BrowserInterface.h, Source/Client/Browser/BrowserMessages.h, Source/Client/Browser/BrowserRegistry.h, Source/Client/Browser/BrowserSiteAttachment.h, Source/Client/Browser/BrowserWindowSizing.h, Source/UI/Window/WindowFrameUpdate.h.
Deletes: Source/Client/Browser/BrowserAddressBar.h, Source/Client/Browser/BrowserAddressEdit.h, Source/Client/Browser/BrowserClose.h, Source/Client/Browser/BrowserCreation.h, Source/Client/Browser/BrowserCursor.h, Source/Client/Browser/BrowserFactory.h, Source/Client/Browser/BrowserFrame.h, Source/Client/Browser/BrowserHostWindow.h, Source/Client/Browser/BrowserInputHandoff.h, Source/Client/Browser/BrowserInterface.h, Source/Client/Browser/BrowserMessages.h, Source/Client/Browser/BrowserRegistry.h, Source/Client/Browser/BrowserSiteAttachment.h, Source/Client/Browser/BrowserWindowSizing.h, Source/UI/Window/WindowFrameUpdate.h
2026-11-02 16:41:37 +00:00

46 lines
1.7 KiB
C++

#include "Client/Browser/WebBrowser.h"
#include "Contents/Configuration/ServiceConfiguration.h"
// OFFSET: 0x00AB22B0
// FUNCTION: fn_17413
bool CWebBrowser::Create(HWND parent, HINSTANCE instance, int width, int height) {
const HRESULT result =
CoCreateInstance(CLSID_WebBrowser, nullptr, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, IID_IWebBrowser2, reinterpret_cast<void**>(&this->browser));
if (FAILED(result)) {
OutputDebugStringA("error : MakeWebBrowserInterface_InProc FAILED \n");
HLOCAL message = nullptr;
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0,
reinterpret_cast<char*>(&message), 0, nullptr
);
OutputDebugStringA(static_cast<const char*>(LocalLock(message)));
return false;
}
if (this->browser) {
this->browser->get_HWND(reinterpret_cast<SHANDLE_PTR*>(&this->browserWindow));
}
WNDCLASSEXA windowClass{};
windowClass.cbSize = sizeof(windowClass);
windowClass.lpfnWndProc = BrowserHostProc;
windowClass.hInstance = instance;
windowClass.hIcon = LoadIconA(instance, MAKEINTRESOURCEA(123));
windowClass.lpszClassName = "ROWebBrowser";
RegisterClassExA(&windowClass);
this->host = CreateWindowExA(0, "ROWebBrowser", g_windowName, WS_POPUP | WS_OVERLAPPEDWINDOW, 0, 0, width, height, parent, nullptr, instance, nullptr);
if (!this->host) {
OutputDebugStringA("failed : CreateWindow() \n");
return false;
}
UpdateWindow(this->host);
SetParent(this->browserWindow, this->host);
SetWindowLongA(this->browserWindow, GWL_STYLE, WS_CHILD);
if (!this->AttachSite()) {
return false;
}
return this->CreateAddressBar(width, 22);
}