Is drag/drop available in a COM server?


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:



  1. None. Applies to both Devtime (VFP9.EXE) and runtime (an EXE like YourProj.exe made to run with VFP9R.DLL)

  2. LocalServer.  If the VFP9.EXE is created by CREATEOBJECT(“VisualFoxpro.Application”) (Local means its not in the same process, but could be on a remote machine.)

  3. RunTimeLocalServer. Like frmtest.exe below, using VFP9R.DLL. LocalServers never use the multithreaded DLL.

  4. RunTimeInProcServer. A DLL using VFP9R.DLL or VFP9T.DLL(multithreaded).

  5. Special. We’re in special mode: registering or unregistering servers via DLLRegisterServer, or an EXE via /RegServer

 


 


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)


 


x=CREATEOBJECT(“t1.c1”)


?x.MyEval(“_vfp.ServerName”)


?x.MyEval(“_vfp.fullName”)


?x.MyDoCmd(“public ox”)


?x.MyDoCmd(“ox=CREATEOBJECT(‘form’)”)


?x.MyEval(“ox.hwnd”)


 


 


 


Try running the code below to see the difference in OLE Drag Drop


 


 


CLEAR


IF FILE(“frmtest.exe”)


      ?”Unreg”


      !frmtest /unregserver


ENDIF


 


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, ;


                        Height = 23, ;


                        Left = 36, ;


                        Top = 96, ;


                        Width = 100, ;


                        Name = “Text2”


 


            PROCEDURE Init


                        this.Show


                        this.text1.Value = “DragMe”


            ENDPROC


ENDDEFINE


*********** End of code ***************


ENDTEXT


STRTOFILE(ctemp,”frmtest.prg”)


BUILD PROJECT frmtest FROM frmtest


BUILD EXE frmtest FROM frmtest


 


PUBLIC oForm,oForm2


 


oForm = CREATEOBJECT(“frmtest.myform”)


oForm.Caption=”COM Server”


oForm2 = NEWOBJECT(“myform”,”frmtest.prg”)


oForm2.caption=”Non-Com server”


oForm2.top=300


 

Comments (5)

  1. Удивительно, как долго живут некоторые продукты. COBOL и FoxPro, в чём секрет эт

  2. Juri Shutenko says:

    2Oleg.

    If You wanted show us your foolishness – you did it!

  3. MoreNarodyNaSait says:

    Programma dlia rassilki obievlenii na forumi i blogi baza 170 000 forumov i blogov RU programma Xrumer 4.0! Stoimost 50$ ICQ 374551957

  4. Jon says:

    à ôîðóìû. Ïîëîæèòåëüíûì ðåøåíèåì â ïîëüçó ôîðóì ðàññûëêè ñëóæèò òî, ÷òî ïðè ìàññîâîé ðàññûëêå íà ôîðóìû , Âû ìîæåòå óêàçûâàòü êîíòàêòíûé e-mail, à òàê æå url Âàøåãî ñàéòà, ðåêëàìèðóÿ åãî ïîñðåäñòâîì ðàññûëîê íà ôîðóìû

    Ðàññûëêè íà ôîðóìû ýòî âîñòðåáîâàííûé âèä ðåêëàìû. Ñ ïîìîùüþ ôîðóì ðàññûëîê Âû ïðèâëå÷åòå äîïîëíèòåëüíûõ êëèåíòîâ.

    http://www.topinsearch.narod.ru/Ïð&#232; çàêàçå ôîðóì ðàññûëêè, ìû ìîæåì ðàçìåñòèòü Âàøó èíôîðìàöèþ, êàê íà ðóññêîÿçû÷íûõ, òàê è íà çàðóáåæíûõ ôîðóìàõ. Ðàññûëêà íà ôîðóìû ýòî óíèêàëüíàÿ âîçìîæíîñòü çàÿâèòü î ñåáå.

    Íà ñîâðåìåííîì ýòàïå ðàçâèòèÿ ìàðêåòèíãà,

  5. fluplemaype says:

    Собираем по сети интернет базы данных потенциальных клиентов

    для всех видов Бизнеса – все контактные данные!

    Индивидуально! Много! Быстро! Из первых рук!

    В базах только те, кто скорее всего и больше всего

    может приобрести Ваших товаров и услуг!

    Базы пригодны для массового извещения Ваших потенциальных клиентов

    о наличии у вас товаров и услуг любым удобным для Вас способом!

    Безлимитная поддержка и обновление баз данных!

    Более подробно Вы можете узнать

    по телефону +79133913837

    ICQ: 6288862

    Email: rassilka.agent@gmail.com

    Skype: prodawez

    С Уважением к Вам и Вашему Бизнесу

    Евгений

    "Базы данных потенциальных клиентов для Вашего Бизнеса"