Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 24th, 2007, 07:11 AM
Authorized User
 
Join Date: Dec 2006
Location: , , India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Paste Clipboard Image

how to paste the clipboard image to the web form using JavaScript or

ASP.NET,I Pasted the Clipboard Text, but i failed to paste the image,

i read article that Clipboard.GetData('Image') can get the image from

clipboard but i cant able to get it,

Temp is my Img Box id,

Code:
<html>
<head>
<script>
function CopyToClip()
{
var div = document.getElementById('Temp');
div.contentEditable = 'true';
var cR;
if (document.body.createControlRange) 
{
cR = document.body.createControlRange();
cR.addElement(div);
cR.execCommand('Copy');
}
div.contentEditable = 'true';
}
function PasteToClip()
{
var div = document.getElementById('Temp');
div.contentEditable = 'true';
var cR;
cImg = new Image (400,112);
var cImg1;
if (document.body.createControlRange) 
{
cR = document.body.createControlRange();
cR.addElement(div);
cImg=cR.execCommand('Paste');

if(cImg != null)
{
//Temp.src=cImg;
document.getElementById('Temp').src=cImg;
alert("Holding");

}
}
div.contentEditable = 'true';
}

</script>
</head>
<body bgcolor="white">
<div id="copythis">
</div>
<form>
<div id="DivtoCopy">
<img src="C:\JpgImg.jpg" id="Temp">
</div>
<input type="button" value="Copy2ClipBrd" onclick="CopyToClip()">
<input type="button" value="Paste4rmClip" onclick="PasteToClip();">
</form>
</body>
</html>
which control can able to hold image other than image box,

please help

thanks in advance

Reply With Quote
  #2 (permalink)  
Old July 20th, 2007, 03:10 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is some code that can work fine.

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const KEYEVENTF_KEYUP = &H2

Private Function SaveFormPic() As Picture
  Dim pic As StdPicture
  Set pic = Clipboard.GetData(vbCFBitmap)
  keybd_event vbKeyMenu, 0, 0, 0
  keybd_event vbKeySnapshot, 0, 0, 0
  DoEvents
  keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
  keybd_event vbKeyMenu, 0, KEYEVENTF_KEYUP, 0
  DoEvents
  Set SaveFormPic = Clipboard.GetData(vbCFBitmap)
  Clipboard.SetData pic, vbCFBitmap
End Function

Private Sub Command1_Click()
  SavePicture SaveFormPic, "C:\MyPic.jpg" 'picture location
End Sub


http://www.softsea.com/
Reply With Quote
  #3 (permalink)  
Old January 22nd, 2008, 06:24 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

robertsnoog,
your example work fine, thanks

http://rbytes.net/soft/
Reply With Quote
  #4 (permalink)  
Old February 22nd, 2008, 03:46 PM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah

I just tried robertsnoog's code and it worked fine.

Thanks robert!



Discounted Softwares!!
Reply With Quote
  #5 (permalink)  
Old October 27th, 2008, 02:47 PM
Registered User
 
Join Date: Oct 2008
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Excelent code, i will test it and tell you how it is work !!

http://www.neosoftwork.com

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy kodak image edit control's image to clipboard vishwanathduddilla Visual Studio 2005 0 November 3rd, 2008 10:10 AM
Clipboard bschleusner C# 2005 1 February 16th, 2007 08:20 AM
Paste from clipboard and start to search paolo Word VBA 3 December 29th, 2006 03:47 AM
Want to paste image in back of another image snowbydave1 PHP How-To 0 November 27th, 2006 05:51 AM
the clipboard natmaster Java GUI 0 May 31st, 2004 03:16 PM



All times are GMT -4. The time now is 03:29 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.