forked from ReneNyffenegger/cpp-MSHTML
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLWindow2.cpp
More file actions
636 lines (519 loc) · 19.8 KB
/
HTMLWindow2.cpp
File metadata and controls
636 lines (519 loc) · 19.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
/*
HTMLWindow.cpp
Copyright (C) 2003-2004 René Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
#include "HTMLWindow2.h"
#include <ExDispId.h>
#include <stdio.h>
HWND todo_hwnd;
#include "OleClientSite.h"
#include "Storage.h"
#include "OleInPlaceSite.h"
#include "OleInPlaceFrame.h"
#include "DocHostUiHandler.h"
#include "todoMoveSrc/Tracer.h"
#include <string>
#include <map>
#include "todoMoveSrc/VariantHelper.h"
#include "todoMoveSrc/UrlHelper.h"
bool todo_bool=false;
std::string IIDAsString (REFIID riid) {
char buf[33];
for (int i=0;i<16; i++) {
sprintf(buf + i*2, "%02x", *(((char*)&riid) + i));
}
return buf;
};
bool HTMLWindow::ole_is_initialized_ = false;
const IID IID_IDocHostUIHandler ={0xbd3f23c0,0xd43e,0x11CF,{0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a}};
// TODO raus mit dem
static const SAFEARRAYBOUND ArrayBound = {1, 0};
HTMLWindow::HTMLWindow(
EventReceiver* r,
std::string const& title,
HINSTANCE instance,
std::string const&
first_link,
std::map<std::string, std::string> const& first_params)
: instance_(instance),
browserObject_(0),
event_receiver_(r)
{
TraceFunc("HTMLWindow::HTMLWindow");
InitOle_CreateWindow(title);
std::string first_html_page; /* start page */
Trace("Going to call event_receiver_->AppLink");
if (event_receiver_) event_receiver_->AppLink(first_link, first_html_page, first_params);
Trace("called event_receiver_->#A(AppLink,#AppLink)");
DWORD todo_del_me_1;
HANDLE todo_del_me = ::CreateFile("some.html", GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
WriteFile(todo_del_me, first_html_page.c_str(), first_html_page.size(), &todo_del_me_1, 0);
::CloseHandle(todo_del_me);
HTML(first_html_page);
}
HTMLWindow::HTMLWindow(std::string const& html_or_url,
std::string const& title,
HINSTANCE instance,
bool is_url) :
instance_(instance),
browserObject_(0),
event_receiver_(0){
InitOle_CreateWindow(title);
if (is_url) URL (html_or_url);
else HTML(html_or_url);
}
void HTMLWindow::InitOle_CreateWindow(std::string const& title) {
TraceFunc("HTMLWindow::InitOle_CreateWindow");
if (!ole_is_initialized_) {
/* An application, when initializing the WebBrowser Control, should use
OleInitialize rather than CoInitialize to start COM. OleInitialize
enables support for the clipboard, drag-and-drop, OLE, and in-place
activation. Use OleUninitialize to close the COM library when your
application shuts down. */
if (::OleInitialize(0) != S_OK) {
return;
}
ole_is_initialized_ = true;
}
WNDCLASSEX wc;
::ZeroMemory (&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.hInstance = instance_;
wc.lpfnWndProc = this->WindowProc;
wc.lpszClassName = "subkdls490";
RegisterClassEx(&wc);
hwnd_ = ::CreateWindowEx(0, "subkdls490", title.c_str(), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
HWND_DESKTOP , 0,
instance_ , 0);
todo_hwnd=hwnd_;
if (hwnd_) {
SetWindowLong(hwnd_, GWL_USERDATA, (LONG)this);
if (EmbedBrowserObject()) return;
AddSink();
ShowWindow(hwnd_, SW_SHOWNORMAL);
UpdateWindow(hwnd_);
}
}
HTMLWindow::~HTMLWindow () {
if (ole_is_initialized_) {
::OleUninitialize();
ole_is_initialized_ = false;
}
}
HRESULT HTMLWindow::QueryInterface(REFIID riid, void ** ppvObject) {
TraceFunc("HTMLWindow::QueryInterface");
std::string s = IIDAsString(riid);
if (!memcmp((const void*) &riid, (const void*)&IID_IUnknown, sizeof(GUID)) ||
!memcmp((const void*) &riid, (const void*)&IID_IDispatch, sizeof(GUID)) ||
!memcmp((const void*) &riid, (const void*)&IID_IDocHostUIHandler, sizeof(GUID))) {
TraceFunc("HTMLWindow::QueryInterface");
*ppvObject = doc_host_ui_handler_;
return S_OK;
}
ppvObject = 0;
return E_NOINTERFACE;
}
/*
This method displays the HTML that is passed as a string.
*/
long HTMLWindow::HTML(std::string const& html_txt) {
IWebBrowser2 *webBrowser2;
LPDISPATCH lpDispatch;
IHTMLDocument2 *htmlDoc2;
SAFEARRAY *sfArray;
VARIANT *pVar;
BSTR bstr;
static bool todo_about_blank_written_once = false;
// Assume an error.
bstr = 0;
TraceFunc("HTMLWindow::HTML");
Trace("going to DisplayHTMLPage with about:blank");
if (!todo_about_blank_written_once) {
URL("about:blank");
todo_about_blank_written_once = true;
}
if (!browserObject_->QueryInterface(IID_IWebBrowser2, (void**)&webBrowser2)) {
if (!webBrowser2->get_Document( &lpDispatch)) {
if (!lpDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&htmlDoc2)) {
/* The HTML passed to IHTMLDocument2::write must be a
BSTR within an array of VARIANTs.... */
if ((sfArray = SafeArrayCreate(VT_VARIANT, 1, (SAFEARRAYBOUND *)&ArrayBound))) {
if (!SafeArrayAccessData(sfArray, (void**)&pVar)) {
pVar->vt = VT_BSTR;
#ifndef UNICODE
{
wchar_t *buffer;
DWORD size;
size = MultiByteToWideChar(CP_ACP, 0, html_txt.c_str(), -1, 0, 0);
if (!(buffer = (wchar_t *)GlobalAlloc(GMEM_FIXED, sizeof(wchar_t) * size))) goto todo_bad;
MultiByteToWideChar(CP_ACP, 0, html_txt.c_str(), -1, buffer, size);
bstr = SysAllocString(buffer);
GlobalFree(buffer);
}
#else
bstr = SysAllocString(html_txt);
#endif
if ((pVar->bstrVal = bstr)) {
Trace("Going to actually write sfArray into html document");
if (htmlDoc2->write(sfArray) != S_OK) {
throw ("Could not write sfArray");
}
/*
If the document were not closed, subsequent calls to
DisplayHTMLStr would append to the contents of the page.
*/
htmlDoc2->close();
Trace("Closing document");
}
}
/*
Freeing the array along with the VARIANT that SafeArrayAccessData
created and the BSTR that was allocated with SysAllocString
*/
SafeArrayDestroy(sfArray);
}
todo_bad: htmlDoc2->Release();
}
lpDispatch->Release();
}
webBrowser2->Release();
}
// bstr <> 0 indicates no error
if (bstr) return 0;
return(-1);
}
long HTMLWindow::EmbedBrowserObject() {
IWebBrowser2 *webBrowser2;
RECT rect;
// RENE
#define OLERENDER_DRAW 1
storage_ = new Storage;
// 2018-12-06 ole_in_place_frame_ = new OleInPlaceFrame;
ole_in_place_frame_ = new OleInPlaceFrame(hwnd_);
ole_in_place_site_ = new OleInPlaceSite(ole_in_place_frame_, hwnd_);;
doc_host_ui_handler_= new DocHostUiHandler(this);
ole_client_site_ = new OleClientSite(
ole_in_place_site_,
doc_host_ui_handler_,
static_cast<DWebBrowserEvents2*>(this));
// todo
dynamic_cast<DocHostUiHandler*>(doc_host_ui_handler_)->ClientSite(ole_client_site_);
dynamic_cast<OleInPlaceSite* >(ole_in_place_site_ )->ClientSite(ole_client_site_);
if (! ::OleCreate(
CLSID_WebBrowser,
IID_IOleObject,
OLERENDER_DRAW,
0,
ole_client_site_,
storage_,
(void**)&browserObject_)) {
//todo
dynamic_cast<OleInPlaceSite*>(ole_in_place_site_)->BrowserObject(browserObject_);
//browser_object_todo = (void*) browserObject;
browserObject_->SetHostNames(L"Some_host_name", 0);
GetClientRect(hwnd_, &rect);
// The browser is embedded in an OLE container.
if (!OleSetContainedObject(static_cast<IUnknown*>(browserObject_), TRUE) &&
// Setting the display area of the browser control
!browserObject_->DoVerb(OLEIVERB_SHOW, NULL,
ole_client_site_,
-1, hwnd_, &rect) &&
!browserObject_->QueryInterface(IID_IWebBrowser2, reinterpret_cast<void**> (&webBrowser2) )
)
{
webBrowser2->put_Left (0);
webBrowser2->put_Top (0);
webBrowser2->put_Width (rect.right);
webBrowser2->put_Height(rect.bottom);
webBrowser2->Release();
return 0;
}
::MessageBox(0, "Something went wrong -3", 0, 0);
/* Something went wrong!
TODO UnEmbedBrowserObject(hwnd_); */
return(-3);
}
::MessageBox(0, "Something went wrong -2", 0, 0);
return -2 ;
}
void HTMLWindow::ResizeBrowser(HWND hwnd, DWORD width, DWORD height) {
IWebBrowser2 *webBrowser2;
if (!browserObject_->QueryInterface(IID_IWebBrowser2, (void**)&webBrowser2)) {
webBrowser2->put_Width(width);
webBrowser2->put_Height(height);
webBrowser2->Release();
}
else {
::MessageBox(0, "Couldn't query interface for IID_IWebBrowser2", 0, 0);
}
}
HRESULT HTMLWindow::Invoke(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS FAR* pDispParams,
VARIANT FAR* pVarResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr) {
/*
_______________
From ExDispid.h
---===============---
The constants passed through dispIdMember seem to be defined in ExDispId.h.
However, in the MinGw distribution, only a few are defined, much less than
in Microsofts Platform SDK.
So, I am defininig those that I need here....
*/
#define DISPID_BEFORENAVIGATE 100 // this is sent before navigation to give a chance to abort
#define DISPID_COMMANDSTATECHANGE 105
#define DISPID_NAVIGATECOMPLETE2 252 // UIActivate new document
#define DISPID_NAVIGATEERROR 271 // Fired to indicate the a binding error has occured
#define DISPID_DOWNLOADCOMPLETE 104
#define DISPID_DOWNLOADBEGIN 106
#define DISPID_PROPERTYCHANGE 112 // sent when the PutProperty method is called
#define DISPID_SETSECURELOCKICON 269 // sent to suggest the appropriate security icon to show
//#define DISPID_PROGRESSCHANGE 108 // sent when download progress is updated
switch (dispIdMember) {
case DISPID_BEFORENAVIGATE : // this is sent before navigation to give a chance to abort
::MessageBox(0, "Before Navigate", 0, 0);
return S_OK;
break;
// case DISPID_NAVIGATECOMPLETE : // in async, this is sent when we have enough to show
//
// ::MessageBox(0, "Download complete", 0, 0);
// break;
case DISPID_STATUSTEXTCHANGE :
//case DISPID_QUIT :
case DISPID_DOWNLOADCOMPLETE:
return S_OK;
case DISPID_COMMANDSTATECHANGE :
return S_OK;
break;
case DISPID_DOWNLOADBEGIN :
return S_OK;
break;
//case DISPID_NEWWINDOW : // sent when a new window should be created
case DISPID_PROGRESSCHANGE : // sent when download progress is updated
//case DISPID_WINDOWMOVE : // sent when main window has been moved
//case DISPID_WINDOWRESIZE : // sent when main window has been sized
//case DISPID_WINDOWACTIVATE : // sent when main window has been activated
case DISPID_PROPERTYCHANGE: { // sent when the PutProperty method is called
VARIANT a = pDispParams->rgvarg[0];
return S_OK;
}
case DISPID_TITLECHANGE : // sent when the document title changes
//case DISPID_TITLEICONCHANGE : // sent when the top level window icon may have changed.
//case DISPID_FRAMEBEFORENAVIGATE :
//case DISPID_FRAMENAVIGATECOMPLETE :
//case DISPID_FRAMENEWWINDOW :
return S_OK;
break;
case DISPID_BEFORENAVIGATE2: { // hyperlink clicked on
TraceFunc("DWebBrowserEvents2::BeforeNavigate2 ");
VARIANT arg_6 = pDispParams->rgvarg[0];
std::string type = VariantTypeAsString(arg_6);
return S_OK;
}
break;
case DISPID_NEWWINDOW2:
return S_OK;
case DISPID_NAVIGATECOMPLETE2: // UIActivate new document
return S_OK;
break;
//case DISPID_ONQUIT :
//case DISPID_ONVISIBLE : // sent when the window goes visible/hidden
//case DISPID_ONTOOLBAR : // sent when the toolbar should be shown/hidden
//case DISPID_ONMENUBAR : // sent when the menubar should be shown/hidden
//case DISPID_ONSTATUSBAR : // sent when the statusbar should be shown/hidden
//case DISPID_ONFULLSCREEN : // sent when kiosk mode should be on/off
case DISPID_DOCUMENTCOMPLETE : // new document goes ReadyState_Complete
//AddSink();
return S_OK;
//case DISPID_ONTHEATERMODE : // sent when theater mode should be on/off
//case DISPID_ONADDRESSBAR : // sent when the address bar should be shown/hidden
//case DISPID_WINDOWSETRESIZABLE : // sent to set the style of the host window frame
//case DISPID_WINDOWCLOSING : // sent before script window.close closes the window
//case DISPID_WINDOWSETLEFT : // sent when the put_left method is called on the WebOC
//case DISPID_WINDOWSETTOP : // sent when the put_top method is called on the WebOC
//case DISPID_WINDOWSETWIDTH : // sent when the put_width method is called on the WebOC
//case DISPID_WINDOWSETHEIGHT : // sent when the put_height method is called on the WebOC
//case DISPID_CLIENTTOHOSTWINDOW : // sent during window.open to request conversion of dimensions
//case DISPID_SETSECURELOCKICON : // sent to suggest the appropriate security icon to show
//case DISPID_FILEDOWNLOAD : // Fired to indicate the File Download dialog is opening
case DISPID_NAVIGATEERROR: { // Fired to indicate the a binding error has occured
char buf[200];
VARIANT StatusCode=*((pDispParams->rgvarg[1]).pvarVal);
sprintf(buf, "Navigate Error, code is: %d", static_cast<int>(StatusCode.lVal));
MessageBox(0, buf, 0, 0);
//case DISPID_PRIVACYIMPACTEDSTATECHANGE : // Fired when the user's browsing experience is impacted
return S_OK;
}
default:
char buf[50];
sprintf(buf, "invoke, dispid: %d", static_cast<int>(dispIdMember));
if (todo_bool) ::MessageBox(0, buf, 0, 0);
return DISP_E_MEMBERNOTFOUND;
}
}
void HTMLWindow::AddSink() {
TraceFunc("HTMLWindow::AddSink");
IConnectionPointContainer* cpc;
IConnectionPoint* cp;
if (!browserObject_) {
::MessageBox(0, "browserObject_ is null in AddSink", 0, 0);
return;
}
std::string s = IIDAsString(IID_IUnknown);
if (browserObject_->QueryInterface(IID_IConnectionPointContainer, reinterpret_cast<void**>(&cpc)) == S_OK) {
if (cpc->FindConnectionPoint(DIID_DWebBrowserEvents2, &cp) == S_OK) {
// TODO: Member Var
unsigned long cookie = 1;
if (! (SUCCEEDED(cp->Advise(static_cast<IDispatch*>(this), &cookie)) ) ) {
::MessageBox(0, "Advise failed", 0, 0);
}
}
else {
::MessageBox(0, "FindConnectionPoint", 0, 0);
}
}
else {
::MessageBox(0, "QueryInterface for IID_IConnectionPointContainer", 0, 0);
}
}
LRESULT CALLBACK HTMLWindow::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_SIZE: {
HTMLWindow* win = reinterpret_cast<HTMLWindow*> (::GetWindowLong(hwnd, GWL_USERDATA));
if (win) {
win->ResizeBrowser(hwnd, LOWORD(lParam), HIWORD(lParam));
}
return 0;
}
case WM_CREATE: {
return 0;
}
case WM_DESTROY: {
PostQuitMessage(0);
return TRUE;
}
case WM_KEYDOWN: {
TraceFunc("WM_KEYDOWN in HTMLWindow");
Trace2("wParam: ", wParam);
if (wParam == VK_TAB) {
/*
The following code is necessary to enable 'tabulator navigating' in forms.
See also http://www.microsoft.com/0499/faq/faq0499.asp
and the SendMessage part in the MessageLoop
*/
IOleInPlaceActiveObject* ipao;
IWebBrowser2 *webBrowser2;
HTMLWindow* win = reinterpret_cast<HTMLWindow*> (::GetWindowLong(hwnd, GWL_USERDATA));
if (win) {
if (!win->browserObject_->QueryInterface(IID_IWebBrowser2, (void**)&webBrowser2)) {
webBrowser2->QueryInterface(IID_IOleInPlaceActiveObject, reinterpret_cast<void**>(&ipao));
if (ipao) {
MSG m;
m.message=WM_KEYDOWN;
m.wParam = wParam;
m.lParam = lParam;
m.hwnd = hwnd;
ipao->TranslateAccelerator(&m);
}
else {
::MessageBox(0, "Failed to retrieve IOleInPlaceActiveObject in WM_KEYDOWN", 0, 0);
}
}
return 0;
}
else {
::MessageBox(0, "Failed to retrieve webBrowser2 in WM_KEYDOWN", 0, 0);
}
return -1;
}
break;
}
case WM_APP: {
TraceFunc("WM_APP called");
HTMLWindow* win = reinterpret_cast<HTMLWindow* >(::GetWindowLong(hwnd, GWL_USERDATA));
std::string* path_with_params = reinterpret_cast<std::string*>(wParam);
std::string path;
std::map<std::string,std::string> params;
Trace(std::string("path_with_params: ") + *path_with_params);
SplitGetReq(*path_with_params, path, params);
Trace(std::string("path: ") + path);
std::string out_html;
if (win->event_receiver_) win->event_receiver_->AppLink(path, out_html, params);
/*
DWORD todo_del_me_1;
HANDLE todo_del_me = ::CreateFile("some.html", GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
WriteFile(todo_del_me, out_html.c_str(), out_html.size(), &todo_del_me_1, 0);
::CloseHandle(todo_del_me);
*/
win->HTML(out_html);
// url is allocated in DOCHostHandler.cpp
Trace("going to delete url");
//delete url;
delete path_with_params;
// param_map is allocated in DOCHostHandler.cpp
Trace("going to delete param_map");
//delete param_map;
Trace("param_map deleted");
return 0;
}
}
return(DefWindowProc(hwnd, uMsg, wParam, lParam));
}
/*
This method shows an URL
*/
long HTMLWindow::URL(std::string const& url) {
IWebBrowser2 *webBrowser2;
VARIANT myURL;
TraceFunc("HTMLWindow::URL");
Trace( (std::string("url is: ") + url).c_str());
if (!browserObject_->QueryInterface(IID_IWebBrowser2, (void**)&webBrowser2)) {
VariantInit(&myURL);
myURL.vt = VT_BSTR;
#ifndef UNICODE
{
wchar_t *buffer;
DWORD size;
size = MultiByteToWideChar(CP_ACP, 0, url.c_str(), -1, 0, 0);
if (!(buffer = (wchar_t *)GlobalAlloc(GMEM_FIXED, sizeof(wchar_t) * size))) goto badalloc;
MultiByteToWideChar(CP_ACP, 0, url.c_str(), -1, buffer, size);
myURL.bstrVal = SysAllocString(buffer);
GlobalFree(buffer);
}
#else
myURL.bstrVal = SysAllocString(url);
#endif
if (!myURL.bstrVal) {
badalloc: webBrowser2->Release();
return(-6);
}
// Navigate2 displays the page
webBrowser2->Navigate2(&myURL, 0, 0, 0, 0);
VariantClear(&myURL);
webBrowser2->Release();
return 0 ;
}
Trace("Something went wrong, returning -5");
return(-5);
}