?
Solved

Alt+PrintScreen to clipboard using powerbuilder

Posted on 2005-03-31
3
Medium Priority
?
2,007 Views
Last Modified: 2013-12-26
I want to use take a screenshot(like Alt+PrintScreen) in my MDI application and copy
the screenshot to the clipboard using PowerBuilder.
From the clipboard i want to paste it into a word document.

I do not want to use the available PB functions Print() and PrintScreen(),
as they send the screenshot directly to the printer.
0
Comment
Question by:shuja_khan5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 18

Expert Comment

by:diasroshan
ID: 13687141
hi,

here u are... the following code will give u the functionality of Alt+PrintScreen...

u need to declare a global external Function:
SUBROUTINE keybd_event( int bVk, int bScan, int dwFlags, int dwExtraInfo) &
  LIBRARY "user32.dll"


and in the clicked event of ur button(or wherever u please)... write the following code...
keybd_event( 44,1,0,0 ) //Alt+PrintScreen

//to print the whole desktop u need to write...
//keybd_event( 44,0,0,0 ) //PrintScreen



Cheers,
Rosh
0
 
LVL 18

Accepted Solution

by:
diasroshan earned 2000 total points
ID: 13687217
hi,

to dynamically open word and paste to it u can write the following code in ur button event...

//code to print screen...
keybd_event( 44,1,0,0 ) //Alt+PrintScreen

//code to paste into word...
oleobject lole_word
Long ll_rc

lole_Word = CREATE OleObject
ll_RC =   lole_Word.ConnectToNewObject( 'Word.Application' )
IF ll_RC <> 0 THEN
DESTROY lole_Word
RETURN
END IF

//If the connection is successful, use OLE automation to paste the contents from the Clipboard directly into Word and finally display Word:
lole_Word.Documents.Add()
lole_Word.Selection.Paste()
lole_Word.Application.Visible = True
lole_Word.DisconnectObject()
DESTROY lole_Word


Cheers,
Rosh
0
 
LVL 18

Expert Comment

by:diasroshan
ID: 13695919
hi,

more assistance ???

Cheers,
Rosh
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question