cancel
Showing results for 
Search instead for 
Did you mean: 

Printing directly from the Clipboard

Former Member
0 Kudos

Hi all,

I have a Problem with PB12.5.2.

The function

...

job = PrintOpen( )

result = PrintScreen(job, 1, 1, 7500, 6000)

PrintClose(job)

...

doesn't work in exe.

Now I want to use the Windows (global external function) function to get a hard copy to the clipboard.

...

keybd_event( 44,1,0,0 )

...

This works.

But how can I use to print directly from the clipboard without an external program? Does anyone have a solution? Thank you.

André

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ;

  Can you tell us ...

1) What error code(s) you encounter in your code?

2) Have you tried this on another version of PB (ie: 12.1)?

3) What MS-Window version are you trying this on?

4) Is this a real PC or a VM?

etc

Thanks ... Chris

Former Member
0 Kudos

Hi Chris, hi Scott,

The global external function is:

 

SUBROUTINE
keybd_event( int bVk, int bScan, int dwFlags, int dwExtraInfo) LIBRARY "user32.dll"

(cb_button)

keybd_event(44,1,0,0 )

return

 

now it is in the clipboard.

 

The return code in runtime-environment is 1, the return code in exe is 1. Only on
my development PC. But on other PC the exe is -1.

The installation has been installed with the runtime packer.

 

I don't have a other PB Version e.g. 12.1

 

I have Windows 7 and Windows 8.

 

It run in a real PC.

 

Thank you.

 

André

Former Member
0 Kudos

Hi all

I have found the bug why the hard copy does not work with PrintScreen().

In the runtime package there is the PBSHR125.DLL. This PBSHR125.DLL is broken after install the runtime package.

If you reinstalled the PBSHR125.DLL manually then it works fine.

André

Answers (1)

Answers (1)

Former Member
0 Kudos

Let's back up.  You posted an incomplete code snippet and a very simple claim ("doesn't work").  Can you clarify that?  Your snippet does no error checking - does your actual code include error checking (and if not why) and have you identified the line that fails (if any).  While we're at it, are you attempting to store the job number in an INT?  If so, that may be your problem since it should be a long.

Beyond that, you are making assumptions about the clipboard and how your code can / should interact with it.  AFAIK, once you "clip" the desktop and save it to the clipboard, it should be stored as an image (bitmap most likely).  At that point your code needs to deal with it as it would any other image.  So the question then becomes how to print an image from within PB.  We have a printbitmap function - but that requires you retrieve a bitmap from the clipboard.  I don't think PB has any functionality to do that so you may need to use the appropriate API function.  And it seems like you have done that before so it shouldn't be too difficult.

http://nntp-archive.sybase.com/nntp-archive/action/article/%3C4e12e9f5$1@forums-1-dub%3E