FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour drag & drop from outlook
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
drag & drop from outlook
Posted: Fri Dec 19, 2008 07:18 AM
To all,
As I can’t get working drag & drop from Outlook I have now a workaround with VB6.

The VB6 program waits for the drop down and then executes my Fivewin program with Shell (App.Path + "\testole.exe " & s).
This is the whole sourcecode of the program:

Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)

If Data.GetFormat(vbCFText) = True Then
    Dim s As String
        Shell (App.Path + "\testole.exe " & s)

        End
End If

End Sub


But to have VB6 installed only for this little task is not so nice.
Does someone have a FWH solution?


Thanks in advance
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
drag & drop from outlook
Posted: Sun Dec 28, 2008 09:33 PM
Is this code (from you) working ?

#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 
//----------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 06:48 AM

Hello Antonio,

The Outlook part is working perfectly.

Only drag and drop does not work as suspected.
This code works only “on click” I mean you select a message in outlook and then you click on the little window.

Best regards,
Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 07:52 AM

Maybe this C code can help to implement IDataobject?

Part 3 - Implementing IDataObject
Many thanks to Davide Chiodi from Italy who has very kindly converted the data-obect code into a Pure C implementation - the download link is available at the bottom of this article!

http://catch22.net/tuts/dragdrop/3

Regards,
Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 09:09 AM

http://catch22.net/tuts/dragdrop/5

>Welcome to the fifth article in the "OLE Drag and Drop" tutorial series! We are almost at the final stages in our OLE drag and drop implementation. The only thing left to do is implement the IDropSource and IDropTarget interfaces.

http://catch22.net/sites/default/files/ ... Epart5.rar

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 09:52 AM

Otto,

I have done a quick review at the source code, and it is C++ not C.

It looks as an ActiveX implementation, something quite complex. I mean, it is not impossible to be implemented (using C++) but it is much more complex that the code that you already have working with just few FWH source code lines.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 10:09 AM

Hello Antonio,

thank you for your answer.
My implementation does not recognize the drop event. FiveWin only recognizes files if they are dropped not textonly.

There is also pure C code:

http://catch22.net/sites/default/files/ ... Epart6.rar

http://catch22.net/tuts/dragdrop/6

Sat, 08/30/2008 - 09:17 — james
Updated 6 Dec 2006
Many thanks to Davide Chiodi from Italy who has very kindly converted the drop-target code into a Pure C implementation!
Welcome to the sixth part of the "OLE Drag and Drop" tutorial series! This article will concentrate on implementing a small application which will act as a drop-target. What this means is that our application will be capable of receiving objects (be they files, pictures or text) which are dragged onto it.
We will implement an IDropTarget COM interface which will allow any OLE application to drag it's data over our application. This will take the form of a simple EDIT control which can act as a target for dropped CF_TEXT data. Hopefully you will be able to take the code presented here and "drag" it straight into your own apps ;-)
Become a "Drop Target"
In order for a window to accept data from a drap-drop operation, it must be registered as a "drop target". There is an OLE API call - RegisterDragDrop - which is used for this very purpose. The function prototype looks like this:
WINOLEAPI RegisterDragDrop(HWND hwnd, IDropTarget * pDropTarget);

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 11:48 AM

Otto,

IMO it seems as a quite complex code.

I am not saying that it is impossible. What I mean is that this may need several weeks to be tested and implemented.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
drag & drop from outlook
Posted: Mon Dec 29, 2008 03:42 PM

Hello Antonio,

I see and I understand.

But I think I have found a FIVEWIN own build in solution.

I tried with the richtext control and extended the eventhandle method

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TRichEdit

 do case
    case nMsg == WM_NCHITTEST
           msginfo( procname() + "   " + str(procline()) + "   " )
         case nMsg == FM_HIGHLIGHT

Now I only have to find out if I drop a file or a text from outlook.

Thanks again,
Otto

Continue the discussion