A customer asks if drag/drop is available in a COM server.
Contrary to what some (wOOdy <g>) believe, I do not have all the answers. However, I can create some code to test it and I can look through the crystal ball of the Visual Studio debugger.
I found code that disables drag/drop if the Automation mode of the VFP runtime is not None. Because I wrote most of the COM server features of VFP, I thought that I had done it. Looking back through the source code logs, I see that it was done in early 1997 when OLE DragDrop was added and not by me!
Typically COM servers are software modules that are called to do tasks via clients, and do not have UI, so I don’t think it’s unreasonable that it was disabled in this scenario.
The Automation mode of VFP can be one of 5 values:
There are various places in the VFP source code that do different things depending on the automation mode. For example, an In Proc server does not create a real Windows window for a Form object. You can test that the hWnd of a Form is 0
(Create a general purpose VFP com server: http://blogs.msdn.com/calvin_hsia/archive/2004/06/18/159550.aspx)
Try running the code below to see the difference in OLE Drag Drop
TEXT TO ctemp
*********** My COM EXE code *****************
DEFINE CLASS myform AS form OLEPUBLIC
Name = "myForm"
ShowWindow = 2
ADD OBJECT text1 AS textbox WITH ;
OLEDragMode = 1, ;
Height = 23, ;
Left = 36, ;
Top = 36, ;
Width = 100, ;
SelectOnEntry = .t., ;
Name = "Text1"
ADD OBJECT text2 AS textbox WITH ;
OLEDropMode = 1, ;
Top = 96, ;
Name = "Text2"
this.text1.Value = "DragMe"
*********** End of code ***************
BUILD PROJECT frmtest FROM frmtest
BUILD EXE frmtest FROM frmtest
oForm = CREATEOBJECT("frmtest.myform")
oForm2 = NEWOBJECT("myform","frmtest.prg")