求高手指教,pb里怎么判断操作系统是多少位的啊?
RT,在网上查了各种治疗,了解到GetSystemInfo 、GetNativeSystemInfo两个函数,但是PB里调用后貌似没法半段啊,还有其他方法没呢?求高手指点迷津
[解决办法]
//====================================================================
// 事件: n_appmanager.of_apifunctionpresent()
//--------------------------------
// 描述:判断API是不否成功
//--------------------------------
// 参数:
// valuestringls_functionname
// valuestringls_dllname
//--------------------------------
// 返回: boolean
//--------------------------------
// 作者:TANGYONG日期: 2012年09月19日
//--------------------------------
//Copyright (c) 2002-2012 TRUEWAY(TM), All rights reserved.
//--------------------------------
// 修改历史:
//
//====================================================================
String ls_pathname,ls_pathname_add
Long ls_ihandle , ls_ihandle1,ls_laddr
Boolean ls_freelib
ls_freelib = False
ls_pathname = Space(255)
ls_ihandle = GetModuleHandle(ls_dllname) //获取一个应用程序或动态链接库的模块句柄
GetSystemDirectory(ls_pathname,255) //获取DLL路径
ls_pathname_add = ls_pathname+'\'+ls_dllname
IF ls_ihandle = 0 THEN
ls_ihandle = LoadLibraryEx(ls_pathname_add, 0, DONT_RESOLVE_DLL_REFERENCES)
ls_freelib = True
END IF
IF ls_ihandle <> 0 THEN
ls_laddr = GetProcAddress(ls_ihandle, ls_functionName)
IF ls_freelib = True THEN
FreeLibrary( ls_ihandle) //用FreeLibrary函数释放DLL
END IF
END IF
IF ls_laddr <> 0 THEN
RETURN True
ELSE
RETURN False
END IF
//====================================================================
// 事件: n_appmanager.of_infoversion64bit()
//--------------------------------
// 描述:判断系统位数
//--------------------------------
// 参数:
//--------------------------------
// 返回: string
//--------------------------------
// 作者:TANGYONG日期: 2012年09月19日
//--------------------------------
//Copyright (c) 2002-2012 TRUEWAY(TM), All rights reserved.
//--------------------------------
// 修改历史:
//
//====================================================================
Long lngret= 1
String strtemp
system_info si
boolean iswow64process , ls_getnativesysteminfo
blniswin64bit= false
iswow64process = of_apifunctionpresent ("IsWow64Process", "kernel32")
ls_getnativesysteminfo = of_apifunctionpresent("GetNativeSystemInfo", "kernel32")
if iswow64process = true then
IsWow64Process( GetCurrentProcess() ,lngret)//获取句柄
if ls_getnativesysteminfo = true and lngret <> 0 then
GetNativeSystemInfo( si)
if si.wprocessorarchitecture = PROCESSOR_ARCHITECTURE_AMD64 or si.wprocessorarchitecture = PROCESSOR_ARCHITECTURE_IA64 THEN//判断系统多少位
strtemp = " 64bits"
blniswin64bit = true
ELSE
strtemp = " 32bits"
END IF
else
strtemp = " 32bits"
end if
else
strtemp = " 32bits"
end if
RETURN strtemp
//获取系统版本信息API函数
FUNCTION ULong GetVersionEx( REF osversioninfoex lpVersionInformation) LIBRARY "kernel32.dll" ALIAS FOR "GetVersionExA;ansi"
FUNCTION ULong GetVersion(REF osversioninf lpVersionInformation) LIBRARY "kernel32.dll" ALIAS FOR "GetVersionExA;ansi"
FUNCTION ULong GetModuleHandle(REF String lpModuleName) LIBRARY "kernel32.dll" ALIAS FOR "GetModuleHandleA;ansi" //获取一个应用程序或动态链接库的模块句柄
FUNCTION ULong LoadLibraryEx(REF String lpLibFileName,ULong hFile,ULong dwFlags) LIBRARY "kernel32.dll" ALIAS FOR "LoadLibraryExA;ansi" //返回库模块句柄
FUNCTION ULong GetProcAddress(ULong hModule,REF String lpProcName) LIBRARY "kernel32.dll" ALIAS FOR "GetProcAddress;ansi" //检索指定的动态链接库(DLL)中的输出库函数地址 加上ansi为api中Unicode与ansi区别
FUNCTION ULong FreeLibrary(ULong hLibModule) LIBRARY "kernel32.dll" //卸载进程模块
FUNCTION ULong GetCurrentProcess() LIBRARY "kernel32.dll" //返回当前进程的句柄
SUBROUTINE IsWow64Process (Long hProcess , REF Long Wow64Process ) LIBRARY "kernel32.dll" //自定义API ,防止系统不是XP以上