Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Drag/Drop when running an EXE as COM server 1

Status
Not open for further replies.

cheth

Programmer
Nov 6, 2001
16
US
Hello All,

I have a VFP8 EXE application in which I use OLE Drag/Drop between a few objects on the screen. I've also added an OLE Public Class to the application, so I can run it from other apps. Which works, except for one problem, I can't Drag anything. When I simply run the EXE I can D/D, no problem.

Any ideas?

Thank you in advance for any help,
Chet
 
A COM server really runs in the background like a .DLL or service. It isn't supposed to have any sort screen I/O or user interface.
If you're reusing a class requiring user interaction, you won't be able to run it as a COM server.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
This COM server application does function in all other user interactive areas, except for Dragging. And other User Interactive applications that I set up as COM servers work OK.
I simply used the 'Win32 Executable/COM Server (exe)' build option..
 

Chet,

Does drag-and-drop work as you expect when you run the code directly from an EXE, that is, not as part of a COM server?

How have you implemented the drag-and-drop? What code do you have?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Yes Mike, it does drag and drop when run directly as an EXE.

I set the OLEDragMode=1-Automatic for the objects that require Drag capabilities.

When I'm running directly, I select the field, hold the click and the cursor image changes to indicate a drag is in process. But, running as COM server, the cursor never changes.
Also the OLEDrag() method for the field runs, but the OLEStartDrag() event never fires running as COM.

There isn't really any code other then the:
DEFINE CLASS apflag AS CUSTOM OLEPUBLIC
.....
.....
ENDDEFINE
to enable the COM server.
I just set the OLEDragMode properties.

Thanks,
Chet
 

Chet,

It looks like you are doing everything right. I can't see why it should work in a stand-alone EXE and not in a COM server.

Maybe your next step should be to see if drag-and-drop is supported at all in COM -- as opposed to it being an error in your code. You could perhaps write a minimum program that does nothing more than place an object in a form, and allow it to be dragged to a new posisition. If that works, gradually add the functionality of your own application. When it stops working, that'll tell you where it has gone wrong.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Mike..

I had already tried that and no luck. I was hoping there was some other setting or something. I'll let you know if I figure it out.

Thanks again..
Chet
 
Mike,

Yes.

I created a simple form with 2 text fields. Text1 with OLEDragMode=1 and Text2 with OLEDropMode=1-Enabled.

Running the EXE directly, I can drag-drop from Text1 to Text2 no problem.

Running as COM server, clicking on Text1, the cursor image remains as a pointer (like it wants to drag), but does not drag. (Note: On a textbox that does not have OLEDragMode=1, the cursor image remains text edit cursor "|").

I try this on an XP-Pro and W2000 system and got the same results.

Thanks
Chet
 
Mike,

I would think this would have come up as a problem before now. I was hoping it was something I missed..

I just now tried the same test on VFP6/W2K and got the same results.

Thanks for your help,
Chet
 
Microsoft gave me a work-around using Drag/Drop instead of OleDrag/Drop. Apparently, there is a problem use OleDrag in a COM server. They say they are looking into the Ole issue.

With Text1 being the drag-from and Text2 the drop-to,
Basically, I had to set:
Text1.DragMode=1-Automatic

and add code to:
Procedure Text2.DragDrop
LPARAMETERS oSource, nXCoord, nYCoord
this.Value = osource.Value
endproc

Hopefully they'll come up with a hotfix, because I'm not too keen on the work-around.

Thanks again for all the input,
Chet
 
I would also like to say thank you Chet. You put in the work on this for sure, reported it to MS, and even came back here with the workaround they provided. Star worthy.

boyd.gif

SweetPotato Software Website
My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top