473,796 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drag-drop from outlook problem

Hi all,
I've got a half-functioning drag-drop from outlook app running.
I can get the name of the message from the FileGroupDescri ptor part, but
whenever I try to get the FileContents part, I allways get Nothing back.
I've posted my code below - I hope someone here has a solution to this.

Cheers
Thomas

Private Sub Label1_DragDrop (ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles Label1.DragDrop

Dim header As IO.MemoryStream

Dim data As IO.MemoryStream

Dim fs As IO.FileStream

Dim filePath As String = ""

Dim fileName As String = ""

' check the formats supported

Dim s() As String

Dim sFormat As String

s = e.Data.GetForma ts

For Each sFormat In s

Me.ListBox1.Ite ms.Add("Support ed format: " & sFormat)

Next

' get the file group descriptor, for the file name

header = CType(e.Data.Ge tData("FileGrou pDescriptor", False),
IO.MemoryStream )

header.Position = 76

Do While True

Dim l As Integer = header.ReadByte ()

If (l = 0) Then Exit Do

fileName &= Convert.ToChar( l).ToString()

Loop

If fileName.Length = 0 Then Return

Me.ListBox1.Ite ms.Add("Object dropped: " & fileName)

' get the actual dropped object

data = CType(e.Data.Ge tData("FileCont ents", False), IO.MemoryStream )

If Not data Is Nothing Then

Try

' get the data as a byte array

Dim b(data.Length) As Byte

data.Position = 0

data.Read(b, 0, data.Length)

' save the byte array to file

filePath = "D:\" + fileName

fs = New IO.FileStream(f ilePath, IO.FileMode.Cre ate)

fs.Write(b, 0, data.Length)

Catch ex As Exception

Me.ListBox1.Ite ms.Add("Excepti on: " & ex.Message)

Finally

fs.Close()

End Try

Else

Me.ListBox1.Ite ms.Add("No data recieved")

End If

End Sub


Nov 20 '05 #1
3 3521
Thomas,

You can use DataObject.GetD ataPresent to test if FileContents is in the
DataObject.

HTH,

John Chen

Nov 20 '05 #2
Hi John,
the GetDataPresent returns true for the FileContents, but I can't get it
with the GetData, for some odd reason.
Any ideas?

Cheers,
Thomas
"John Chen" <jo******@micro soft.com> wrote in message
news:3#******** *****@cpmsftngx a06.phx.gbl...
Thomas,

You can use DataObject.GetD ataPresent to test if FileContents is in the
DataObject.

HTH,

John Chen

Nov 20 '05 #3
How do you set the object into the DataObject?
Is your set object routine in the same project of the get object?
Is there any exceptions you see when you get the object?

John
Nov 20 '05 #4

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

Similar topics

11
1600
by: kiran | last post by:
I am trying to implement a rubber band/image selection script. For that I need to remove the default drag behaviour on an image. I am able to do this in IE but not Netscape. Does any one have a solution? Pls look below for IE code: var moz = ((document.all)? false : true); var ie = ((document.all)? true : false); var ElementUtil = new Object(); ElementUtil.addEventListener = function(o, type, handler) {
1
1560
by: kiran | last post by:
I am trying to implement a rubber band/image selection script. For that I need to remove the default drag behaviour on an image. I am able to do this in IE but not Netscape. Does any one have a solution? Pls look below for IE code: var moz = ((document.all)? false : true); var ie = ((document.all)? true : false); var ElementUtil = new Object(); ElementUtil.addEventListener = function(o, type, handler) {
3
2756
by: NewSun | last post by:
How can i drag a datarow from a datagrid to a other control? e.g. Drag a datarow from a datagrid to a TextBox,Then display one colnumn' value of the datarow . Or Drag a cell's value to a controll and display/handle the value in the other controll. Thanks in advance.
1
371
by: Jon Cosby | last post by:
I need an event handler for dragging the cursor on a PictureBox. The existing events only include handlers for dragging and dropping objects over the controls. I'm trying to use the MouseDown and MouseUp handlers as below, but it never gets out of the while loop. this.PicBox.MouseDown += new MouseEventHandler(this.StartMapDrag); this.PicBox.MouseUp += new MouseEventHandler(this.EndMapDrag); private void StartMapDrag(object sender,...
1
2133
by: Chris | last post by:
Hi, I need to be able to detect when a drag is cancelled after it has started. Meaning: after the drag operation has begun, and the user does not complete the drag, but releases whatever's being dragged before it reaches it's supposed destination. I need something to happen at that point, and surprisingly there's no event for like DragCancelled or something in Control. So does anyone have any idea how I could do this? Thanks, Chris
2
1730
by: Daniel | last post by:
Hello, in my application, i need to drag files from the windows explorer to the application, but also the other way round. To drag files from the explorer works fine (using Data.GetData(System.Windows.Forms.DataFormats.FileDrop)), but how must i set the Data-object to drag files from my application to the explorer? Thanks in advance for your help.
0
305
by: Samuel R. Neff | last post by:
I have a typical TreeView/ListView combo and can drag from the ListView to the TreeView. I'd like to select the TreeView node that is the target of the drag operation as the ListView items are dragged around the tree. I haven't found a way to do this. Apparently TreeView.MouseMove isn't fired during the drag operation. Any suggestions or examples?
4
1556
by: Peter | last post by:
Hi, Does anyone know how to drag a splitter by coding. I will put three controls on form1,two panels and a splitter. The first panel's dock property is set to top, the splitter's dock is also top and the second panel's dock is fill. Now I want to expand the first panel's area and shrink the second panel by draging the splitter in code but failed.
0
1112
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Being you can drag webparts from zone to zone, is there a way to control drag speed while dragging/scrolling up the page? I have a list of webparts that may go beyond the page. If a user wants to drag the bottom webpart up to the top, I was wondering if the speed of this drag/scroll action can be controlled. Thanks
0
9531
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
10459
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...
1
10187
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
9055
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
6795
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
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
3
2928
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.