Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2083
  • Last Modified:

Alt+PrintScreen to clipboard using powerbuilder

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
shuja_khan5
Asked:
shuja_khan5
  • 3
1 Solution
 
diasroshanCommented:
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
 
diasroshanCommented:
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
 
diasroshanCommented:
hi,

more assistance ???

Cheers,
Rosh
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now