Is it possible to drop over FWH window email msgs

Postby Otto » Mon Dec 15, 2008 3:08 pm

Hello James,

DragAcceptFiles( oDlg:hWnd, .T. )
Does not accept Outlook files. In my case I only need a solution for Outlook.
I had a look into the DragAcceptFiles function in dropfile.c from the FWH sources.
But I didn’t find out how to tell windows.prg to accept these files.

Thanks for your help,
Best regards,
Otto
User avatar
Otto
 
Posts: 6072
Joined: Fri Oct 07, 2005 7:07 pm

Postby James Bott » Mon Dec 15, 2008 3:50 pm

Otto,

I was referring to this section:

Code: Select all  Expand view
When dropping files from Outlook, the solution is a little different. The format for a dropped Outlook object is not a file nor is it necessarily an OLE object. Instead, the code looked at the text that was passed in the object. If the text contained the word "Subject" and had multiple lines, it was assumed to be an Outlook object. The currently selected Outlook item was identified using the Outlook ActiveExplorer (see previous columns on Outlook) and then the message was checked for the content.

IF odataobject.GETFORMAT( 1 )
   lc = odataobject.GETDATA( 1)
IF MEMLINES(lc) = 2 AND "Subject"$MLINE(lc,1)
   lo = CREATEOBJECT("outlook.application")
   loX = lo.ActiveExplorer
   loItem = lox.Selection.Item(1)
   ** loItem is now a pointer to the mail item
   lcText = loItem.Body
ENDIF
ENDIF


Note that you are not dropping files when dropping from Outlook. They are really email objects (which are stored as records in a database file).

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Otto » Mon Dec 15, 2008 4:12 pm

Hello James,

Could you please help to transform this code to FIVEWIN?

Regards,
Otto
User avatar
Otto
 
Posts: 6072
Joined: Fri Oct 07, 2005 7:07 pm

Postby James Bott » Mon Dec 15, 2008 4:22 pm

Otto,

Unfortunately, I do not have Outlook installed on any of my PC's here so I can't do any testing.

What is the valType() of the data returned from DragAcceptFiles() when you drop an Oulook email? Is is "O"?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Otto » Mon Dec 15, 2008 11:11 pm

It is like Antonio (AHF) says:
>When I drag email messages the FWH does not fires any message to be worked upon. It simply put the forbbiden cursor.
I think DragAcceptFiles() is a API call not a OLE one.
Regards,
Otto
User avatar
Otto
 
Posts: 6072
Joined: Fri Oct 07, 2005 7:07 pm

Postby AHF » Mon Dec 15, 2008 11:34 pm

I think the problem is with:

Window class
METHOD HandleEvent( nMsg, nWParam, nLParam ) EXTERN ;
WndHandleEvent( Self, nMsg, nWParam, nLParam )

There is no msg event when we drag certain objects over FWH.

Anyone has the that function ?

Would it be possible to Antonio Linares give support for it ?

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby AHF » Tue Dec 16, 2008 8:40 am

Problem is with function _FWH() or WndHandleEvent().

We need Antonio Linares help.

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Otto » Tue Dec 16, 2008 9:02 am

Antonio (AHF),

There is only a little brick missing for a perfect drag&drop from Outlook.

I would only need a drog event fired.

But this solution is much better as my VBA macro was.

Run the program and click into the little window.
The selected email is saved to c:\temp\testdemo.msg.

Maybe someone has a solution for the drop event.

Regards,
Otto

Code: Select all  Expand view
#INCLUDE "FIVEWIN.CH"

function Main()
local oDlg

DEFINE DIALOG oDlg FROM 5, 5 TO 20, 40 TITLE "Drag & Drop"
   oDlg:bLButtonUp := { |y,x,flags | DropFiles( oDlg ) } 
ACTIVATE DIALOG oDlg

RETURN (.T.)
//----------------------------------------------------------------//

FUNCTION DropFiles( oDlg )
     LOCAL oOutlook       := TOleAuto():New( "Outlook.Application" )
   local myOlExp        := oOutlook:ActiveExplorer
   local oMail
 

oMail := myOlExp:Selection:Item(1)

msginfo( oMail:body )

oMail:SaveAs  ( "c:\temp\" +  "testdemo.msg"   )

RETURN NIL
//----------------------------------------------------------------//





User avatar
Otto
 
Posts: 6072
Joined: Fri Oct 07, 2005 7:07 pm

Postby AHF » Tue Dec 16, 2008 11:56 am

Otto,

It works ok, unfortunatly its not the solutiuon I need and it not work with OE express.

By the way why don't you get all the selected messages and then within a FOR NEXT you save all the messages with the subject as the file name.

Just an idea.

Antonio
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Postby Otto » Tue Dec 16, 2008 4:16 pm

Hello Antonio(AHF),

I use a kind of for/next for backup purpose of my emails .
Be aware that the subject of more emails could be the same.

OE does not have a object modul. You can only hack the format.

For my VB6 solution I used:

' DragDropAttachment Class
' Class to get dropped Outlook attachments
' Author: Eduardo Morcillo
' E-Mail: edanmo@geocities.com
' Web Page: http://www.domaindlx.com/e_morcillo
' Distribution: You can freely use this code in your own applications but you
' can't publish this code in a web site, online service, or any
' other media, without my express permission.
' Usage: at your own risk.
' Tested on: Windows XP Pro SP1
' History:
' 06/12/2003 * Added SaveAttachment method
' 12/30/2002 * Code was released

Regards,
Otto




Code: Select all  Expand view
   For i = 1 TO oNameSpace:GetDefaultFolder(6):Folders:Count
      For ioMail = 1  to  oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items:Count
         myItem :=  oNameSpace:GetDefaultFolder(6):Folders[ i ]:Items[ ioMail ]
         myItem:SaveAs  ( "c:\backup\" + ALLTRIM(str(ioMail)) + ".msg"   )
      Next
   Next

User avatar
Otto
 
Posts: 6072
Joined: Fri Oct 07, 2005 7:07 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests