vb自动关机程序
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private closeTime As String
Sub AdjustTokenPrivilegesForNT()
Dim hdlProcessHandle As Long
Dim hdlTokenHandle As Long
Dim tmpLuid As LUID
Dim tkp As TOKEN_PRIVILEGES
Dim tkpNewButIgnored As TOKEN_PRIVILEGES
Dim lBufferNeeded As Long
hdlProcessHandle = GetCurrentProcess()
OpenProcessToken hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or _
TOKEN_QUERY), hdlTokenHandle
LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuid
tkp.PrivilegeCount = 1
tkp.Privileges(0).pLuid = tmpLuid
tkp.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
AdjustTokenPrivileges hdlTokenHandle, False, tkp, _
Len(tkpNewButIgnored), tkpNewButIgnored, _
lBufferNeeded
End Sub
Private Sub Form_Load()
Dim fso As New FileSystemObject
Dim ts As TextStream
Dim txt, iniFilePath As String
iniFilePath = App.Path & "\" & "system.ini"
If fso.FileExists(iniFilePath) Then
Set ts = fso.OpenTextFile(App.Path & "\" & "system.ini")
closeTime = ts.ReadLine
ts.Close
Set ts = Nothing
If Len(Trim(closeTime)) = 0 Then
Set ts = fso.CreateT
相关文档:
1、先把VB编译好的DLL文件放到系统的SYSTEM32文件夹下
2、用regsvr32注册这个DLL文件
3、Pb下调用
oleobject ole_1
ole_1=create oleobject
long ll_ret
ll_ret=ole_1.connecttonewobject( 'add.addstring ')//其中add为VB的工程名,addstring为VB的类模块名
string ls_message, ......
Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required dat ......
最近在利用vb编写关于百度空间验证码自动识别的程序,但是一直没能实现,原因就是我的水平还是太菜。于是从网上寻找了很多关于验证码识别的源代码,从里面学到不少东西,算是没白努力吧。在此总结一下学到的东西,希望能对朋友们有些帮助吧。
首先整理下编写验证码识别的思路吧:
1 ......
通过调用CreateDataSetfromXml取得XML数据
Imports System.Xml
Public Const FILE_CONFIG = "MZZ.xml"
Public Const PATH_CONFIG = "\XML\"
Dim dstXML As DataSet
Dim tblXML_DB As DataTable
Dim dtCod As New DataTable
Dim strSQL As String = ""
clsPublic ......
转自:http://www.52arm.com/Article_Show.asp?ArticleID=186
作者:weidian ---本站原创 点击数:4721 发表时间:2008-5-7 编辑:sanzang
Winsock控件建立在TCP、UDP协议的基础上,完成与远程计算机的 ......