473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

GetClipboardData(CF_BITMAP) unimplemented

Win32all folks:

I am attempting to use win32all to perform screen captures and save
the bitmap to a file. The call to GetClipboardData fails saying
GetClipboardData(CF_BITMAP) is unimplemented. Any ideas?

My code looks something like this:

win32api.keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0)
win32clipboard.OpenClipboard()
format = win32clipboard.EnumClipboardFormats()
data = win32clipboard.GetClipboardData(format)
win32clipboard.CloseClipboard()
writeFile = open('outfile.bmp','w')
writeFile.write(data)
writeFile.close()
Jul 18 '05 #1
3 4375
Hi !
And the same for .SetClipboardData(
Please... Please ?

Thanks by advance.


Jul 18 '05 #2
It's just that nobody has written code yet to do anything with the returned
bitmap handle. However, you can still do screen captures without it.
The below code should also work with just about any window handle,
not just the desktop
Roger

import win32gui, win32ui, win32con
hwnd=win32gui.GetDesktopWindow()
l,t,r,b=win32gui.GetWindowRect(hwnd)
h=b-t
w=r-l
hDC = win32gui.GetWindowDC(hwnd)
myDC=win32ui.CreateDCFromHandle(hDC)
newDC=myDC.CreateCompatibleDC()

myBitMap = win32ui.CreateBitmap()
myBitMap.CreateCompatibleBitmap(myDC, w, h)

newDC.SelectObject(myBitMap)
newDC.BitBlt((0,0),(w, h) , myDC, (0,0), win32con.SRCCOPY)
myBitMap.Paint(newDC)
myBitMap.SaveBitmapFile(newDC,'c:\\tmp.bmp')

"Kyle Harrigan" <kw********@yahoo.com> wrote in message
news:90**************************@posting.google.c om...
Win32all folks:

I am attempting to use win32all to perform screen captures and save
the bitmap to a file. The call to GetClipboardData fails saying
GetClipboardData(CF_BITMAP) is unimplemented. Any ideas?

My code looks something like this:

win32api.keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0)
win32clipboard.OpenClipboard()
format = win32clipboard.EnumClipboardFormats()
data = win32clipboard.GetClipboardData(format)
win32clipboard.CloseClipboard()
writeFile = open('outfile.bmp','w')
writeFile.write(data)
writeFile.close()

Jul 18 '05 #3
Hi !

For screen-capture, with PIL, you can do too :

import Image, ImageGrab
ImageGrab.grab().save(filename)

But the question talk of CLIPBOARD and bitmap.

@+
--
Michel Claveau

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: yxq | last post by:
Hello I want to get Windows clipboard data size, seem to use the function "GetClipboardDataSize". Could anyone please tell how to do using vb.net? Thanks
5
by: exhuma.twn | last post by:
As many might know, windows allows to copy an image into the clipboard by pressing the "Print Screen" button on the keyboard. Is it possible to paste such an image from the clipboard into a "Text"...
8
by: active | last post by:
Guess I'm looking for someone who likes to work difficult puzzles. I can't seem to ever retrieve a palette handle from the clipboard. Below is a simple test program that demonstrates the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.