|
Re: Once again: Drop email from Outlook [message #519397 is a reply to message #518149] |
Mon, 08 March 2010 17:34 |
Grant Gayed 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 #519664 is a reply to message #519580] |
Tue, 09 March 2010 10:56 |
Grant Gayed 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 ?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04091 seconds