易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : vb

VB怎样判断、防止程序重复执行

Private Sub Form_load()
    '判断程序是否已经运行
    If App.PrevInstance
Then
     MsgBox "本程序已经运行!", vbInformation Or vbOKOnly, "提示信息"
     Unload
Me
     Exit Sub
    End If
    '以下是主要程序
    ' ……
    End
Sub
    附:另一个例子:
    Option Explicit
    Public Sub CheckExist(fm
As Form) '防止程序重复执行
      Dim title As String
      If App.PrevInstance
Then
      title = App.title
      Call MsgBox("这程序已执行",
vbCritical)
      App.title = "" '如此才不会 Avtivate 到自己
      fm.Caption =
""
      Ap ......

VB 编程中如何使窗口右上角的关闭按钮(X)失效

1、Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As
Integer)
        Cancel = True
       End Sub
    2、Private Sub
Form_Unload(Cancel As Integer)
        Cancel = True
       End Sub ......

vb程序中webbrowser 接受SendMessage 的消息

webbrowser 不能收到SendMessage的消息
主要是因为1webbrowser 的句柄找不到。经过努力搜索,终于解决了。做个记录.
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
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 Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const MK_LBUTTON = &H1
'获得webbrowser的句柄
Public Function GetBrowserWindow(窗体句柄 As Long) As Long
    Dim hwndPeer As Long
    hwndPeer = FindWindo ......

用VB画4个点的NURBS曲线参考代码

Dim p(10000, 1) As Double
Dim num As Integer
Dim ptx As Single
Dim pty As Single
Dim w0, w1, w2, w3 As Single
Private Sub Command1_Click()
Dim t As Single
 Dim i As Integer
 Dim f0, f1, f2, f3 As Single
 Picture1.DrawWidth = 3
      For t = 0 To 1 Step 1 / 1000
      w0 = Val(Form1.Text1.Text)
      w1 = Val(Form1.Text2.Text)
      w2 = Val(Form1.Text3.Text)
      w3 = Val(Form1.Text4.Text)
       f0 = 1 / 6 * (-t ^ 3 + 3 * t ^ 2 - 3 * t + 1)
       f1 = 1 / 6 * (3 * t ^ 3 - 6 * t ^ 2 + 4)
       f2 = 1 / 6 * (-3 * t ^ 3 + 3 * t ^ 2 + 3 * t + 1)
       f3 = 1 / 6 * (t ^ 3)
         ptx = (f0 * p(0, 0) * w0 + f1 * p(1, 0) * w1 + f2 * p(2, 0) * w2 + f3 * p(3, 0) * w3) / (f0 ......

VB获取执行程序图标

一个CommonDialog,一个CommandButton,一个PictureBOX
Option Explicit
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Private Sub Command1_Click()
Dim total As Long
Dim p(50) As Long
Dim i As Integer
Me.Picture1.Cls
Me.CommonDialog1.Filter = "图标|*.Exe;*.Ico;*.Dll"
Me.CommonDialog1.ShowOpen
If Dir(Me.CommonDialog1.FileName) <> "" Then
If ExtractIcon(App.hInstance, Me.CommonDialog1.FileName, -1) = 0 Then '如果没有图标
MsgBox "No Icon!"
Else
total = ExtractIcon(App.hInstance, Me.CommonDialog1.FileName, -1)
'取得总图标数
For i = 0 To total - 1
p(i) = ExtractIcon(App.hInstance, Me.CommonDialog1.FileName, i) '读取每个图标
Next i
For i = 0 To total - 1 '依次显示 ......

VB设置进程优先级

http://topic.csdn.net/t/20060401/19/4656391.html
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function SetPriorityClass Lib "kernel32" (ByVal hProcess As Long, ByVal dwPriorityClass As Long) As Long
Const IDLE_PRIORITY_CLASS = &H40 '新进程应该有非常低的优先级——只有在系统空闲的时候才能运行。基本值是4
Const HIGH_PRIORITY_CLASS = &H80 '新进程有非常高的优先级,它优先于大多数应用程序。基本值是13。注意尽量避免采用这个优先级
Const NORMAL_PRIORITY_CLASS = &H20 '标准优先级。如进程位于前台,则基本值是9;如在后台,则优先值是7
Dim CurrentProcesshWnd As Long '当前进程句柄
Private Sub Form_Load()
CurrentProcesshWnd = GetCurrentProcess
If (SetPriorityClass(CurrentProcesshWnd, HIGH_PRIORITY_CLASS) = 0) Then
MsgBox "设置当前进程优先级为高。失败!"
Else
MsgBox "设置当前进程优先级为高。成功!"
End If
End Sub
......
总记录数:380; 总页数:64; 每页6 条; 首页 上一页 [36] [37] [38] [39] 40 [41] [42] [43] [44] [45]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号