以前在WinXP+VB6 時有接觸過螢幕截圖
找了一下還蠻單純的
使用三個 WinAPI
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
程式碼:
PHP 語法:
Private Sub mCopyScreen_Click()
Dim hDC As Long, sx As Integer, sy As Integer
Me.Hide
DoEvents ' 若不執行此一敘述,可讓 Me.Hide 不會即時被執行
picCopy.Width = Screen.Width
picCopy.Height = Screen.Height
picCopy.AutoRedraw = True
' 圖像的轉移
hDC = GetDC(0) ' 取得螢幕DC
sx = Screen.Width \ Screen.TwipsPerPixelX ' 螢幕寬度(以Pixel為單位)
sy = Screen.Height \ Screen.TwipsPerPixelY ' 螢幕高度(以Pixel為單位)
' 將螢幕DC的圖像轉移到名稱為picCopy的PictureBox中
BitBlt picCopy.hDC, 0, 0, sx, sy, hDC, 0, 0, vbSrcCopy
ReleaseDC 0, hDC ' 釋放螢幕DC
picCopy.AutoRedraw = False
SetPicture ' 設定 PictureBox 與捲動軸之間的關係
Me.Show
End Sub
(試了一下在Windows 10依舊可執行)
只要看得懂要翻譯成C/C++應該很簡單
HyperSnap 除了截圖
就是喜好他的畫箭頭與文字框
拿來製作簡單的說明用圖解很好用
不過覺得要用向量製圖還是首推
Corel Draw 或 Adobe Illustrator
只是屬於大型套裝軟體開啟速度不如HyperSnap
所以目前還是偏好HyperSnap