drag & drop from outlook

drag & drop from outlook

Postby Otto » Fri Dec 19, 2008 7: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:

Code: Select all  Expand view
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

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

Postby Antonio Linares » Sun Dec 28, 2008 9:33 pm

Is this code (from you) working ?

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Mon Dec 29, 2008 6: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
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Mon Dec 29, 2008 7: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
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Otto » Mon Dec 29, 2008 9: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
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Mon Dec 29, 2008 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » 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);
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Mon Dec 29, 2008 3: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
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 100 guests