Drag and Drop a Groupwise Email to C# Winform - c#

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.

Related

Why cant I get Data from ClipBoard trough an Remote Desktop session?

I want to get the Data from the ClipBoard on an RemoteDesktop.
The Data Ive getting is an path of an File I have in ClipBoard
The Code im using looks like this:
IDataObject data = Clipboard.GetDataObject();
if (!data.GetDataPresent(DataFormats.FileDrop))
return;
string[] filePath = (string[])
data.GetData(DataFormats.FileDrop);
And for the local Computer its working perfectly.
But when Im using the Programm on an Remote Computer I cant use the ClipBoard there.
Clipoard is activated on Remote so If i want to paste something from my ClipBoard normal on the Remote Computer its working but my Code dosent find an ClipBoard.
Someone an Idea?
I don't think DataFormats.FileDrop is the correct format for what you want. According to MSDN:
Use this format to interact with shell file drags during drag-and-drop operations.
You don't want drag-and-drop, you're using the clipboard.
You can call data.GetFormats() to get a list of the available formats the object supported by on the clipboard. When I test this I see two formats that may be useful to you: FileGroupDescriptorW and FileContents. I would suggest looking into those and learning how to parse the data therein.
One place you might look to get started with FileGroupDescriptorW is here. They're doing something lightly different (trying to get drag and drop from Outlook), but they make use of FileGroupDescriptorW and have all the needed definitions that are currently missing from pInvoke.net.

Programmatically add text to the clipboard in C#

Is there a way to programmatically add text to the clipboard in C# (3.5) or javascript ? Does the client machine type make a difference?
Edit: Sorry, forgot to mention am using asp.net.
You can use Clipboard.SetText(string) and Clipboard.GetText() to interact with the clipboard.
See the MSDN article
As long as the client supports .NET, it shouldn't make a difference.
Oh, for the web...
Then use something like this jQuery plugin:
http://plugins.jquery.com/project/clipboard
It will allow you to copy and paste from the clipboard across browsers.
C#: In System.Windows.Forms you have a Clipboard class and a SetText method which probably is what you're looking for. Example:
Clipboard.SetText("My text");
Edit: Since you're looking for a way to set clipboard text on a client computer, here's an updated answer:
There is no browser agnostic way of setting clipboard text. It's possible in Internet Explorer using the following snippet:
window.clipboardData.setData('Text', 'Your text');
In Firefox and Webkit browsers, for security reasons, you need to go via flash to set clipboard text. Zeroclipboard is a nice library for this.
As far as I'm aware in the web world it would be a security issue to access the clipboard without some sort of client side control, i.e. ActiveX control or Flash. So it would prompt for the user to allow the access. Here is something to get you started.
In WinForms there is a static Clipboard class with a SetText method. So you can use
Clipboard.SetText("whatever");
There are some differences to the default text format based on which operating system you are running on: http://msdn.microsoft.com/en-us/library/ydby206k.aspx
You can use Flash.

How to Save Controls that are inside a form

Hi this question or problem i have its very hard i have search and ask in the university and i have no idea how to make this happen, or even if it is possible.
Here we go...
I am making a photo or image editor with the variation of letting the user to insert buttons in top of the edited image(this buttons when clicked plays an audio file) all of this works so far.
BUT at the end when the user finish his work i need him to save it, so it can be send and view by others.
Now I think I know how to save an edited image but that dose not contain the buttons (controls) .... its like when we save a file at power point and we send it to others they contain audio and the image. Hope fully you guys understand if so can any one point me in a direction to do this or show me how if possible.
( Some people told me to use meta-data others the manifest file but I am so confuse).
too bad i cant post pictures of the work until i get 10 points......
Thanks For the first four quick response and sorry mistake of not telling that I am working on C# 3.5 .Net and in Windows Form app.
It seems you all quite understand what i am trying to do here. I will post the picture thanks to the points i receive from TheVillageIdiot. and about the XML I have never ever used that before ill try my best to understand you guys but if any one can show me an example two or were to read ( dose xml works on Windows form app.?) Here is ...( sorry if the picture its too big) an example of what the program it's doing so far that black transparent box its the MouseOverBackColor... when clicked it loads a player that plays x_x the sound. Its like tagging but with audio.
I really need help i reached my limit don't know were to look and the time is killing me.
HI I am back again this time with a simple sample of what i need to learn how to save the dinamic buttonarray
Today is 10/11/10 (i made a acount with !##$%share to share the sample with you guys i hope this dosent bother any one here) here is the Link . i will explain again what i need to do and i have no idea or code on how to do it.Imagine a person that uses the program and create like 5 buttons any were in the form , it needs to be save so he can send it to others that have the same program, this way others can view the buttons the user created.
hopefully you guys can help me out with a simple example i really neeed some sample working code. Note: I am working on windows form app WFA C# 3.5 .net M.V.studio2010 (the file I gave above has a backup with a 2008 vercion) thanx in advance.
Similar to jim's answer, I would suggest having an archive of some sort (ZIP or otherwise) containing all the media necessary.
Store the images and sounds files by name or checksum in the archive and keep the meta-data (button positions, names, what media they use, etc, we'll call it the definition file) in a file also stored in the archive. You may be able to use XML to make that human-readable.
The entire package will then be simple to distribute and use, as everything will be contained in the archive. Your application simply needs to scan for archives, check each archive for a valid definition file, and load the ones that are needed.
Edit: Going from the screenshot you posted and my understanding of the problem, I'm going to suggest the following:
When a user creates a button (defined as a rectangular area or "hotspot"), open a dialogue asking for a sound file to associate. Then, store the top-left and bottom-right corners of the button and the filename in a XML file, something like this:
<Button name="myButton!">
<Position top="128" left="128" />
<Size height="200" width="200" />
<Audio filename="something.mp3" />
</Button>
Now, when compiling a plugin, create a ZIP archive. Inside, place the XML file and all the audio files you need.
When loading a plugin, read the XML file first and find the audio file (assume all audio files are in the same archive as the XML file). Then create the button and add the audio filename as, say, its Tag property. Assign all buttons one generic OnClick event, and in the OnClick event, play the audio file given by the current object's Tag.
If you don't understand what I mean, I'll try to elaborate further. I think that method should work neatly and be pretty simple to work with. :)
One solution: Create a ZIP file that contains both audio and images.
Basically, you've got two things you want to save.
The edited image, and then the locations of the buttons and their actions.
You've got the image-saving part happening, so now you need to save the other information. This can be considered "metadata", and you can save it in some format that you invent, such that it allows you to load it back. Typically it would be easiest to do this via XML Serialization. So look into that.
Assuming you are writing a stand-alone application and no web - application.
If you are adding the Button as a .NET component (new Button()) there is no way to do that unless you supply your own player software with it.
If you want to supply your own player, create a (seperate) file with the info about the button and read the file and then re-create the button.
(Be aware though that all the resources - jpeg, mp3) also have to be available at the target PC) Alternatively, pack all you info into one file (jpeg, button infos, mp3's) and save that file.
hth
Mario
You have two choices
Create your own format and then make a player app that read it and play the results
Find some format that supports your features and create that kind of file. This works well if you expect others to have a player.
For #2, here are some formats that could support what you want to do
Flash
PDF
Compiled HTML Arhive -- need IE to play http://en.wikipedia.org/wiki/MHTML
EXE -- create code with resources and compile it -- basically your player + resources
PowerPoint

C# Drag and Drop functionality

I'm trying to achieve functionality similar to winzip/winrar, etc. I have a Treeview that displays the contents of a package (System.IO.Packaging). I want to be able to drag and drop a file or folder from the TreeView onto an explorer window or the desktop, etc. My problem is that I have to call DoDragDrop before I know if the object was actually even dropped. That means to create the DataObject with the FileDrop type, I must extract those contents of the package out to a temporary area and then provide that path to the DataObject before calling DoDragDrop. If the user doesn't drop on a capable container or cancels the drop, the overhead of extracting those contents is wasted. I've noticed that winzip does not actually create the temporary file until the drop occurs on a valid target. I've checked the DataFormats provided by the WinZip drop and they are normal FileDrop, FileNameW, FileName and Shell IDList Array. The first three simply hold a string to the temporary location that winzip extracted that file to. I'm not sure what the last one does.
Long story short, I want to be able to avoid extracting the contents until I know the drop location was valid. Is there a callback to figure out the drop location? Any suggestions would be extremely helpful.
System.Windows.DragDropEffects de = DragDrop.DoDragDrop(treeview1, dataObj, System.Windows.DragDropEffects.Move);
I've tried this with an application similar to an FTP server - I wanted to start downloading only after the user actually dropped the item. Unfortunately I found no way to do this using managed code only.
The way WinZip probably does it is by receiving COM callbacks (please forgive me if I'm using the wrong words here) and you'd have to create a managed wrapper around the native COM object in order to receive such callbacks yourself.
It's certainly possible, but I gave up and embedded a FolderTreeView thingie in my application to catch the drop events myself :/

c# clipboard viewer... on firefox the event fires twice

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.

Categories

Resources