  format PE

  include "include\win32ax.inc"
  include "..\include\const.inc"

    x_size = 150
    y_size = 80
    x_coord = 100
    y_coord = 100

    EventID_Ctrl3	    = 13

  start:
    call Redraw
  Wait_Event:
    call [WaitMessage]
    call [StdHandler]
    cmp bx, (EventID_Ctrl3 shl 8)+1
    je LoadFileBrowser

  jmp Wait_Event

  Redraw:
    invoke Draw_StdWindow, x_coord*65536+y_coord,x_size*65536+y_size,"GetAddress&Run demo",00101b
    mov     [WinID],eax

   invoke  Create_StdButton,30*65536+40,100*65536+22,"Run Browser",1,10b

    call    [End_of_redraw]
    ret


LoadFileBrowser:
	pusha
	invoke	Get_FileAddress, browser_filename
	cmp	esi,0
	je	file_not_found
	invoke	CreateProcess, esi,ebx,browser_ProcessName
      file_not_found:
	popa
	jmp Wait_Event

data import
;
; Import functions:
;

  library mx32,'mx32.dll'

  import mx32,\
	 WaitMessage,'WaitMessage',\
	 Create_StdButton,'Create_StdButton',\
	 Draw_StdWindow,'Draw_StdWindow',\
	 StdHandler,'StdHandler',\
	 Get_FileAddress,'Get_FileAddress',\
	 CreateProcess,'CreateProcess',\
	 End_of_redraw,'End_of_redraw'
end data

section '.data' data readable writeable
    WinID		  dd 0
    browser_filename		   db 'root.exe',0
    browser_ProcessName 	   db 'Browser',0

