
sub SetWinCaption(byval hWin as HWND)

	SetWindowText(hWin,"FreeBASIC editor - " & FileName)

end sub

function CreateEdit(byval hWin as HWND) as HWND
	dim hCtl as HWND

	hCtl=hREd
	hREd=CreateWindowEx(WS_EX_CLIENTEDGE,StrPtr("RAEDIT"),NULL,WS_CHILD or WS_VISIBLE,0,0,0,0,hWin,IDC_RAEDIT,hInstance,0)
	SendMessage(hREd,WM_SETFONT,hFont,FALSE)
	SendMessage(hREd,WM_SETTEXT,0,StrPtr(""))
	SendMessage(hREd,EM_SETMODIFY,FALSE,0)
	SendMessage(hWin,WM_SIZE,0,0)
	ShowWindow(hCtl,SW_HIDE)
	SetFocus(hREd)
	SetWinCaption(hWin)
	CreateEdit=hREd

end function

sub EnableDisable(byval bm as long,byval id as long)
	dim hMnu as HMENU
	dim tmp as long

	hMnu=GetMenu(hWnd)
	if bm then
		tmp=MF_BYCOMMAND or MF_ENABLED
	else
		tmp=MF_BYCOMMAND or MF_GRAYED
	endif
	EnableMenuItem(hMnu,id,tmp)
	if bm then
		bm=TRUE
	endif
	SendDlgItemMessage(hWnd,IDC_TOOLBAR,TB_ENABLEBUTTON,id,bm)
	
end sub

