Hi Dan,
You could still use Chris' idea but change the printer to Microsoft Print To PDF but there may still be some user interaction required, that you don't want, to choose the file name, save location etc. which, without invoking a number of additional APIs, I don't recall can easily be done.
As also suggested by Chris, Roland's code will allow you to do what you want and probably with a few more options than what I'm going to suggest. However, if you don't need the extra options you can accomplish this with one windows API and then do what you need to do by way of e-mailing the image etc.
This approach simulates keyboard key presses using the Windows keybd_event API. It's pretty simple to use and you can capture the entire screen via the Windows key + PrintScreen key...this will save the file automatically in C:\Users\USERNAME\Pictures\Screenshots. You can also use the Windows + Alt + PrintScreen keys which will save the active window in C:\Users\USERNAME\Videos\Captures. So the code would look something like this:
External Subroutine Declaration
Subroutine keybd_event(uint bVk,uint bScan,long dwFlags,long dwExtraInfo ) library 'user32.dll'
I've highlighted Subroutine above as this does not return a value so it needs to be declared as a Subroutine versus a Function.
Code for first approach
Integer li_windows_key = 91, li_print_screen_key = 44
//Press the keys
keybd_event(li_windows_key,0,0,0)
keybd_event(li_print_screen_key,0,0,0)
//Release the keys
keybd_event(li_windows_key,0,2,0)
keybd_event(li_print_screen_key,0,2,0)
Just another approach...HTH.
Regards,
Mark
Yes, that would be for printing. For the clipboard, try Roland's code ...
http://www.topwizprogramming.com/freecode_bitmap.html
Regards ... Chris