seems to work, but now I cannot correctly select text in the html file.
I now use the following code which seems to work fairly good.
Code: Select all
Prototype.i WinApiAtlAxCreateControl(lpszName.p-unicode, hWnd,*pStream.IStream, *ppUnkContainer.Integer)
Prototype.i WinApiCreateWindowExA(dwExStyle.i, lpClassName.i, lpWindowName.i, dwStyle, x, y , nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
Global WinApi_AtlAxCreateControl.WinApiAtlAxCreateControl
Global WinApi_CreateWindowExA.WinApiCreateWindowExA
Procedure __Hooked_OleInitialize(reserved)
ProcedureReturn #S_OK
EndProcedure
Procedure __CBStatic(hWnd, Message, WParam, LParam)
If Message = #WM_CTLCOLORSTATIC
SetBkMode_(wParam, #TRANSPARENT)
ProcedureReturn GetStockObject_(#HOLLOW_BRUSH)
Else
If GetProp_(hWnd, "OldCB")
ProcedureReturn CallWindowProc_(GetProp_(hWnd, "OldCB"), hWnd, Message, WParam, LParam)
Else
ProcedureReturn DefWindowProc_(hWnd, Message, WParam, LParam)
EndIf
EndIf
EndProcedure
Procedure __Hooked_CreateWindowEx(dwExStyle.i, lpClassName.i, lpWindowName.i, dwStyle, x, y , nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
If lpClassName <> #Null
If PeekS(lpClassName) = "AtlAxWin"
hWnd = WinApi_CreateWindowExA(0, @"static", @"", #WS_CHILD | #WS_VISIBLE | #WS_CLIPCHILDREN, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
SetProp_(hWnd, "OldCB", GetWindowLong_(hWnd, #GWL_WNDPROC))
SetWindowLong_(hWnd, #GWL_WNDPROC, @__CBStatic())
WinApi_AtlAxCreateControl("Shell.Explorer.1", hWnd, 0, @Container.IUnknown)
ProcedureReturn hWnd
EndIf
EndIf
ProcedureReturn WinApi_CreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
EndProcedure
hAtl = LoadLibrary_("atl.dll")
hUser = LoadLibrary_("user32.dll")
If hAtl And hUser
WinApi_AtlAxCreateControl = GetProcAddress_(hAtl, "AtlAxCreateControl")
WinApi_AtlAxGetControl = GetProcAddress_(hAtl, "AtlAxGetControl")
WinApi_CreateWindowExA = GetProcAddress_(hUser, "CreateWindowExA")
If WinApi_AtlAxCreateControl And WinApi_CreateWindowExA ; only if possible...
!extrn __imp__OleInitialize@4
!MOV eax,__imp__OleInitialize@4
!MOV [v__g_imp__OleInitialize],eax
_g_new_imp_OleInitialize = @__Hooked_OleInitialize()
WriteProcessMemory_(GetCurrentProcess_(), _g_imp__OleInitialize, @_g_new_imp_OleInitialize, SizeOf(Integer), #Null)
!extrn __imp__CreateWindowExA@48
!MOV eax,__imp__CreateWindowExA@48
!MOV [v__g_imp__CreateWindowEx],eax
_g_new_imp_CreateWindowEx = @__Hooked_CreateWindowEx()
WriteProcessMemory_(GetCurrentProcess_(), _g_imp__CreateWindowEx, @_g_new_imp_CreateWindowEx, SizeOf(Integer), #Null)
EndIf
EndIf
CoInitialize_(0)
If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 10, 10, 580, 280, "http://www.purebasic.com")
; Note: if you want to use a local file, change last parameter to "file://" + path + filename
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
If hAtl
FreeLibrary_(hAtl)
EndIf
If hUser
FreeLibrary_(hUser)
EndIf