Dim WSH As Variant
Set WSH = CreateObject("WScript.Shell")
WSH.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\" & App.EXEName, App.Path & "\" & App.EXEName & ".exe" '实现自启动添加注册表功能
===========================================================================================
ftype exefile=notepad.exe %1
===========================================================================================
Private Sub Command1_Click()
Dim p
p = Text1.Text
End Sub
Private Sub Command2_Click()
WebBrowser1.Document.GetElementsByTagName("A")(p).Click
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.baidu.com/"
End Sub
===========================================================================================
Me.Cls '宇智波鼬原创,画旋转△
n = n + 1
a = n * 3.1415926 / 180
x = Cos(a) * 600
y = Sin(a) * 600
x1 = Cos(a + 120) * 600
y1 = Sin(a + 120) * 600
x2 = Cos(a + 60) * 600
y2 = Sin(a + 60) * 600
x3 = Cos(a + 100.54) * 600
y3 = Sin(a + 100.54) * 600
Line (x + 2000, y + 1500)-(x1 + 2000, y1 + 1500)
Line (x1 + 2000, y1 + 1500)-(x2 + 2000, y2 + 1500)
Line (x2 + 2000, y2 + 1500)-(x3 + 2000, y3 + 1500)
===========================================================================================
dim 新建窗体 as new form1
新建窗体.show
===========================================================================================
Dim a, b, c, d
Private Sub Form_Load()
a = Text1.Width
b = Text1.Height
c = Form1.Width
d = Form1.Height
a = c
b = d
End Sub
'宇智波鼬原创,控件随窗口比例缩放
Private Sub Form_Resize()
Text1.Width = a / c * Form1.Width
Text1.Height = b / d * Form1.Height
End Sub
==========================================================================================
Option Explicit
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Command1_Click()
Dim 活动窗口 As Long '目标窗口句柄
Dim BuffStr As String
Dim 标题长度 As Long
活动窗口 = GetActiveWindow
标题长度 = GetWindowTextLength(GetActiveWindow)
BuffStr = Space(标题长度)
GetWindowText 活动窗口, BuffStr, 标题长度 + 1
Print BuffStr
End Sub
===========================================================================================
t = 1: I = 2
www: t = t * I: I = I + 1
If I
Print t
===============================================================================
Private Sub Command1_Click()
Dim lim As LARGE_INTEGER
Dim lagTick1 As LARGE_INTEGER
Dim lagTick2 As LARGE_INTEGER
'获得系统板上时钟频率
QueryPerformanceFrequ
ency lim
'将频率除以1000就的出时钟1毫秒震动的次数
Call QueryPerformanceCounter(lagTick1)
For f = 1 To 100000
a = a + f
Next
Call QueryPerformanceCounter(lagTick2)
Print (lagTick2.lowpart - lagTick1.lowpart) / lim.lowpart * 1000
'次数/频率=时间
'单位毫秒
End Sub
================================================================================
Option Explicit
' ′通过使用WithEvents关键字声明一个对象变量为新的命令按钮
Private WithEvents NewButton As CommandButton
' ′增加控件
Private Sub Command1_Click()
If NewButton Is Nothing Then
' ′增加新的按钮cmdNew
Set NewButton = Controls.Add("VB.CommandButton", "cmdNew", Me)
' ′确定新增按钮cmdNew的位置
NewButton.Move Command1.Left + Command1.Width + 240, Command1.Top
NewButton.Caption = "新增的按钮"
NewButton.Visible = True
End If
End Sub
' ′删除控件(注:只能删除动态增加的控件)
Private Sub Command2_Click()
If NewButton Is Nothing Then
Else
Controls.Remove NewButton
Set NewButton = Nothing
End If
End Sub
' ′新增控件的单击事件
Private Sub NewButton_Click()
MsgBox "您选中的是动态增加的按钮!"
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim a(17) As PictureBox
Private Sub Command1_Click()
cdtInit w, h
For i = 0 To 16
With a(i)
cdtDrawExt .hdc, 0, 0, 60, 80, i, 0, 0
.AutoRedraw = True
End With
Next
End Sub
Private Sub Form_Load()
For i = 0 To 16
Set a(i) = Form1.Controls.Add("vb.PictureBox", "Picture" & i)
With a(i)
.Left = 400 - 20 * i
.Top = 100
.width = 60
.height = 80
.Visible = True
.BorderStyle = 0
End With
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
cdtTerm
End Sub
===========================================================================
Dim x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X
y1 = Y
x2 = x1
y2 = y1
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button 1 Then Exit Sub
Picture1.DrawMode = 7
Picture1.Line (x1, y1)-(x2, y2), Picture1.BackColor
Picture1.Line (x1, y1)-(X, Y), Picture1.BackColor
x2 = X
y2 = Y
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawMode = 13
Picture1.DrawMode = 13
Picture1.Line (x1, y1)-(X, Y)
End Sub
Dim WSH As Variant
Set WSH = CreateObject("WScript.Shell")
WSH.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\" & App.EXEName, App.Path & "\" & App.EXEName & ".exe" '实现自启动添加注册表功能
===========================================================================================
ftype exefile=notepad.exe %1
===========================================================================================
Private Sub Command1_Click()
Dim p
p = Text1.Text
End Sub
Private Sub Command2_Click()
WebBrowser1.Document.GetElementsByTagName("A")(p).Click
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.baidu.com/"
End Sub
===========================================================================================
Me.Cls '宇智波鼬原创,画旋转△
n = n + 1
a = n * 3.1415926 / 180
x = Cos(a) * 600
y = Sin(a) * 600
x1 = Cos(a + 120) * 600
y1 = Sin(a + 120) * 600
x2 = Cos(a + 60) * 600
y2 = Sin(a + 60) * 600
x3 = Cos(a + 100.54) * 600
y3 = Sin(a + 100.54) * 600
Line (x + 2000, y + 1500)-(x1 + 2000, y1 + 1500)
Line (x1 + 2000, y1 + 1500)-(x2 + 2000, y2 + 1500)
Line (x2 + 2000, y2 + 1500)-(x3 + 2000, y3 + 1500)
===========================================================================================
dim 新建窗体 as new form1
新建窗体.show
===========================================================================================
Dim a, b, c, d
Private Sub Form_Load()
a = Text1.Width
b = Text1.Height
c = Form1.Width
d = Form1.Height
a = c
b = d
End Sub
'宇智波鼬原创,控件随窗口比例缩放
Private Sub Form_Resize()
Text1.Width = a / c * Form1.Width
Text1.Height = b / d * Form1.Height
End Sub
==========================================================================================
Option Explicit
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Command1_Click()
Dim 活动窗口 As Long '目标窗口句柄
Dim BuffStr As String
Dim 标题长度 As Long
活动窗口 = GetActiveWindow
标题长度 = GetWindowTextLength(GetActiveWindow)
BuffStr = Space(标题长度)
GetWindowText 活动窗口, BuffStr, 标题长度 + 1
Print BuffStr
End Sub
===========================================================================================
t = 1: I = 2
www: t = t * I: I = I + 1
If I
Print t
===============================================================================
Private Sub Command1_Click()
Dim lim As LARGE_INTEGER
Dim lagTick1 As LARGE_INTEGER
Dim lagTick2 As LARGE_INTEGER
'获得系统板上时钟频率
QueryPerformanceFrequ
ency lim
'将频率除以1000就的出时钟1毫秒震动的次数
Call QueryPerformanceCounter(lagTick1)
For f = 1 To 100000
a = a + f
Next
Call QueryPerformanceCounter(lagTick2)
Print (lagTick2.lowpart - lagTick1.lowpart) / lim.lowpart * 1000
'次数/频率=时间
'单位毫秒
End Sub
================================================================================
Option Explicit
' ′通过使用WithEvents关键字声明一个对象变量为新的命令按钮
Private WithEvents NewButton As CommandButton
' ′增加控件
Private Sub Command1_Click()
If NewButton Is Nothing Then
' ′增加新的按钮cmdNew
Set NewButton = Controls.Add("VB.CommandButton", "cmdNew", Me)
' ′确定新增按钮cmdNew的位置
NewButton.Move Command1.Left + Command1.Width + 240, Command1.Top
NewButton.Caption = "新增的按钮"
NewButton.Visible = True
End If
End Sub
' ′删除控件(注:只能删除动态增加的控件)
Private Sub Command2_Click()
If NewButton Is Nothing Then
Else
Controls.Remove NewButton
Set NewButton = Nothing
End If
End Sub
' ′新增控件的单击事件
Private Sub NewButton_Click()
MsgBox "您选中的是动态增加的按钮!"
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim a(17) As PictureBox
Private Sub Command1_Click()
cdtInit w, h
For i = 0 To 16
With a(i)
cdtDrawExt .hdc, 0, 0, 60, 80, i, 0, 0
.AutoRedraw = True
End With
Next
End Sub
Private Sub Form_Load()
For i = 0 To 16
Set a(i) = Form1.Controls.Add("vb.PictureBox", "Picture" & i)
With a(i)
.Left = 400 - 20 * i
.Top = 100
.width = 60
.height = 80
.Visible = True
.BorderStyle = 0
End With
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
cdtTerm
End Sub
===========================================================================
Dim x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X
y1 = Y
x2 = x1
y2 = y1
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button 1 Then Exit Sub
Picture1.DrawMode = 7
Picture1.Line (x1, y1)-(x2, y2), Picture1.BackColor
Picture1.Line (x1, y1)-(X, Y), Picture1.BackColor
x2 = X
y2 = Y
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
DrawMode = 13
Picture1.DrawMode = 13
Picture1.Line (x1, y1)-(X, Y)
End Sub