VB 程序设计

10个成员

VB编程的几个API函数的应用问题

发表于 2016-12-24 3460 次查看
  Q :--怎样在我的程序中实现文件下载

  Re:

  一个例子:一个Command,两个Text 代码如下:

     Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long

   Private Sub Command1_Click()

     Dim sDownload As String

     sDownload = StrConv(Text1.Text, vbUnicode)

     Call DoFileDownload(sDownload)

     End Sub

   Private Sub Form_Load()

     Text1.Text = "http://www.chat.ru/~softdaily/fo-ag162.zip"

     Form1.Caption = "Audiograbber 1.62 Full"

     Text2.Text = "http://www6.50megs.com/audiograbber/demos/cr-ag161.zip"

     End Sub

  Q :--如何在vb中定义一个热键,使得当一个应用程序的窗口最小化后,可以通过热键来唤醒它

  Re:

  先声明API函数SendMessage,然后添加一个按钮和如下代码;

     Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVa l hwnd As Long, ByVal_    wMsg As Long, ByVal wparam As Long, lparam As Any) As Long

   Private Sub Command1_Click()

     Dim wKey As Long

     wKey = 66

     X = SendMessage(Me.hwnd, WM_SETHOTKEY, wKey, 0)

     MsgBox "B 键将激活窗体!", 64, "定义快捷键"

     End Sub

  

  enjoy it!

 

发表回复
你还没有登录,请先登录注册