Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Once again: Drop email from Outlook
Once again: Drop email from Outlook [message #518149] Wed, 03 March 2010 09:30 Go to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
Hi I searched the forums for this topic and it seems I'm not the only one who tries to do that. I found

http://www.eclipse.org/forums/index.php?t=msg&&th=14 7516&goto=464661

and have no clue about the native things going on there. I wonder what I have to return in getTypeIds and getTypeNames for such a Transfer Type. Can anyone help me out with this ? I guess there must be implementations and I do not want to reinvent.

Regards Thomas
Re: Once again: Drop email from Outlook [message #519397 is a reply to message #518149] Mon, 08 March 2010 17:34 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi,

For getTypeIds() the magical number on my machine for a dragged Outlook news message is 49588. I found this by putting a breakpoint in the custom Transfer class' getTypeIds() implementation, and seeing which type id its caller (ByteArrayTransfer.isSupportedType()) was looking for. This type id remained consistent for me across many runs, though I don't know if it would be the same on another machine or not.

When the nativeToJava() implementation from the old post that you linked to was invoked, for me it gave stg's tymed as TYMED_HGLOBAL rather than the post's expected TYMED_ISTORAGE. So to handle the TYMED_HGLOBAL case a block is needed in nativeToJava() like:

if ((stg.tymed & COM.TYMED_HGLOBAL) != 0) {
int /*long*/ hMem = stg.unionField;
int size = OS.GlobalSize(hMem);
byte[] buffer = new byte[size];
int /*long*/ ptr = OS.GlobalLock(hMem);
OS.MoveMemory(buffer, ptr, size);
OS.GlobalUnlock(hMem);
OS.GlobalFree(hMem);
if (stg.pUnkForRelease == 0) {
OS.GlobalFree(stg.unionField);
}
return buffer;
}

The only thing I'm not sure about is what to do with the bytes (buffer). I don't know what the format is of the data being provided by Outlook. I tried to change it to a String in a similar manner to what TextTransfer does, but this doesn't give a readable result. Maybe this transfer type has a shape to it that needs to be parsed out, you'll need to look into this.

Sorry that this isn't a complete solution. If you find something that's helpful (eg.- if this transfer type has a published shape), then feel free to post a follow-up here with the link.

Grant
Re: Once again: Drop email from Outlook [message #519580 is a reply to message #519397] Tue, 09 March 2010 11:26 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I found that if I drop an email (thats what I want to do) the number is
49852. But in

STGMEDIUM stg = new STGMEDIUM();
stg.tymed = -1;
int hresult = idata.GetData(formatetc, stg);

i don't get an ok but something like -27xxx. (Its actually an COM.E_FAIL Sorry but I have completely no understanding of these windows thingys Smile

Can anyone help me out ?

[Updated on: Tue, 09 March 2010 12:27]

Report message to a moderator

Re: Once again: Drop email from Outlook [message #519664 is a reply to message #519580] Tue, 09 March 2010 10:56 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
I don't know what would cause this.
http://msdn.microsoft.com/en-us/library/ms678431(VS.85).aspx indicates that
the error values that the GetData() invocation can return are:

DV_E_LINDEX = 0x80040068,
DV_E_FORMATETC = 0x80040064,
DV_E_TYMED = 0x80040069,
DV_E_DVASPECT = -2147221397,
E_INVALIDARG = 0x80070057,
E_UNEXPECTED = 0x8000FFFF,
OLE_E_NOTRUNNING = 0x80040005,
E_OUTOFMEMORY = 0x8007000E;

STG_E_MEDIUMFULL = 0x80030070;

I just grabbed the hex values above from some random code on-line, but
presumably they're correct. Hopefully determing what the error is will
provide a clue regarding what is needed (keep in mind at all of the values
above that are of form 0x800... will roll around to be int values
like -214... ).

Grant


"Thomas Kratz" <eiswind@googlemail.com> wrote in message
news:hn5b8n$qqt$1@build.eclipse.org...
> I found that if I drop an email (thats what I want to do) the number is
> 49852. But in
>
> STGMEDIUM stg = new STGMEDIUM();
> stg.tymed = -1;
> int hresult = idata.GetData(formatetc, stg);
>
> i don't get an ok but something like -27xxx. Sorry but I have completely
no understanding of these windows thingys :)
>
> Can anyone help me out ?
Re: Once again: Drop email from Outlook [message #519665 is a reply to message #519664] Tue, 09 March 2010 16:05 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
The Error Code I get stands for E_FAIL which means something like unknown error. I can get the text out of it (which is the header only) but not the content. I guess i have to set the correct aspect, but once again I have searched google for more than an hour witout proper results. the c# examples use DataFormat Constants that I cannot see.
Re: Once again: Drop email from Outlook [message #519676 is a reply to message #519665] Tue, 09 March 2010 16:45 Go to previous messageGo to next message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I found
http://www.codeproject.com/KB/office/outlook_drag_drop_in_cs .aspx

but I cannot translate that to swt-java-com Sad
Re: Once again: Drop email from Outlook [message #520280 is a reply to message #519676] Thu, 11 March 2010 19:42 Go to previous message
Thomas Kratz is currently offline Thomas KratzFriend
Messages: 165
Registered: July 2009
Senior Member
I finally made some progress on this.
You can read it on

http://thomaskratz.blogspot.com/2010/03/swt-drop-outlook-ema il.html
Previous Topic:SWT: Dependencies of Feature Project
Next Topic:Tracker won't release on Mouse-up
Goto Forum:
  


Current Time: Fri Apr 19 21:24:42 GMT 2024

Powered by FUDForum. Page generated in 0.03385 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top