用 SavePicture Form1.Image, "E:\1.BMP"是保存不了窗体上控件的
可以用VB模拟ALT+PRINTSCREEN(复制当前活动窗口到剪贴板)
然后用savepicture clipboard.getdata(vbCFBitmap),filename
SavePicture Image, "E:\2.BMP"
直接使用 Image
已经测试过,如果直接在form的属性窗口中设置picture属性,是可以的,并且生成的图可以看到内容。
终于解决了:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Sub Form_Click()
keybd_event 18, 0, 0, 0
keybd_event vbKeySnapshot, 0&, 0&, 0&
DoEvents
keybd_event 18, 0, KEYEVENTF_KEYUP, 0
SavePicture Clipboard.GetData, "c:\abc.bmp"
End Sub
你听谁说Print Screen没有键位码的?
Print Screen一直就有键位码
一查就出来了