473,756 Members | 3,973 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 2500
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
4341
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
18020
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
6180
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
2032
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
14297
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
1926
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
9455
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
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
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...
0
9708
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
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
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2665
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.