调用API函数设计ABOUT窗口

2018-06-17 17:15:39来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

Windows98系统的许多软件中都包含一个windows风格的about窗口,它向用户反映了当前系统的一些基本信息,其中显示有关windows及其应用软件的版本、版权和系统的工作状态等信息。笔者用VB6.0通过调用API函数设计应用系统的ABOUT窗口。

1.建立含有如下控件的窗体:

控件NAMECAPTION
窗体FORM1用VB6.0设计ABOUT窗口命令按钮COMMAND1关于销售管理系统

2.程序清单:

PrivateDeclareFunctionGetWindowWordLib"user32"
(ByValhwndAsLong,ByValnIndexAsLong)AsInteger

PrivateDeclareFunctionShellAboutLib
"shell32.dll"Alias"ShellAboutA"(ByValhwndAsLong,
ByValszAppAsString,ByValszOtherStuffAsString,
ByValhIconAsLong)AsLong

PrivateDeclareFunctionExtractIconLib
"shell32.dll"Alias"ExtractIconA"(ByValhinstAsLong,
ByVallpszExeFileNameAsString,ByValnIconIndexAs
Long)AsLongPrivateDeclareFunctionGetDiskFreeSpace
Lib"kernel32"Alias"GetDiskFreeSpaceA"(ByVal
lpRootPathNameAsString,lpSectorsPerClusterAsLong,
lpBytesPerSectorAsLong,lpNumberOfFreeClustersAs
Long,lpTotalNumberOfClustersAsLong)AsLongPrivate
DeclareFunctionGetDriveTypeLib"kernel32"Alias
"GetDriveTypeA"(ByValnDriveAsString)AsLong

PrivateDeclareSubGetSystemInfoLib"kernel32"
(lpSystemInfoAsSYSTEM_INFO)PrivateDeclareFunction
GetSystemMetricsLib"user32"(ByValnIndexAsLong)As
Long

PrivateConstGWL_EXSTYLE=(-20)
PrivateConstGWL_STYLE=(-16)
PrivateConstGWL_WNDPROC=(-4)
PrivateConstGWL_HINSTANCE=(-6)
PrivateTypeSYSTEM_INFO
dwOemIDAsLong
dwPageSizeAsLong
lpMinimumApplicationAddressAsLong
lpMaximumApplicationAddressAsLong
dwActiveProcessorMaskAsLong
dwNumberOrfProcessorsAsLong
dwProcessorTypeAsLong
dwAllocationGranularityAsLong
dwReservedAsLong
EndType
PrivateConstSM_CXSCREEN=0
PrivateConstSM_CYSCREEN=1

PrivateSubCommand1_Click()
DimhinstAsLong
DimiconsAsLong
DimaboutsAsLong
DimdispxAsString
DimdispyAsString
DimcpsAsString
Dimspace1AsString
Dimspace2AsString
hinst=GetWindowWord(Me.hwnd,GWL_HINSTANCE)
icons=ExtractIcon(hinst,"d:fpw26foxprow.exe",0)
DimsysinfoAsSYSTEM_INFO
Dimcls1AsLong
Dimcls2AsLong
DimsecsAsLong
DimbytesAsLong
DimbuffsAsString
buff="C:"
x=GetDriveType(buffs)
x=GetDiskFreeSpace(buffs,secs,bytes,cls1,cls2)
cls1=cls1*secs*bytes
cls2=cls2*secs*bytes
space1="C驱动器总共容量:" Format$(cls2/1024,"#,#") "千字节"
space2="C驱动器可用容量:
" Format$(cls1/1024,"#,#") "千字节"
x=GetSystemMetrics(SM_CXSCREEN)
dispx="显示器分辨率:" Str$(x)
x=GetSystemMetrics(SM_CYSCREEN)
dispy=Str$(x)
CallGetSystemInfo(sysinfo)
SelectCasesysinfo.dwProcessorType
Case386
cpus="处理器类型:386"
Case486
cpus="处理器类型:486"
Case586
cpus="处理器类型:586"
EndSelect
abouts=ShellAbout(Me.hwnd,"演示程序",
"销售管理系统V2.0版权所有[C]1998-1999蔡可训"
&Chr$(13)&Chr$(10)&space1&Chr$(13)&Chr$(10)
&space2&Chr$(13)&Chr$(10)&cpus "" dispx
"*" dispy,icons)
EndSub

----以上程序在WINDOWS98,VISUALBASIC6.0FORWINDOWS环境下运行通过.用户可以将其加入应用系统的ABOUT菜单项,通过菜单项调用它,效果更好->

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:怎样使用有admin888的Access数据库

下一篇:数据访问控制--多客户环境下VB数据库编程之(2)