KKQQ Posted September 5, 2005 Posted September 5, 2005 I have created a blank form with something drawn using drawing class. I have tried to use Bitblt to copy the screenshot of the form to a bitmap variable. However, the .net compact framework seems not supporting Bitblt in the same way. I need an alternative to capture the screenshot without Bitblt!~ Quote
rustyd Posted September 6, 2005 Posted September 6, 2005 (edited) SendKeys.SendWait("%{PRTSC}") Dim iData As IDataObject = Clipboard.GetDataObject() If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bmp As Bitmap = iData.GetData(DataFormats.Bitmap) ' TODO: Replace newfilename with the new filename to save screen shot as bmp.Save(<newfilename>, Imaging.ImageFormat.Bmp) bmp.Dispose() End If Edited September 6, 2005 by rustyd Quote rustyd
KKQQ Posted September 8, 2005 Author Posted September 8, 2005 SendKeys.SendWait("%{PRTSC}") Dim iData As IDataObject = Clipboard.GetDataObject() If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bmp As Bitmap = iData.GetData(DataFormats.Bitmap) ' TODO: Replace newfilename with the new filename to save screen shot as bmp.Save(<newfilename>, Imaging.ImageFormat.Bmp) bmp.Dispose() End If Thanks very much for the codes I'm using this on compact framework that runs on pocket pc and some classes / methods above are not supported by c.f. directly (e.g. sendkeys, .Save, etc.). Would that possible to covert the code above to a c.f. compatible version ? Quote
Leaders snarfblam Posted September 11, 2005 Leaders Posted September 11, 2005 SendKeys.SendWait("%{PRTSC}") Dim iData As IDataObject = Clipboard.GetDataObject() If iData.GetDataPresent(DataFormats.Bitmap) Then Dim bmp As Bitmap = iData.GetData(DataFormats.Bitmap) ' TODO: Replace newfilename with the new filename to save screen shot as bmp.Save(<newfilename>, Imaging.ImageFormat.Bmp) bmp.Dispose() End If Just a warning about this code: the unsespecting user will lose the data he has stored on the clipboard. Possible solution: grab what is on the clipboard and restore it after your screen capture operation. Quote [sIGPIC]e[/sIGPIC]
joe_pool_is Posted June 18, 2008 Posted June 18, 2008 If KKQQ is still following this: KKQQ: Did you ever find a replacement for SendKeys in the Compact Framework? I just ran into the same troubles over here. Hopefully, you found an answer to this within the last 3 years. :) Quote Avoid Sears Home Improvement
Nate Bross Posted June 18, 2008 Posted June 18, 2008 I don't have an easy to test, but this looks promising: http://www.egilh.com/blog/archive/2006/04/15/2614.aspx Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.