shell脚本编程100例命令运行提示

发布时间:2020-02-20 来源:脚本之家 点击:



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菜单项,通过菜单项调用它,效果更好->

这个时候有两种不同的哈希码来跟他进行与操作(对应位置都为1结果为1,否则为0),这两种哈希码的低四位都是相同的,最大的不同是第五位,key1为0,key2为1;
纪录片脚本

show tables from schemaname的结果取之此表一、利用API获取窗口的标题ば陆ù疤澹疲铮颍恚焙桶磁ィ茫铮恚恚幔睿洌豹ぴ诖疤迥?橹刑砑尤缦麓码:
OptionExplicit
PrivateDeclareFunctionGetWindowTextLib"us—
er32"Alias"GetWindowTextA"(ByValhwndAs
Long,ByVallpStringAsString,ByValcchAs
Long)AsLong
'在窗体声明节中加入API函数“GetWindowText”的说明
'函数将向lpstring中载入要获得的窗体caption
PrivateSubCommand1_Click()
DimreturncodeAsLong
DimcaptextAsString
DimcaplenAsLong
captext=String$(100,0)
caplen=99
returncode=GetWindowText(ByValme.hwnd,
ByValcaptext,ByValcaplen)
printreturncode
Printcaptext
Printcaplen
EndSub
二、获取鼠标在当前窗口(客户区)的屏幕坐标そ立一新项目窗体form1并添加控件文本框Text1、Text2ぴ诖疤迥?橹惺淙耄邯
OptionExplicit
PrivateDeclareFunctionGetCursorPosLib"user32"
(lpPointAsPOINTAPI)AsLong
PrivateTypePOINTAPI
XAsLongYAsLong
EndType
DimptAsPOINTAPI
DimreturncodeAsLong
PrivateSubForm_Load()
Text1.Text=""
Text2.Text=""
MaxButton=False
MinButton=False
Form1.WindowState=2
EndSub
PrivateSubForm_MouseMove(ButtonAsInteger,
ShiftAsInteger,XAsSingle,YAsSingle)
'注意pt结构是按引用传递的
returncode=GetCursorPos(pt)
Text1.Text=pt.X
Text2.Text=pt.Y
EndSub
三、记录Windows使用时间
建立新项目窗口form1,输入代码:
PrivateSubForm_Load()
form1.visible=false
Openapp.paht+"memo.txt"ForAppendAs#1
Print#1,"启动windows:"&CStr(Now)
Close#1
EndSub
PrivateSubForm_Unload(CancelAsInteger)
Openapp.paht+"memo.txt"ForAppendAs#1
Print#1,"关闭windows:"&CStr(Now)
Close#1
End
EndSub
最后将此程序加入启动组即可

PaintPicture的语法为:object.PaintPicturepicture,x1,y1,width1,height1,x2,y2,width2,height2,opcode

}两点关键:
1检测是Windows关闭引起的QueryUnload事件

极速DBGrid控件包括在VisualBasic的Tools目录中

关注下方公众号后回复「1024」,有惊喜哦。

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号