iam trying to use the code posted here
Clipboard event C#
it does work really great, but while testing, i found out that when copying from some application as example firefox, you will get the event running twice, so if you are saving the copied text to a textfile, or writing them to a textbox in the application, the text copied from firefox will appear twice ?
anybody can help me with this problem ?
thanks a lot
Store the last input, and if the new input is the same as the last, discard ?
Try it on a "bare" system to ensure that you aren't getting an "echo" somewhere. There should only be one notification. However, if soemthing else alters the clipboard during the event, you can get two. For example, a clipboard-driven text scrubber.
You can also get multiple events if the app doing the copying does it wrong. Such as when apps open/close the clipboard for each data format (they should not, this is a bug if they do). Try copying from plain old Notepad and see if you "hear" the event twice or not.
Do you have any plug-ins runnign within FF? It sounds like you do. Try it on a "bare" system with brand-new FF and nothing else.
Related
I have two Win7 boxes on the same network. These boxes need to FTP certain files from a server within the same network. I have a long script which implements an FTP method.
Box 1 - Code works normally, absolutely no problems encountered.
Box 2 - Code breaks as soon as FTP method is encountered ( Exception is caught and an error box is shown. So i know exactly where the code breaks). Not sure what the issue is. I thought maybe something settings are wrong. But I am able to login to the server via command line and FTP the files via command line.
Definitely not a problem with the code. Both boxes have same versions of the code. Tried comparing firewall and IIS settings on the two boxes and everything looks ok. Any ideas or suggestions would be appreciated. Thanks!
Thanks for your help. We decided to clone the problematic box with an image of the box that works alright. Everything is fine for now, need to find the root cause of the problematic box later on.
I got one requirement which is when the user copy any text the system should get the copied text from the memory into the program without require the user to paste it in a txtbox or similar control. I searched on the internet but I didn't get any information. can somebody suggest or provide some references so that I can follow...????
any help would be highly appreciated...!!!!
From a web development standpoint, you can not access the clipboard directly. You will have to create either a Flash or Silverlight hook into the clipboard to get the data.
Example
Another Example
For security reasons, you will never be able to do that in Javascript.
As it is already pointed out accessing clipboard is either not possible or restricted for security reasons for all components running on a page in a browser (restricted == is unlikely to be enabled by anyone, especially for such "spy on clipboard" purpose).
For standalone application you can either scan clipboard all the time or use clipboard filters.
Native functions are around SetClipboardViewer and GetClipboardData.
Managed: Clipboard.
I have a C# solution which contains a project and a class library written by somebody else. The class library gets GPS data via wifi. The project shows the processed data on a map. Now, I want to see the contents of some variables in the class library in real time for the sake of debugging.
I tried to use
System.Diagnostics.Debug.Write(value)
without success. It seems it does not do anything.
Also I tried "MessageBox.Show(value.ToString())" which was good but it stopped the wifi reading and interrupted the program as I needed to press OK button each time that it showed up.
Moreover, I added a windows form (which contained a textBox) to the class library to print the data in the textBox, however, when I wrote:
Form1.textBox1.Text = value.ToString()
It gives me this error:
Error 3 'MapNMEA.Form1.textBox1' is inaccessible due to its protection level C:\Users\john\Documents\Visual Studio 2010\Projects\new ver of map purecom\MapExplorer\MapExplorer\MapNMEA\MapNMEA\SerialPort.cs 184 27 MapNMEA
"MapNMEA" is the name of the class library. Also "MapExplorer" is the name of both solution and the project. "SerialPort.cs" is a file inside the class library in which I wrote the above code.
My question is how to show the content of those variable (they are 3,4 variables) in real time and this act should not stop the wifi reading. I need to do this as an electrician who does not know much about programming wants to check whether a GPS device sends the data to my computer correctly or not.
UPDATE 1: Actually I noticed that System.Diagnostics.Debug.Write(value) is working but as there was too many warning messages showing up in the debug window, I did not noticed it. Now, if somehow I could remove (or hide) other (warning) messages, I would see only my desired output. Do you know?
Debug.Write should be fine if you attach a listener first (Debug.Listeners.Add( new _a_listener_type() )).
Also, you should probably be aware of the AutoFlush property on the Debug class which determines whether or not Flush is automatically called.
Debug.Write should work - by default it will write to the 'Debug' window in Visual Studio if you have the debugger attached. Are you sure you're looking in the right place?
If you want to use the form approach, you need to keep track of the instance of the form which is open, and give it a public method. For example:
public void WriteDebug(string message) {
TextBox1.Text += message + Environment.NewLine;
}
Then you can call formInstance.WriteDebug(message);.
Do you run debug build? Also your code with textbox does not work, because textBox1 is non-public
I think you may not be searching the right location: Is there something preventing you from debugging on a PC first before going to a target? If not, the you should probably use the traditional way: put spies on variables, use your IDE (Visual Studio) to watch them and so on.
If you actually NEED to run on target without advanced debug tools, then you might want to take a look at some easier solutions:
log them to a text file (append or replace, whatever you need), then have a viewer opened at hand
make another non-modal form with a textbox, and call a form2.writeDbgTextBox(String) every time you need to refresh
Be sure to remove this code on release (eg. by putting them in a #if DEBUG section)
And whatever happens, DO NOT try to write to an existing Message box! they are made to pop up and close, not to interact with your code.
I have a need to be able to drag and drop a groupwise email to my winform application and am not having any luck at all.
I am able to get a filename as such but it is only a name, not a path.
Every time I call
e.Data.GetData("FileContents", true))
or
e.Data.GetData("FileContents", false))
or
e.Data.GetData("FileContents"))
I get null returned.
Also, the GetFormats returns something strange and a simple Google search returned nothing. One of the formats was WPOF_DBOBJ_DRN.
If anyone has some insight on this it would be greatly appreciated.
Update:
Just to add a few more details about this, there is also nothing on the clipboard from the drag and drop. Also took a look at the groupwise editor and word perfect isn't even installed on my pc and is most definatly not the editor.
Have a look at the following links (I know, some of them are for Delphi, but you should get the idea):
Drag and drop from an email file attachment in GroupWise to a .NET application
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_21198933.html
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23015275.html
I'll take a look at trying that. I've also tried to implement the IStorage interface into an IDataObject interface using unmanaged code and still aren't having any luck. (The Interface is also used to get Outlook messages that are dragged and dropped and works fine.)
That format is most definatly one of the formats i get back from calling e.Data.GetFormats();
I'll take a look at that link. Thanks
WPOF_DBOBJ_DRN looks like WordPerfect Office Format - Database Object. I can't figure out what the DRN stands for though. See if you can open the unreadable file with Word, or WordPerfect if you have it. My guess is that the setup of GroupWise that you are using has WordPerfect as its editor.
We have a pair of applications. One is written in C# and uses something like:
string s = "alpha\r\nbeta\r\ngamma\r\ndelta";
// Actually there's wrapper code here to make sure this works.
System.Windows.Forms.Clipboard.SetDataObject(s, true);
To put a list of items onto the clipboard. Another application (in WinBatch) then picks up the list using a ClipGet() function. (We use the clipboard functions to give people the option of editing the list in notepad or something, without having to actually cut-and-paste every time.)
In this particular environment, we have many users on one system via Citrix. Many using these pairs of programs.
Just one user is having the problem where the line delimiters in the text are getting switched from CRLF to LF somewhere between the SetDataObject() and the CLipGet(). I could explain this in a mixed Unix/Windows environment, but there is no Unix here. No unix-y utilities anywhere near this system either. Other users on the same server, no problems at all. It's like something in Windows/Citrix is being "helpful" when we really don't want it, but just for this one guy.
Ideas?
Have you tried clearing their profile on Citrix? That seems to be the solution to many many user specific Citrix problems.
Does Environment.NewLine behave differently on Citrix environments? If so, it may give you a good option that works for all users instead of \r\n.