vb sendmessage 改变textbox中text

zhaizhaoxuan 2008-12-20 12:10:25

Const WM_SETTEXT = &HC
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
SendMessage Text1.hwnd, WM_SETTEXT, 0, "@"
End Sub


不行哦
...全文
170 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wap21 2008-12-20
  • 打赏
  • 举报
回复
ding
Hotus 2008-12-20
  • 打赏
  • 举报
回复
Const WM_SETTEXT = &HC
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Sub Command1_Click()
SendMessage Text1.hwnd, WM_SETTEXT, 0, ByVal "@"
End Sub

就行了
1,undoc.ZIP 一些未公开的Windows ShellAPI的调用(11KB) 2,filedlg.ZIP 不使用控件就可以弹出打开文件对话框(3KB) 3,icon.ZIP 调用API函数ExtraIconEx获得文件集成的图标(2KB) 4,baricon.ZIP 利用API函数Shell_NotifyIcon在任务栏上放置图标。并且可以相应任务栏图标消息(5KB) 5,HotKey.ZIP 为窗口建立HotKey(2KB) 6,ListTips.ZIP 通过Windows API函数SendMessage发送消息使List Box的每一个Item有不同的Tooltip(2KB) 7,TextBox.ZIP 另外一个通过Windows API函数SendMessage发送消息的范例,这个范例改变文本框的只读属性(2KB) 8,FILEVER.ZIP 获取文件信息(5KB) 9,brush.ZIP 用指定的位图做刷子填充整个窗口。这个程序演示如何建立画刷句柄以及将它选择到一个图形设备句柄(3KB) 10,cleardoc.ZIP 清除"文档"菜单的快捷方式和加入快捷方式(2KB) 11,BMenu.ZIP 建立位图菜单(3KB) 12,Format.ZIP 磁盘格式化演示程序(2KB) 13,volinfo.ZIP 获得驱动器信息(2KB) 14,rtext.ZIP 建立任意旋转的文本(4KB) 15,browsdlg.ZIP 利用Shell API函数弹出文件夹浏览窗口(3KB) 16,connnew.ZIP 实现对“我的电脑”“拨号网络”的控制,如“新建一个连接”,打开某个“连接”的属性(2KB) 17,ime.ZIP 在VB切换文输入法的演示(4KB) 18,getpw.ZIP 获取密码文本密码输入框的密码(2KB) 19,ownerdrawlist.ZIP 使用SetWindowLong改变窗口的缺省窗口处理函数,从而建立可以显示不同颜色列表的程序(3KB) 20,filedialog_hook.ZIP DialogHook利用Windows API实现对文件打开对话框的监控(6KB) 21,djapi.zip A common API library control. Methods include SetParent, GetParent, SetWindowPos, GetWindowRect,GetComputerName, DisableSystemKeys, ShowTaskBar,LockToggle, and DisableClose.(7KB) 22,sysmenu.zip 删除系统菜单的源代码(2KB) 23,browsedlg.zip 浏览目录的API函数,通用浏览目录对话框(2KB) 24,filepty.zip 调用API函数,显示文件属性对话框(3KB) 25,changedisplay.zip 调用API函数,改变显示器分辨率(8KB) 26,shfileop.zip 显示Win95 API的一些函数(4KB) 27,on top.zip api函数的用法(3KB) 28,Winapi.zip 几百个常用的 API 函数的简介,HLP 格式。文(106KB) 29,api32.zip 700多个API函数的详细介绍,CHM 格式。强烈推荐!文(344KB) 30,API_GUIDE.zip 500多个API函数的详细介绍,并且每个函数都配有一个示例,Cool!英文 EXE格式(358KB) 31,internet.zip 所有关于Internet的API函数的详细介绍,小聪明将其制作成帮助文件并对常用的函数加入了在VB的声明(API浏览器没有)。英文 (71KB) 32,swinapi.zip 你还在用API浏览器吗?快扔掉它吧,用这个雪冰灵制作的小工具吧,它不但具有API浏览器的功能,而且几乎每个函数都配上了说明和示例。Cool!文 EXE格式(823KB) 33,vbapi.zip 文 TXT格式 (26KB) 34,api008.zip 本帮助文件的Windows API 函数大约有774个,全文并且有VB例子CHM格式 文(954KB) 35,api009.zip 本帮助文件的API 分为6 篇,分别为 :1.前言2.API的数据类型和数据结构3.API的调用方式4.建立闪烁的窗体5.建立最顶层窗体6.VB5.0与Windows API 间的呼叫技巧 (chm格式文)(23KB) 36,api010_api99.zip API函数比上一版本新增37个,数量达到102个,并附带有如何在VB调用的例子。 VB编程者不可错过!英文 htm格式(99.4.3日版)(289KB) 37,api011.zip htm格式 文(1019KB) 38,api012.zip VB的API说明下载包 (htm格式,英文)(50KB) 39,34.zip 用API函数对注册表进行操作(8KB) 40,fileprops.zip 利用API函数调用文件的属性对话框(7KB)
1,create.ZIP 不用OCX来创建自己的控件(4KB)2,rganimate.ZIP 动画控件(35KB)3,rgassistant.ZIP 允许你创建一个Microsoft Office97那样的助手!(65KB)4,rgsysmoncal.ZIP 日期控件(35KB)5,datadrn.ZIP 创建数据驱动窗体(7KB)6,tooltip.zip 利用VB建立ToolTip窗口(4KB)7,trans.zip 建立透明的窗口(2KB)8,Anicur.zip 在窗口建立动画光标(2KB)9,toolbar.zip 建立浮动工具栏的例程(22KB)10,winrgn.zip 建立不规则的窗口(2KB)11,winhole.zip 建立一个间有洞的窗口(2KB) 12,split.zip 分割窗口并动态调整分割区域(类似于Windows的资源管理器)(18KB)13,rubrect.zip 在屏幕上出现抓取窗口(8KB)14,hidebtn.zip 隐藏Win9X任务栏上的“开始”按钮(2KB)15,console.zip 利用API函数建立控制台窗口(4KB)16,startinm.zip 将一个程序的窗口作为你的窗口的MDI子窗口(3KB)17,desktop.zip 一个可以动态排列桌面图标和动态改变屏幕分辨率的程序(29KB)18,rgdock.zip 建立类似Office工具栏的Docking Window(56KB)19,comboex.zip 一个非常cool的范例,可以在窗口建立一个类似于Windows Explore的地址栏的图标下拉ComboBox。其还包含了其它的许多技巧(32KB)20,dyncontrol.zip 动态建立控件的范例(3KB)21,listitemdrag.zip 演示如何将列表框的条目拖放到另外一个列表框(2KB)22,ownerdrawmenu.zip 演示建立图形菜单,同一般的图形菜单不同,通过该程序建立的菜单当光标移动到菜单项上时,该项一样可以象Word97菜单项一样突出显示(11KB)23,traybar.zip 一个可以隐藏任务栏(Traybar)上的开始按钮、Switch Bar、快速启动按钮、任务栏图标、桌面图标的程序(3KB)24,windowsplacement.zip 更改Windows程序在Switch bar上的位置(3KB)25,tooltips.zip 利用Windows API实现的可显示多行文字的ToolTip(5KB)26,deskicon.zip 当你设置Windows的桌面墙纸之后,是否觉得桌面图标文字下的色块十分碍眼呢,这个程序可以使图标文字透明的显示在桌面上。还可以改变桌面图标文字的颜色以及图标文字下色快的颜色(2KB)27,animatedtitlebar.zip 这个程序可以使你的窗口的Title Bar动起来。很有趣的(26KB)28,resizr.zip 一个带源码以及演示的Resizer控件,就象Windows资源管理器的文件夹列表同文件列表之间的Resizer棒一样(7KB)29,taskbar.zip 一个带源码以及演示的TaskBar控件,可以让你的窗口象Windows的TaskBar一样(6KB)30,xeditor.zip 一个利用VB编写的功能比较完备的文本编辑器(172KB)31,custominputbox.zip 这个程序演示如何改变缺省的InputBox的外貌(10KB)32,controlpopmenu.zip 这个程序演示如何控制控件的缺省弹出菜单(例如TextBox),是完全控制而不只是隐藏和显示(3KB)33,coolmenu.zip 一个很Cool的菜单程序,可以把你的菜单改造成象Office系列的带图标的菜单(33KB)34,covereffect.zip 一个实现程
设置窗体的代码解释 Imports System.Diagnostics Public Class 设置窗体 Private shutTime As String '关机时间的字符串 Private IsToday As Boolean = True '判断是否是今天的变量 Private delay As Integer '延时多少秒放关机 Private lastTime As Integer '关机的倒计时 Private action As String '关机或重启或注销 Private shellText As String '执行的命令字符串 Private firstShow As Boolean = True Private SysTime As Boolean = False Private autoHide As Boolean = True '启动自动隐藏 Private TotalData As New System.Diagnostics.PerformanceCounter("Network Interface", "Bytes Total/sec", "MS TCP Loopback interface") Private proTime As New System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", "_Total") '双击右下角的图标的响应事件 Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick If (Me.Visible = False) Then Me.Show() End If End Sub '重载窗体的关闭事件,使窗体隐藏 Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing e.Cancel = True '取消窗体的关闭动作 delayTime.Value = delay '还原delayTime控件的值 StrToItems() '还原ListBox的值 Me.Hide() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.SelectedIndex = 2 '设置默认选项 "每天" ComboBox2.SelectedIndex = 4 '设置默认选项 "关机" Timer1.Start() readReg() '读取存放在注册表的信息 StrToItems() '把字符串的信息读取到ListBox delayTime.Value = delay '把延时时间读取到delayTime控件 DateTimePicker1.Value = Today End Sub Private Sub 退出程序ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出程序ToolStripMenuItem.Click Me.Dispose() End Sub Private Sub 立即取消关机ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 立即取消关机ToolStripMenuItem1.Click Timer2.Stop() 取消窗体.Close() Shell("shutdown -a") Timer1.Start() End Sub Private Sub 设置关机计划ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 设置关机计划ToolStripMenuItem.Click If Me.Visible = False Then Me.Show() End If End Sub '点击确定按钮的事件处理 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click '判断是否要开机自动运行 If autoCheck.Checked Then 创建开机自动运行() Else 删除开机自动运行() End If If Me.HideCheck.Checked Then autoHide = True Else autoHide = False End If If Me.regCheck.Checked Then 禁止修改注册表() Else 取消禁止修改注册表() End If If Me.ManCheck.Checked Then 禁止使用任务管理器() Else 取消禁止使用任务管理器() End If If Me.SysTimeCheck.Checked Then SysTime = True Else SysTime = False End If '四舍五入delayTime控件的值 delay = Math.Round(delayTime.Value, MidpointRounding.AwayFromZero) Me.Hide() ItemsToStr() '把listBox的信息保存到字符串 writeReg() '把字符串保存把注册表 End Sub '取消按钮事件 Private Sub canelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles canelButton.Click StrToItems() '还原ListBox的值 delayTime.Value = delay '还原delayTime控件的值 Me.Hide() End Sub '点击添加按钮 Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click Dim tempStr As String = "" If ComboBox1.Items.Item(ComboBox1.SelectedIndex) = "指定日期" Then tempStr = DateTimePicker1.Value.ToShortDateString Else tempStr = ComboBox1.SelectedItem End If tempStr &= "," & CStr(Math.Round(hourNum.Value, MidpointRounding.AwayFromZero)) & ":" & CStr(Math.Round(minNum.Value, MidpointRounding.AwayFromZero)) & ":" & CStr(Math.Round(secNum.Value, MidpointRounding.AwayFromZero)) & "," Select Case ComboBox2.SelectedItem Case "打开网址" tempStr &= "打开网址" & "[" & TextBox1.Text.Replace(";", ";").Replace(":", ":") & "]" Case "提醒信息" tempStr &= "提醒信息" & "[" & TextBox1.Text.Replace(";", ";").Replace(":", ":") & "]" Case "打开文件" tempStr &= "打开文件" & "[" & TextBox1.Text.Replace(";", ";").Replace(":", ":") & "]" Case Else tempStr &= ComboBox2.SelectedItem End Select ListBox1.Items.Add(tempStr) End Sub '点击清除按钮 Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click ListBox1.Items.Clear() End Sub '把ListBox的值保存到字符串ShutTime Private Sub ItemsToStr() Dim i As Integer shutTime = "" For i = 0 To ListBox1.Items.Count - 1 '把ListBox的各项连接到shutTime shutTime &= ListBox1.Items.Item(i) & ";" Next If shutTime "" Then '去除最后一个 ";" shutTime = Mid(shutTime, 1, shutTime.Length - 1) End If End Sub '把字符串ShutTime的值还原到ListBox Private Sub StrToItems() If shutTime "" Then '如果shutTime有保存信息 Dim temp() As String = shutTime.Split(";") 'temp字符串数组存放shutTime以";"分隔的各个字符子串 Dim t As String 't存放temp字符串数组的一项 ListBox1.Items.Clear() For Each t In temp If Not (Mid(t, 1, 2) = "今天" And Not IsToday) Then '如果今天还没过了 ListBox1.Items.Add(t) End If Next End If End Sub '读取注册表保存的信息 Private Sub readReg() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey Try key = Microsoft.Win32.Registry.LocalMachine subkey = key.OpenSubKey("SOFTWARE\AutoShutdown") shutTime = subkey.GetValue("time") delay = CInt(subkey.GetValue("delayTime")) autoHide = subkey.GetValue("autoHide") If (CStr(Today()) subkey.GetValue("day")) Then IsToday = False End If Catch ex As Exception shutTime = "" IsToday = True End Try End Sub Private Sub 禁止修改注册表() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser subkey = key.CreateSubKey("software\microsoft\windows\currentversion\policies\system") subkey.SetValue("disableregistrytools", 1) End Sub Private Sub 取消禁止修改注册表() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser subkey = key.CreateSubKey("software\microsoft\windows\currentversion\policies\system") subkey.SetValue("disableregistrytools", 0) End Sub Private Sub 禁止使用任务管理器() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser subkey = key.CreateSubKey("software\microsoft\windows\currentversion\policies\system") subkey.SetValue("DisableTaskMgr", 1) End Sub Private Sub 取消禁止使用任务管理器() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser subkey = key.CreateSubKey("software\microsoft\windows\currentversion\policies\system") subkey.SetValue("DisableTaskMgr", 0) End Sub '将需要保存的信息写入注册表 Private Sub writeReg() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine subkey = key.CreateSubKey("SOFTWARE\AutoShutdown") subkey.SetValue("time", shutTime) subkey.SetValue("day", CStr(Today())) subkey.SetValue("delayTime", CStr(delay)) subkey.SetValue("autoHide", autoHide) End Sub '点击删除按钮 Private Sub delButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delButton.Click Dim delIndex As Integer = ListBox1.SelectedIndex If delIndex -1 Then ListBox1.Items.RemoveAt(delIndex) End If End Sub '最小化窗体,这里指隐藏窗体 Private Sub 最小化ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 最小化ToolStripMenuItem.Click If Me.Visible = True Then StrToItems() delayTime.Value = delay Me.Hide() End If End Sub Private Sub 创建开机自动运行() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine subkey = key.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run") subkey.SetValue("定时自动关机", Application.ExecutablePath) End Sub Private Sub 删除开机自动运行() Dim key As Microsoft.Win32.RegistryKey, subkey As Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine subkey = key.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True) subkey.DeleteValue("定时自动关机") End Sub '关闭显示器 Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Public Const WM_SYSCOMMAND = &H112 Public Const SC_MONITORPOWER = &HF170 '关闭显示器 Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 'Timer1的Tick事件,来监视现在的时间是否应该关机或别的了 Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Static nowTime As Date = Now updataMsg() If SysTime Then If (Now nowTime) Then Today = nowTime TimeOfDay = nowTime End If End If nowTime = nowTime.AddSeconds(1) If (shutTime "") Then Dim temp1() As String = shutTime.Split(";") 'temp1字符串数组存放shutTime以";"分隔的各个字符子串 Dim temp2() As String, i As Integer 'temp2字符串数组存放temp1某项的字符串以","或":"分隔的字符子串 Dim TimeOut As Boolean = False 'TimeOut存放是否时间到了 For i = 0 To temp1.Length - 1 temp2 = temp1(i).Split(New Char() {",", ":"}) If IsTimeOut(temp2) Then '判断时间是否到了 TimeOut = True action = temp2(4) '是"关机","注销","重启" End If Next If TimeOut Then '如果时间到 Select Case Mid(action, 1, 4) '根据action肯定命令字符串 Case "关闭计算" shellText = "shutdown -s -f -t 0" Case "重启计算" shellText = "shutdown -r -f -t 0" Case "注销用户" shellText = "shutdown -l -f -t 0" Case "关闭显示" SendMessage(Me.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, 1) Exit Sub Case "锁定计算" shellText = "rundll32.exe user32.dll, LockWorkStation" Case "打开文件" System.Diagnostics.Process.Start(Mid(action, 6, action.Length - 6).Replace(":", ":")) Exit Sub Case "提醒信息" MsgBox(Mid(action, 6, action.Length - 6), , "提醒信息") Exit Sub Case "打开网址" System.Diagnostics.Process.Start(Mid(action, 6, action.Length - 6).Replace(":", ":")) Exit Sub End Select lastTime = delay '倒计时等于延时 Timer2.Start() '倒计时开始 取消窗体.Show() '倒计时窗口打开 Timer1.Stop() End If End If End Sub '判断时间是否到了 Private Function IsTimeOut(ByRef t() As String) As Boolean '如果时分秒都相等 If t(1) = CStr(Hour(Now())) And t(2) = CStr(Minute(Now()) And t(3) = Second(Now)) Then Select Case t(0) Case "每天" Return True Case "今天" Return True Case "每周二" If Weekday(Now) = FirstDayOfWeek.Tuesday Then Return True End If Case "每周六" If Weekday(Now) = FirstDayOfWeek.Saturday Then Return True End If Case "每周日" If Weekday(Now) = FirstDayOfWeek.Sunday Then Return True End If Case "每周三" If Weekday(Now) = FirstDayOfWeek.Wednesday Then Return True End If Case "每周四" If Weekday(Now) = FirstDayOfWeek.Thursday Then Return True End If Case "每周五" If Weekday(Now) = FirstDayOfWeek.Friday Then Return True End If Case "每周一" If Weekday(Now) = FirstDayOfWeek.Monday Then Return True End If Case "每周一至周五" If Weekday(Now) > FirstDayOfWeek.Sunday And Weekday(Now) < FirstDayOfWeek.Saturday Then Return True End If Case Else If (t(0) = Today.ToShortDateString) Then Return True End If End Select End If Return False End Function '刷新Msg控件 Private Sub updataMsg() Dim xingqi As String = "" Select Case Weekday(Now) Case 1 xingqi = "星期天" Case 2 xingqi = "星期一" Case 3 xingqi = "星期二" Case 4 xingqi = "星期三" Case 5 xingqi = "星期四" Case 6 xingqi = "星期五" Case 7 xingqi = "星期六" End Select msg.Text = "当前时间" & Now().ToLongDateString & " " & Now().ToLongTimeString & " " & xingqi & " CPU使用" & Format(proTime.NextValue, "#0") & "% 网速" & Format(TotalData.NextValue / 1024, "########0.00") & "KB/S" Me.NotifyIcon1.Text = msg.Text End Sub '倒计时处理事件 Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick If lastTime = 0 Then '如果时间到 Shell(shellText, AppWinStyle.Hide) 取消窗体.Label1.Text = "正在" & action Else 取消窗体.Label1.Text = "离" & action & "还有" & lastTime & "秒" '显示倒计时 lastTime -= 1 End If End Sub Private Sub 设置窗体_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown If autoHide Then Me.Hide() End If End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged Select Case ComboBox2.SelectedItem Case "打开网址" Button1.Visible = False TextBox1.Width = 299 TextBox1.Visible = True Case "提醒信息" Button1.Visible = False TextBox1.Width = 299 TextBox1.Visible = True Case "打开文件" Button1.Visible = True TextBox1.Width = 209 TextBox1.Visible = True Case Else Button1.Visible = False TextBox1.Visible = False End Select End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged If ComboBox1.SelectedItem = "指定日期" Then DateTimePicker1.Visible = True Else DateTimePicker1.Visible = False End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then TextBox1.Text = OpenFileDialog1.FileName End If End Sub Private Sub 立即关机ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 立即关机ToolStripMenuItem.Click Shell("shutdown -s -f -t 0") End Sub Private Sub 立即重启ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 立即重启ToolStripMenuItem.Click Shell("shutdown -r -f -t 0") End Sub Private Sub 立即注销ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 立即注销ToolStripMenuItem.Click Shell("shutdown -l -f -t 0") End Sub Private Sub 立即锁定计算机ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 立即锁定计算机ToolStripMenuItem.Click Shell("rundll32.exe user32.dll, LockWorkStation") End Sub Private Sub 立即关闭显示器ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 立即关闭显示器ToolStripMenuItem.Click SendMessage(Me.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, 1) End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start("http://lywang.5d6d.com/space-uid-1.html") End Sub End Class
1 , docudel.zip
This example shows how to clear the document history on the start menu.
2 , BatteryAPIdemo.zip
This example demonstrates how to "To get information about the battery status with out having to use the SysInfo.ocx from MS"
3 , DisableXexam.zip
This example easily demonstrates how to remove the "X" from your forms.
4 , manc-sleep.zip
This example demonstrates how to pause for a specified duration in seconds using the 'Sleep' win32 API function.
5 , camp-api.zip
An example of editing the "win.ini" file to execute programs when Windows loads.
6 , win32api.exe
This will install the Win32API.txt on your system. This file holds all API declarations for Windows. Must 下载.
7 , transparentblt.zip
This demonstrates how to display an image transparently on the form. An excellent example.
8 , MessageBoxDemo.zip
Manipulate Message Boxes using API. These include a self-closing message box, and a form-centered message box.
9 , menucol.zip
This shows how to add "columns" to your menus. An excellent example.
10 , changeborder.zip
Have you ever wanted to change the border style during runtime? Now you can using SetWindowLong. This example demonstrates greatly how you can accomplish this.
11 , capmousedemo.zip
This example demonstrates how to Set capture on the mouse to detect when it enters and leaves a specific portion of your form.
12 , apilines.zip
This example demonstrates how to draw lines using API.
13 , killapp.zip
This is a bas file to close any window with just it's caption.
14 , combohgt.zip
This demonstrates how to change the height of a combobox's drop-down height using API.
15 , bat-os.zip
This demonstrates how to retrieve information about Battery Powered machines.
16 , display.zip
This will open the Screen Resolution Dialog so you can manipulate it.
17 , ciasystray.zip
This shows you how to add your icon to the system tray without any third-party controls.
18 , taskbar.zip
This demonstrates how to Hide and Show the taskbar.
19 , wpchanger.zip
This shows how to change Windows' Desktop Wallpaper
20 , discad.zip
This shows how to disable control alt and delete by tricking the computer into thinking that the screensaver is running.
21 , windowfrompoint.zip
Get a window's handle from the current cursor position.
22 , api.zip
api function collection
23 , benchmark.zip
This program is very usefull program which gets the details of your computer and have an ability of changing some system details.
24 , menustructure.zip
This program will retrieve the full menu structure of a Form, up to three levels, and allow the user to modify it.
25 , crackPassword.zip
This is a very unusual program which will let you read behind those ******* in password fields and recover captions from Dialogs, Labels, Command Buttons, TextBoxes...
26 , hotkey_source.zip
Hotkey Manager Beta Version: Manages and implements hotkey in Windows 95/98/NT.
27 , rjsoftapisamples.zip
The samples included in this project use the few API
28,sysmetrics.zip
This is a windows information viewer. You can use this sample to find or select an open window, and view information about the window, such as its hwnd, size, and parent window.
29,launcher.zip
This is an ActiveX DLL that causes a client app to wait for another app to finish. The library takes care of launching the new app and doing all of the synchronization. It also returns the exit code for the process.
30,servcont.zip
It enables you to start and stop NT Services through the Win32 API, change the startup type and the security account associated with it. Included is a test harness so that people can see how it works. The code has been tested under NT4 SP6a
31,passdemo.zip
This is a very good example of how to use the registry to save data. It shows how to create, store and save a password to the registry and also encrypts it to keep out prying eyes.
32,delay.zip
This is a rough translation of the GetTickCount API and includes three different ways to pause an application.
33,cdromsystray.zip
This excellent program which was sent to us annoymously adds an icon to the systray (bottom right on the start menu bar) and allows you to control the opening and closing of the CDROM.. Easily adaptable, and if you wrote this and want to be credited
34,rgbdemo.zip
Very small, very fast. Complete source included to demonstrate how to translate a long to red, green and blue values
35,sleep2.zip
This is a small project showing how to use the Sleep API call from within your program to pause for a set period of time. Its much better than looping round as it uses very little CPU time
36,threads.zip
This application is only used to show how a multithreaded program is structured through the 'eyes' of VB. If you follow the logic of the program it does teach a lot about multithreading and the necessary techniques to do this in a 'Thread Safe environmen
37,callback.zip
This small project is for the more advanced VB users and shows an undocumented VB function and an undocumented Win32 API function. Demonstrated in the project how to use these two functions in order to raise events in a class from a module
38,ctaskmanager.zip
This application contains the same basic functionality as the task manager in Windows. It allows you to see the loaded windows on your system as well as the class, position and process ID for each window. Remember that every process running on a system
39,cprocessfinished.zip
This little routine will test if a shelled process has finished executing and return true or false. Its bits of code like that we would like more of, so please send them.
40,apimsg.zip
API Message Box
41,freespc.zip
Get a Drive's Free Space
42,drvinfo.zip
Get Drive Information (S/N, Label, Format)
43,nodisk.zip
Show Message When There is No Disk in a Drive
44,fullpath.zip
Add Full Paths to a TreeView
45,disksrch.zip
Search for Disk in a Removable Drive
46,drvtype.zip
Determine Drive Type
47,findcd1.zip
Find the First CD-ROM
48,xxsShell32.zip
Shell32 functions and subs wrapper for VB developers.
49,api2.zip
This application is designed to help VB Developer to find Windows API Easely.
50,qsvb.zip
QuickSilver for Visual Basic, aims to provide a wrapper for all important Windows API functions by a simple class. All the operations are included as properties and methods that can used with the same ease as any other part of your dream project.
51,CPUInfo.zip
This code will quickly tell you a lot of your system information like computer name, IP address, OS, Service Pack, Processor Vendor, Processor Type, Processor Speed (Raw and Normal), RAM (Total and Available).
52,Callbacks.zip
It is nice little application, which demonstrates WinAPI Callbacks. It hides and restors all Yahoo chatting window in a single click.
53,ShellTrayIcon.zip
The CShellTrayIcon class allows your VB application to set, change and delete icons in the system's tray (note: the official term for the tray is the taskbar notification area). The class raises an event in your application when the user clicks an icon in the tray.
54,EventCtl.zip
This little control greatly simplifies the business of subclassing a form to get at the extra events that the Visual basic designers left out. i.e.:
55,EuroCalc2.zip
In place conversion between every one of the European Monetary Union member currencies and the Euro.
56,Edge.zip
In my program i have used few API functions to set 3D,Sunken,etched effects to the images of your image control.Another example shows how to change your label control to a 3D command button almost functionally.
57,Prjfloat.zip
I have used two APIFuctions 'Setwindowword' and 'Setparent' to make the child window float
freely and with in the parent window. Open with vb5 and vb6.
58,FilterTextBox.zip
This program shows how to filter out characters from TextBox control.Uses GetWindowLong and SetWindowLong APIs.
59,SysControl.zip
This is a program that will let you show, hide, alter text, capture a picture, change the parent, kill, close, enable, disable, get info on, minimize, maximize, restore, capture a picture of, make them stay-on-top, send a message to, edit the window style, and flash the title bar on almost any target!
60,LBApi.zip
This program uses Sendmessage API function for additem,removeitem,clear,selcount,listcount etc, with a horizontal scroll bar.(List/combo)
61,winnanny.zip
U can use Winnanny to restrict unauthorised people from running programs u don't want them to on your pc .It Uses simple api functions to do this.
62,ReadWriteIni.zip
Creates .ini file, writes to it and reads from it. Demo project shows how to write usernames and passwords. For clarity's sake I made it write user color preferences.
63,capture.zip
This program captures the active window and displays it to a Picture box.
64,TransIco.zip
An update to my previous code : Added a couple of features some ppl asked me for...like the ability to change the text colour of the icon and also keep the background transparent after a desktop refresh.
65,shutdown.zip
Shut Down Windows with Windows Shutdown Dialog.This is the real thing , not Kill , It is a real API Call, I hope you find it useful.
66,alarm.zip
A VB alarm clock.
67,clcViewWinInfo.zip
ViewWinInfo is a windows information viewer. You can use this sample to find or select an open window, and view information about the window, such as its hwnd, size, and parent window.
68,ptinrect.zip
Use the PtInRect API function to create an annoying program.
69,fliphorizvert.zip
Flips a picture using the StretchBlt API function.
70,animation.zip
Use BitBlt to crate flickerless animation
6 , chunks.zip<br>This will open a file and read it in "Chunks" of a selected file.<END><br>7 , logging.zip<br>This is a bas that will log installation procedures so the file can be removed later.<END><br>8 , savetree.zip<br>This will save the info in a Tree View. "This technique allows a program to save hierarchical information like the data in a TreeView in a way that is easy to understand."<END><br>11 , OLE.zip<br>Demonstrates the use of OLE.<END><br>12 , gradtxt2.zip<br>"A program for drawing horizontal, rectangular or spherical gradient texts."<END><br>13 , sweepgl.zip<br>This example greatly demonstrates how to use OpenGL in Visual Basic.<END><br>15 , drawdemo.zip<br>This is an excellent example of how to make a paint program with a few extras.<END><br>16 , cube.zip<br>This example demonstrates how to rotate a cube in visual basic.<END><br>17 , sprite1.zip<br>This is an Excellent example on how to use sprites in your program.<END><br>18 , charcreate.zip<br>This is an example of how to assign "characters" to differant pictureboxes. This would be a good starting point for VB game developers.<END><br>19 , breakthrough.zip<br>This demonstrates a simple game in Visual Basic. An excellent example.<END><br>26 , openlib.zip<br>These are the type libs that go with OpenGL. This is used to make 3D text.<END><br>27 , basMath.zip<br>This module contains functions for various math equations. <END><br>28 , calc.zip<br>This is a basic calculator written in Visual Basic.<END><br>29 , stopwatch.zip<br>This shows how to count off time in a Stop Watch format.<END><br>31 , taskhide.zip<br>This will hide your application from the taskbar, Alt+Tab, and Alt+Ctrl+Del.<END><br>32 , newbie.zip<br>This is a nicely done help file for programmers that are new to Visual Basic.<END><br>33 , vbfaq.zip<br>This is AOL's PC Dev Visual Basic FAQ. This is an excellent starting point for begginners.<END><br>34 , Bas.zip<br>it is very good modual for activex<END><br>35, paraviasource.zip<br>This is

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧