473,769 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ThreadStateExce ption & Clipboard

I'm trying to get Clipboard data from across the network to get a screenshot.

I hit a button on the server, it sends a request to the client, when the
client get's the request it does a SendKeys.SendWa it("%{PRTSC}") , then when
i make the call Clipboard.GetIm age() a ThreadStateExce ption is thrown. The
[STAThread] attribute is defined on the main. Any ideas?
Nov 17 '05 #1
5 2503
A little update on things I've tried since the post. I've tried creating a
new Thread setting it's apartment type to STA and then running the code to
take the screenshot and send back to the server, but this gives me the
screenshot of the server (not the client), I have also tried calling
Client.Invoke() with a delegate defined that takes the screenshot, this too
takes a screenshot of the server and not the client.

"Jaret Brower" wrote:
I'm trying to get Clipboard data from across the network to get a screenshot.

I hit a button on the server, it sends a request to the client, when the
client get's the request it does a SendKeys.SendWa it("%{PRTSC}") , then when
i make the call Clipboard.GetIm age() a ThreadStateExce ption is thrown. The
[STAThread] attribute is defined on the main. Any ideas?

Nov 17 '05 #2
Hi Jaret,

It seems that you have resolved the ThreadStateExce ption problem, and comes
to a new issue that cannot get the client screenshot. Could you let me know
if the client and server are both Windows form applications? Also, it would
be helpful if you could post your server code and client code that takes
the screenshot here. Thank you for your cooperation.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #3
Both Server and Client are Windows Forms apps.

here's the pseudocode:
The server sends a string "SCREENSHOT " over to the client, if the client
receives that string, I call,

---CLIENT----
if(str = "SCREENSHOT ")
Invoke(TakeScre enshot())
TakeScreeshot()
{
SendKeys.SendWa it("%{PRTSCR}") ;
Image img = Clipboard.GetIm age();
Save Image to Memory Stream
Send MS.buffer to Server
}

All the network send/receive work properly the only problem is that I'm
getting the contents of the server's clipboard, not the client.
}

"Kevin Yu [MSFT]" wrote:
Hi Jaret,

It seems that you have resolved the ThreadStateExce ption problem, and comes
to a new issue that cannot get the client screenshot. Could you let me know
if the client and server are both Windows form applications? Also, it would
be helpful if you could post your server code and client code that takes
the screenshot here. Thank you for your cooperation.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #4
Hi Jaret,

It seems that the pseudocode is fine. Could you let me know how you sent
the SCREENSHOT string to the client? Also, I suggest you try to check if
the string has been sent to the real client side, and on which machine did
the TakeScreenshot method run.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #5
Hi Jaret,

It seems that the pseudocode is fine. Could you let me know how you sent
the SCREENSHOT string to the client? Also, I suggest you try to check if
the string has been sent to the real client side, and on which machine did
the TakeScreenshot method run.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2559
by: tabonni | last post by:
Hi all I want to create an ASP page, which can copy the real PDF files into the clipboard and then the user can paste it in Outlook message as attachments(it's like inserting attachments) My idea is: When user checked the checkboxes for the requested PDF files from ASP page and press the "Add To Clipboard" button, all requested PDF files will be copied into clipboard. Then, the user open MS outlook message and right click -> Paste all...
5
4343
by: tabonni | last post by:
Hello All I am creating an ASP page. There are a list of filename and checkbox next to it. When user checked all the documents they want and click ADD TO CLIPBOARD button. All filepaths will be copied into clipboard and then they can right-click -> paste into MS Outlook as attachments. How can I use clipboardData.setData function to do that? I saw a lot of examples they are just copy and paste text.
7
18023
by: William Gill | last post by:
Is there a simple way to cut and paste from a tkinter text widget to an entry widget? I know I could create a mouse button event that triggers a popup (message widget) prompting for cut/paste in each of the widgets using a temp variable to hold the text, but I don't wnat to reinvent the wheel if there already is something that does the job. Thanks, Bill
12
6181
by: PMA | last post by:
Hi all, I am porting a web application from IE 6.0 to FireFox 1.5. I have solved almost all compatibility issues (quite a lot but not too bad) except two of them : 1) Clipboard access thru' JavaScript (programmatical copy and paste actions) 2) Monitoring and driving Insert/Overwrite mode on input fields
0
2033
by: angshuman.agarwal | last post by:
Hi, I have a owner drawn combo box (using .Net 2.0 Framework). I have written the Nunit test for the same. I am setting the AutoCompleteSource Property (AutoCompleteSource.CustomSource) and AutoCompleteMode Property (AutoCompleteMode.Append) for the Combo at runtime and also have hidden these properties at design time. Now, when I am testing the function where I am setting AutoCompleteSource & AutoCompleteMode values, the Nunit...
0
1309
by: =?Utf-8?B?UGV0ZQ==?= | last post by:
This is a duplicate of a posting on Officedev so apologies to anyone who's read this already. I had an Office add-in built in VB.Net 2003 with an Excel and a Word add-in class that transferred data from Excel to Word using the clipboard. It worked well until I developed a new version using VS 2005 and VSTO (the Excel and Word add-ins are now separate DLLs). Now I find that after placing data on the clipboard using the Excel.Range.Copy...
2
1336
by: Jeff | last post by:
Hey In VS2005 I've copied some text to the clipboard, but when I paste it, I get something I previuosly added to the clipboard. I thought a reboot of my computer would help, but it didn''t.... after this problem occured, I've done a test where I copyed text from TextPad to vs2005 and that works. - but after this test, I again tryed to copy & paste within vs2005, but vs2005 pastes something I've previously
2
14298
by: toronto | last post by:
Seasons Greetings Everyone! I want to use JavaScript's event object to detect whether someone has pressed the 'PrintScreen' key to screenshot, via the Windows Clipboard, and to print website content I don't want printed... It occurred to me that the easiest way to do this is to erase or replace the contents of the Windows Clipboard... Some code snippets I found at webdeveloper.com forums:
0
1928
by: =?Utf-8?B?SHVtYW0=?= | last post by:
I am developing a windows service that reads from the serial port and then put the data read from the serial to the clipboard, so the client can use Ctrl + v to paste, I am using Clipboard.Clear(); Clipboard.SetData(DataFormats.Text, (Object)IDCard.FirstName); but for some reason it seems that the clipboard does not fill up with data. Is there any security restriction of calling the clipboard methods from the same thread that the windows...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.