当前位置: 网学 > 编程文档 > VB > 正文

Win95系统API函数大揭秘

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/16
下载{$ArticleTitle}原创论文样式
As Long)
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Type POINTAPI
X As Long
y As Long
End Type

Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H4

Public Sub FormatFloppy()
Dim sBuffer As String, Windir As String, Procs As String, X
Dim lResult As Long
sBuffer = String$(255, 0)
lResult = GetWindowsDirectory(sBuffer, Len(sBuffer))
Windir = Trim(sBuffer)
Procs = Left(Windir, lResult) & "\rundll32.exe shell32.dll,SHFormatDrive"
Call CenterDialog("Format - 3? Floppy (A:)")
X = Shell(Procs, 1)
Call CenterDialog("Format - 3? Floppy (A:)")
k = LockWindowUpdate(0)
End Sub

Public Sub CenterDialog(WinText As String)
DoEvents
On Error Resume Next
Dim D3 As Long
D3 = LockWindowUpdate(GetDesktopWindow())
Dim wdth%
Dim hght%
Dim Scrwdth%
Dim Scrhght%
Dim lpDlgRect As RECT
Dim lpdskrect As RECT
Dim hTaskBar As Long
hTaskBar = FindWindow(0&, WinText)
Call GetWindowRect(hTaskBar, lpDlgRect)
wdth% = lpDlgRect.Right - lpDlgRect.Left
hght% = lpDlgRect.Bottom - lpDlgRect.Top
Call GetWindowRect(GetDesktopWindow(), lpdskrect)
Scrwdth% = lpdskrect.Right - lpdskrect.Left
Scrhght% = lpdskrect.Bottom - lpdskrect.Top
X% = (Scrwdth% - wdth%) / 2
y% = (Scrhght% - hght%) / 2
Call SetWindowPos(hTaskBar, 0, X%, y%, 0, 0, SWP_NOZORDER Or SWP_NOSIZE)
DoEvents
End Sub
? 调用“关于”窗口
在“帮助”菜单选择“关于XXX”会弹出标准“关于”窗口,利用ShellAbout函数不但可以调用
标准“关于”窗口,还可以随意更改其中内容呢!
ShellAbout声明如下:
HWnd设置窗口句柄,szApp设置窗口的“Caption”, szOtherStuff 在“版权所有”和“使用权”
之间的空白处增加额外说明。
Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long,
ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
Private Sub Form_Load()
Call ShellAbout(hWnd, "何发武天使工作室!", "调用标准的关于窗口" & vbCrLf & "上帝与你同在!
阿弥陀佛!", 0)
End Sub
    你还可以通过对注册表信息“动手术”来改变系统的“版权信息”运行REGEDIT,按照如下路径:
HKEY_LOCAL_MACHINE →SOFTWARE → Microsoft→Windows→ CurrentVersion →Version,就会找到
计算机中“关于”版本的通用设置,你可以把Version的内容改为你心仪的设置,如“何发武天使工
作室”、“ 何发武野狼工作室”等。
? 查看“属性”
    Win95中增加了一个全新的概念——“属性”,每个对象都拥有自己的“属性”,在“属性”窗口里
是关于对象的详细描述, 并且不同的对象“属性”窗口的说明是不同的。我们可以用ShellExecuteEX函
数直接调用“属性”标准窗口。下述程序功能相当于当鼠标右键单击根目录下的“autoexec.bat”并选
择“属性”时,则弹出标准的“属性”窗口。
窗体加入如下代码:
Private Sub FORM_Click()
Dim r As Long
Dim FileName As String
FileName = "c:\autoexec.bat"
r = ShowProperties(FileName, Me.hwnd)
If r <= 32 Then MsgBox "Error"
End Sub
加入代码如下的模块:
Option Explicit
Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号