#include once "window9.bi"

#ifdef UNICODE
	Function GetCurrentFileName() As USTRING Export
		dim as USTRING wsRet = WSPACE(512)
		GetModuleFileName(0,cast(any ptr , *wsRet),512)
		wsRet = GetFilePart(wsRet)
		Return wsRet
	End Function
	
	Function GetCurrentFileNameA() As USTRING Export
		dim as USTRING wsRet = WSPACE(512)
		GetModuleFileName(0,cast(any ptr , *wsRet),512)
		wsRet = GetFilePart(wsRet)
		wsRet = ReplaceString(wsRet,".exe","")
		return wsRet
	End Function	
#else	
	Function GetCurrentFileName() As USTRING Export
		Dim As USTRING*512 sTemp
		GetModuleFileName(0,Cast(LPSTR,@sTemp),512)
		Return GetFilePart(sTemp)
	End Function
	
	Function GetCurrentFileNameA() As USTRING Export
		Dim As USTRING*512 sTemp
		GetModuleFileName(0,Cast(LPSTR,@sTemp),512)
		Return ReplaceString(GetFilePart(sTemp),".exe","")
	End Function	
#EndIf

