
  $ Filename "t.exe"
  'uses RTL64
  uses COM\COMutil
  uses WebBrowserAtl
  uses winutil

  AtlAxWinInit()

  sys win
  int x,y,w,h
  x=0 : y=10 : w=800 : h=600
  int winstyle,wbstyle
  winstyle = WS_MINMAXSIZE 'or WS_CLIPCHILDREN
  wbstyle = WS_CHILD or WS_VISIBLE or WS_BORDER or WS_VSCROLL or WS_HSCROLL
  sys btt0,btt1,btt2 'buttons
  int b0ID = 100, b1ID=101, b2ID=102,brID=120

  sys hWb
  sys sys_hWnd
  sys sys_hDC

  sys hinst = GetModuleHandle 0

  WindowsRegistrate("Oxygen")

  'main window
  ============
  sys_hwnd = CreateWindowEx(0, "Oxygen", "ATL Browser", winstyle, x, y, w, h, null, 0, hinst, 0)
  win=sys_hwnd

  'browser window
  ===============
  hWb = CreateWindowEx(0, "AtlAxWin", "www.google.com",wbstyle , 64, 40, w-100,(h-56)-64, win, brID, 0, 0)
 
  '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 Idispatch interface
  ===========================
  IDispatch *v,*po
  int er=AtlAxGetControl(hwb, byval @@v)
  v.QueryInterface(IID_IDispatch, byval @@po)
  v.release
  @v=0

  MessageLoop()

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



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

  select hwnd

  case win

    select wmsg
    '
    case WM_SIZE
      RECT rc
      GetClientRect(win,rc)
      MoveWindow(hwb,64, 40, rc.right-100,(rc.bottom-56)-64,1)

    case WM_CLOSE
      DestroyWindow win
      PostQuitMessage 0

    case WM_COMMAND	
      int controlID = LoWord(wParam) 'get control ID
      int notifyCode = HiWord(wParam) 'get notification message
      '
      select controlID
      '
      case b0ID
        if notifycode=0 
          wbstring s="https://www.oxygenbasic.org/forum/index.php"
          CallByName(po,"navigate",s)
          frees s
        end if      
      case b1ID
        if notifycode=0          
          'CallByName(po,"GoBack")
          CmdByName(po,"GoBack")
      end if
      case b2ID
        if notifycode=0          
          'CallByName(po,"GoForward",BSTR{},null)
          CmdByName(po,"GoForward")
        end if
      end select
    end select
  end select
  return DefWindowProc hwnd,wMsg,wParam,lParam
end function
