-
June 17th, 2024, 04:23 PM
#1
Create Bitmap file From Clipboard Help C++
Hello.
I'm new to the forum and like it, I have learned a lot here but now I have my own question. I really need help, I've tried everything I found online for days now.
I am new to C++ but learning fast. I created a program, and it needs to take a sceenshot and save as an image file.
I managed to get my program to store the screenshot in the clipboard ok, but making my program press key 0x2C which is "prt sc" key.
So it stores the screenshot ok, I was able to paste into MS Paint. But getting my program to create a Bitmap on it's own has been a long frustrating
beating my head against the wall week from hell. I am lost. Most of the examples I found would not compile in Codeblocks, and no guidance came with the code.
a majority of what I found out there doesn't show any "file name" or "path" in the code so I have zero clue where it's "saving" the image to.
I really need help with this one part. my code makes a .bmp but it's not working when I open thee photo. it says "format not supported" and shows blank screen.
I got really far with my program so far, it does a lot, but I'm stuck on this one function. I need t get the clipboard data saved as a photo on my C:// drive. that's it !!
why is this so difficult ??? here's my code.
Code:
#include <windows.h>
int main()
{
OpenClipboard(NULL);
GetClipboardData(CF_BITMAP);
HBITMAP hBitmap = (HBITMAP)GetClipboardData(CF_BITMAP);
FILE *output;
output=fopen("C:/docs/data/img/scr.bmp","a+");
// fopen("C:/docs/data/img/scr.bmp", "a+");
fprintf(output,"%s",hBitmap);
}
-
June 18th, 2024, 01:06 AM
#2
Re: Create Bitmap file From Clipboard Help C++
I'd recommend you to check out the Microsoft Clipboard documentation including the Using the Clipboard
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|