免費論壇 繁體 | 簡體
Sclub交友聊天~加入聊天室當版主
分享
返回列表 回復 發帖

揭露AutoHotkey絕技 VB 最簡單攝影鏡頭監控

揭露AutoHotkey絕技
http://jdev.tw/blog/734/autohotkey-introduction-chinese

WIKI
https://zh.wikipedia.org/zh-tw/AutoHotkey

Google瀏覽器加上AutoHotKey 更方便你的網路生活
http://demo.tc/post/557


讓我按Esc鍵時自動終止正在執行中的該支AutoHotkey程式,
其實只要在你的程式中加上一行
『Esc::ExitApp』
就可以了。

完整程式範例可到這裡下載:

http://w16.easy-share.com/f/1325953227.html
1、點選『exitByEsc.ahk』
2、輸入驗証碼
3、按下『Download this file』開始下載

範例內容:
按下 Windows Key+n 開啟記事本,
按 Esc 結束程式。



AutoHotkey 0级入门教程:让重复工作一键完成 (2011-10-24修订)
http://xbeta.info/autohotkey-guide.htm











VB 最簡單攝影鏡頭監控

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 capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hwndParent As Long, ByVal nID As Long) As Long

Private Const GET_FRAME As Long = 1084

Private Const COPY As Long = 1054

Private Const CONNECT As Long = 1034

Private Const DISCONNECT As Long = 1035

Private CapHwnd As Long


Private Sub Command1_Click()

'打開攝像頭

CapHwnd = capCreateCaptureWindow("WebcamCapture", 0, 0, 0, 640, 480, Me.hwnd, 0)

DoEvents

SendMessage CapHwnd, CONNECT, 0, 0

Timer1.Enabled = True

End Sub

Private Sub Command2_Click()

'停止攝像頭

DoEvents

SendMessage CapHwnd, DISCONNECT, 0, 0

Timer1.Enabled = False


End Sub

Private Sub Form_Load()

'幾句代碼實現控制攝像頭,有攝像頭的進哦

Combo1.AddItem "160*120"

Combo1.AddItem "176*144"

Combo1.AddItem "320*240"

Combo1.AddItem "352*288"

Combo1.AddItem "640*480"

Combo1.ListIndex = 0


End Sub

Private Sub Timer1_Timer() 'timer1.Interval=50

On Error Resume Next

SendMessage CapHwnd, GET_FRAME, 0, 0

SendMessage CapHwnd, COPY, 0, 0

Picture1.Picture = Clipboard.GetData


Clipboard.Clear


End Sub
返回列表