<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><div style="text-align: left;">I've had a look at the example and i can't quite pick out what's being done differently other than pythoncom.WrapObject() is being called within a class and it's being called on the class it's in?<br>Or is it something to do with the arguments passed to wrap object?<br><br>Thanks for the help.<br>Alex<br></div><br><hr id="stopSpelling">> From: rwupole@msn.com<br>> To: python-win32@python.org<br>> Date: Thu, 24 Apr 2008 17:25:03 -0400<br>> Subject: [python-win32] Creating python com objects<br>> <br>> <br>> Tim Golden wrote:<br>> > Alex Denham wrote:<br>> >> Parameters<br>> >> <br>> >> /pDataObj/ : *PyIDataObject **<br>> >> <br>> >> How do i link the IDataObject to the IDragTarget?<br>> > <br>> > I don't know that you can, if you're asking: how do I<br>> > find out where this is coming from?. I think the drag-drop<br>> > technique is endpoint-agnostic. (A high-sounding phrase I've<br>> > just invented).<br>> <br>> Don't forget to trademark it !<br>> <br>> > The most you can do is get hold of the data.<br>> > Again, I think.<br>> <br>> This is correct, the IDataObject interface is provided by the object<br>> that's being dragged. Unless you're also providing the dragged<br>> object the interface should be opaque.<br>> <br>> > <br>> > I'm out of my depth so I'm hoping that Roger or Mark<br>> > or other more knowledgeable people can chip in at this point<br>> > and help.<br>> > <br>> > For the purposes of discussion, I attach below my test harness<br>> > code which creates a simple window and registers a simple<br>> > IDropTarget object against it.<br>> > <br>> > Sorry to be no more help than this.<br>> > TJG<br>> > <br>> > <code><br>> > import os, sys<br>> > import win32gui<br>> > import win32con<br>> > import pythoncom<br>> > <br>> > CLSID = '{89DD545A-2C83-4103-AFE3-6CEB7FF5ECA4}'<br>> > PROGID = "Tim.DropTarget"<br>> > DESC = "Drop target handler for Tim's app"<br>> > <br>> > class DropTarget:<br>> > _reg_clsid_ = CLSID<br>> > _reg_progid_ = PROGID<br>> > _reg_desc_ = DESC<br>> > _public_methods_ = ['DragEnter', 'DragOver', 'DragLeave', 'Drop']<br>> > _com_interfaces_ = [pythoncom.IID_IDropTarget]<br>> > <br>> > def DragEnter (self, data_object, key_state, point, effect):<br>> > pass<br>> > def DragOver (self, key_state, point, effect):<br>> > pass<br>> > def DragLeave (self):<br>> > pass<br>> > def Drop (self, data_object, key_state, point, effect):<br>> > pass<br>> > <br>> > def create_window ():<br>> > def OnDestroy (hwnd, msg, wparam, lparam):<br>> > win32gui.PostQuitMessage (0)<br>> > <br>> > wc = win32gui.WNDCLASS ()<br>> > hinst = win32gui.GetModuleHandle(None)<br>> > wc.lpszClassName = "DragDrop"<br>> > wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;<br>> > wc.hCursor = win32gui.LoadCursor (0, win32con.IDC_ARROW)<br>> > wc.hbrBackground = win32con.COLOR_WINDOW<br>> > wc.lpfnWndProc = {win32con.WM_DESTROY : OnDestroy}<br>> > classAtom = win32gui.RegisterClass (wc)<br>> > style = win32con.WS_VISIBLE | \<br>> > win32con.WS_OVERLAPPED | win32con.WS_SYSMENU<br>> > return win32gui.CreateWindow (<br>> > classAtom,<br>> > "Drag & Drop demo",<br>> > style,<br>> > 0, 0, 100, 100,<br>> > 0, 0, hinst, None<br>> > )<br>> > <br>> > if __name__ == '__main__':<br>> > pythoncom.OleInitialize ()<br>> > drop_target = pythoncom.WrapObject (<br>> > DropTarget,<br>> > pythoncom.IID_IDropTarget,<br>> > pythoncom.IID_IDropTarget<br>> > )<br>> > pythoncom.RegisterDragDrop (create_window (), drop_target)<br>> > win32gui.PumpMessages ()<br>> > <br>> > </code><br>> <br>> There's a little extra work you have to do for WrapObject to work locally.<br>> See \win32comext\authorization\demos\EditSecurity.py for an example.<br>> <br>> Roger<br>> <br>> <br>> <br>> _______________________________________________<br>> python-win32 mailing list<br>> python-win32@python.org<br>> http://mail.python.org/mailman/listinfo/python-win32<br><br /><hr />Messenger's gone Mobile! <a href='http://messengergonemobile.com' target='_new'>Get it now!</a></body>
</html>