'gui-skeleton app
$ Filename "t.exe"
'uses RTL64
uses COM\COMutil
uses WebBrowserAtl
uses awinh


#lookahead 
INT win,win2
INT x,y,w,h,x2,y2,w2,h2
x=0:y=10:w=800:h=600
x2=410:y2=10:w2=400:h2=300
INT winstyle,wstyle2,wbstyle
winstyle = WS_MINMAXSIZE or WS_CLIPCHILDREN 
wbstyle = WS_CHILD or WS_VISIBLE or WS_BORDER or WS_VSCROLL or WS_HSCROLL
INT btt0,btt1,btt2
INT b0ID = 100, b1ID=101, b2ID=102


% WM_FORWARDMSG = &H37F ' (895)

% IDB_BACK = 1001
% IDB_FWRD = 1002
% IDB_NAVG = 1003
% IDC_URL  = 1004
% IDC_WB   = 1005

'extern lib "ATL.dll"
'! AtlAxWinInit() as int
''! AtlAxWinTerm() as int
'! AtlAxGetControl( sys hWnd, pp ) as int
'end extern

int hWb

AtlAxWinInit()

'create window
'
win = SetWindow("ATL:Browser",x,y,w,h,0,winstyle)

'create buttons
int style=WS_CHILD | BS_TEXT | BS_PUSHBOX | WS_VISIBLE
btt0=CreateWindowEx(0,"button", "O2", style,  64,4,30,30,  win, b0ID, 0, null)
btt1=CreateWindowEx(0,"button", "<--", style,  98,4,30,30, win, b1ID, 0, null)
btt2=CreateWindowEx(0,"button", "-->", style, 134,4,30,30, win, b2ID, 0, null)



'create browser window
hWb = CreateWindowEx(0, "AtlAxWin", "www.google.com",wbstyle , 64, 40, w-100,(h-56)-64, win, IDC_WB, 0, 0)
'iwebbrowser2 interface
'https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa752127(v=vs.85)
'exdisp.h
IUnknown *v
int er=AtlAxGetControl  ( hwb, @@v )
CreateGuid g1 "EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B" 'WebBrowser interface
CreateGuid g2 "D30C1661-CDAF-11d0-8A3E-00C04FC9E26E" 'WebBrowser2 interface
IWebBrowser2 *po
er=v.QueryInterface(g2,byval @@po)
v.Release
@v=0

wait()

'close
po.Release
'AtlAxWinTerm()
=0
end

function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
==============================================================
select hwnd

case win

  select wmsg
  '
  case WM_CLOSE
    DestroyWindow win
    PostQuitMessage 0
  case WM_SIZE
    GetSize(win,0,0,w,h)
    MoveWindow(hWb,64, 40, w-100,(h-56)-64,1)
  case WM_COMMAND	
    controlID = LoWord(wParam) 'get control ID
    notifyCode = HiWord(wParam) 'get notification message
    '
    select controlID
    '
    case b0ID
      if notifycode=0 
        'short a=3         
        'er=po.get_StatusBar(@a)
        'print a
        'po.put_StatusBar(0)
        wbstring s="http://www.jose.it-berater.org/smfforum/index.php?board=154.0"
        er=po.Navigate s,0,0,0,0
        'er=po.get_LocationURL @s
        'er=po.get_LocationName @s
        'er=po.get_Name @s
        'er=po.get_FullName @s
        'print  " " er ", " s
        'frees s
        sys h
        'po.get_HWND @h
        po.get_Width @h
        po.put_Left 100
        'print h 
        'po.Refresh	
      end if      
    case b1ID
      if notifycode=0          
        po.GoBack
      end if
    case b2ID
      if notifycode=0          
        po.GoForward
      end if
       'po.Quit
       po.put_FullScreen 0xffff
       'po.put_Visible 0
       'po.goHome
    end select
  end select
end select

return default

end function