本人正在做一个远程桌面控制软件,但是下面几个问题非常头疼,请大家帮忙!
1、抓屏时如何连鼠标一起抓取到图片中?
2、桌面分辨率是32位真彩,但我想把抓取的图片转换成64K色,如何实现?
3、bmp转换成jpg用什么控件好?哪里下载?
请尽量提供源代码,谢谢!
1、抓屏时如何连鼠标一起抓取到图片中?
2、桌面分辨率是32位真彩,但我想把抓取的图片转换成64K色,如何实现?
3、bmp转换成jpg用什么控件好?哪里下载?
请尽量提供源代码,谢谢!
截屏保存成jpg
x As Long
y As Long
End Type
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 GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
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 ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetCursor Lib "user32" () As LongPrivate Sub Command1_Click()
Dim hdc As Long, nWidth As Integer, nHeight As Integer, nScreenWidth As Integer, nScreenHeight As Integer
Dim CurPos As POINTAPI
Dim Cur As Long
Me.Hide
DoEvents
Picture1.AutoRedraw = True
hdc = GetDC(0)
nScreenWidth = Screen.Width
nScreenHeight = Screen.Height
Picture1.Width = nScreenWidth
Picture1.Height = nScreenHeight
nWidth = nScreenWidth / Screen.TwipsPerPixelX
nHeight = nScreenHeight / Screen.TwipsPerPixelY
BitBlt Picture1.hdc, 0, 0, nWidth, nHeight, hdc, 0, 0, vbSrcCopy
Me.Show
GetCursorPos CurPos
Cur = GetCursor
DrawIcon Picture1.hdc, CurPos.x - 10, CurPos.y - 10, Cur
ReleaseDC 0, hdc
Picture1.AutoRedraw = False
End Sub