From greg.ewing at canterbury.ac.nz Mon Mar 2 04:20:29 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 02 Mar 2009 16:20:29 +1300 Subject: [python-win32] OnCtlColor not working? Message-ID: <49AB507D.5010306@canterbury.ac.nz> Has anyone successfully used the PyCWnd.OnCtlColor virtual function to change the appearance of a control? The program below tries to use it to set the colour of the text in a PyCButton. My OnCtlColor method gets called, but it doesn't have any effect on the appearance of the button. Also, if I attempt to return a PyCBrush from the OnCtlColor method as the docs suggest, I get "TypeError: An integer is required" errors. Am I doing something wrong? #-------------------------------------------------------------------------------- import win32con, win32ui from pywin.mfc.object import Object class MyFrame(Object): def OnCtlColor(self, dc, btn, typ): print "MyFrame.OnCtlColor:", self ### dc.SetTextColor(0x0000ff) # Doing the following causes "TypeError: An integer is required" #b = win32ui.CreateBrush() #b.CreateSolidBrush(0x00ff00) #return b frame = MyFrame(win32ui.CreateFrame()) frame.CreateWindow(None, "Test", win32con.WS_CAPTION, (100, 100, 300, 300)) button = win32ui.CreateButton() style = win32con.BS_CHECKBOX button.CreateWindow("Hello", style, (20, 20, 100, 40), frame, 0) button.ShowWindow(win32con.SW_SHOW) frame.ShowWindow() app = win32ui.GetApp() app.Run() #-------------------------------------------------------------------------------- -- Greg From rwupole at msn.com Mon Mar 2 05:02:24 2009 From: rwupole at msn.com (Roger Upole) Date: Sun, 1 Mar 2009 23:02:24 -0500 Subject: [python-win32] Re: OnCtlColor not working? Message-ID: Greg Ewing wrote: > Has anyone successfully used the PyCWnd.OnCtlColor > virtual function to change the appearance of a > control? > > The program below tries to use it to set the colour > of the text in a PyCButton. My OnCtlColor method gets > called, but it doesn't have any effect on the appearance > of the button. > > Also, if I attempt to return a PyCBrush from the > OnCtlColor method as the docs suggest, I get > "TypeError: An integer is required" errors. > > Am I doing something wrong? OnCtlColor is expected to return a GDI handle rather than a full MFC object. Try something like: return win32gui.CreateSolidBrush(win32api.RGB(255,0,0)).Detach() Roger From greg.ewing at canterbury.ac.nz Mon Mar 2 05:50:25 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 02 Mar 2009 17:50:25 +1300 Subject: [python-win32] OnCtlColor not working? In-Reply-To: References: Message-ID: <49AB6591.1010209@canterbury.ac.nz> Roger Upole wrote: > OnCtlColor is expected to return a GDI handle rather than a full > MFC object. Ah, okay. It does say so, now that I come to look at the docs carefully enough. It works fine now. Thanks, Greg From greg.ewing at canterbury.ac.nz Mon Mar 2 06:40:07 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 02 Mar 2009 18:40:07 +1300 Subject: [python-win32] OnCtlColor not working? In-Reply-To: References: Message-ID: <49AB7137.6060104@canterbury.ac.nz> Well, it *almost* works now... it's okay for all the button styles except BS_PUSHBUTTON. My OnCtlColor is still getting called, but the pushbutton seems to ignore the results. All the other button styles are okay. Am I still doing something wrong, or is this a known limitation of pushbuttons? #----------------------------------------------------- import win32con, win32ui, win32gui, win32api from pywin.mfc.object import Object b = win32ui.CreateBrush() b.CreateSolidBrush(0x00ff00) hb = b.GetSafeHandle() class MyFrame(Object): def OnCtlColor(self, dc, btn, typ): print "MyFrame.OnCtlColor:", self ### dc.SetTextColor(0x0000ff) dc.SetBkColor(0x00ff00) return hb def add_button(title, style, y): button = win32ui.CreateButton() button.CreateWindow(title, style, (20, y, 100, y + 20), frame, 0) button.ShowWindow(win32con.SW_SHOW) frame = MyFrame(win32ui.CreateFrame()) frame.CreateWindow(None, "Test", win32con.WS_CAPTION, (100, 100, 300, 300)) add_button("Push", win32con.BS_PUSHBUTTON, 20) add_button("Check", win32con.BS_CHECKBOX, 50) add_button("Radio", win32con.BS_RADIOBUTTON, 80) add_button("Group", win32con.BS_GROUPBOX, 110) add_button("3State", win32con.BS_3STATE, 140) frame.ShowWindow() app = win32ui.GetApp() app.Run() #----------------------------------------------------- -- Greg From rwupole at msn.com Mon Mar 2 07:35:48 2009 From: rwupole at msn.com (Roger Upole) Date: Mon, 2 Mar 2009 01:35:48 -0500 Subject: [python-win32] Re: OnCtlColor not working? Message-ID: According to this discussion http://forums.devx.com/archive/index.php/t-81725.html the only way to change a pushbutton's colour is to draw it yourself. Roger From mail at timgolden.me.uk Mon Mar 2 09:50:22 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Mon, 02 Mar 2009 08:50:22 +0000 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <49AB7137.6060104@canterbury.ac.nz> References: <49AB7137.6060104@canterbury.ac.nz> Message-ID: <49AB9DCE.2030700@timgolden.me.uk> Greg Ewing wrote: > Well, it *almost* works now... it's okay for all the > button styles except BS_PUSHBUTTON. > > My OnCtlColor is still getting called, but the > pushbutton seems to ignore the results. All the other > button styles are okay. > > Am I still doing something wrong, or is this a known > limitation of pushbuttons? It's a known limitation; or, at least, it was back in 1996 when I last tried to do this (on Win95). Maybe things have changed since then, but maybe not... TJG From mdriscoll at co.marshall.ia.us Mon Mar 2 15:18:01 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 02 Mar 2009 08:18:01 -0600 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <49AB507D.5010306@canterbury.ac.nz> References: <49AB507D.5010306@canterbury.ac.nz> Message-ID: <49ABEA99.5020107@co.marshall.ia.us> Greg Ewing wrote: >
Has > anyone successfully used the PyCWnd.OnCtlColor > virtual function to change the appearance of a > control? > > The program below tries to use it to set the colour > of the text in a PyCButton. My OnCtlColor method gets > called, but it doesn't have any effect on the appearance > of the button. > > Also, if I attempt to return a PyCBrush from the > OnCtlColor method as the docs suggest, I get > "TypeError: An integer is required" errors. > > Am I doing something wrong? > > #-------------------------------------------------------------------------------- > > > import win32con, win32ui > from pywin.mfc.object import Object > > class MyFrame(Object): > > def OnCtlColor(self, dc, btn, typ): > print "MyFrame.OnCtlColor:", self ### > dc.SetTextColor(0x0000ff) > # Doing the following causes "TypeError: An integer is required" > #b = win32ui.CreateBrush() > #b.CreateSolidBrush(0x00ff00) > #return b > > frame = MyFrame(win32ui.CreateFrame()) > frame.CreateWindow(None, "Test", win32con.WS_CAPTION, > (100, 100, 300, 300)) > button = win32ui.CreateButton() > style = win32con.BS_CHECKBOX > button.CreateWindow("Hello", style, (20, 20, 100, 40), > frame, 0) > button.ShowWindow(win32con.SW_SHOW) > frame.ShowWindow() > app = win32ui.GetApp() > app.Run() > > #-------------------------------------------------------------------------------- > > I'm probably being naive, but why don't you just use one of Python excellent GUI toolkits? You'll get cross-platform code out of the box, if you're careful with Tkinter and wxPython... IronPython may be helpful too since you can use Visual Studio to layout your application and IronPython to control it. ------------------- Mike Driscoll Blog: http://blog.pythonlibrary.org Python Extension Building Network: http://www.pythonlibrary.org From mdriscoll at co.marshall.ia.us Mon Mar 2 15:46:48 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 02 Mar 2009 08:46:48 -0600 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <8D20BBB55F590E42AADF592A815E861703EE9DB6@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E861703EE9DB6@zuk35exm65.ds.mot.com> Message-ID: <49ABF158.9020804@co.marshall.ia.us> King Simon-NFHD78 wrote: >> -----Original Message----- >> From: python-win32-bounces+simon.king=motorola.com at python.org >> [mailto:python-win32-bounces+simon.king=motorola.com at python.or >> g] On Behalf Of Mike Driscoll >> Sent: 02 March 2009 14:18 >> To: Python-Win32 List >> Subject: Re: [python-win32] OnCtlColor not working? >> >> > > [SNIP] > > >> I'm probably being naive, but why don't you just use one of Python >> excellent GUI toolkits? You'll get cross-platform code out of >> the box, >> if you're careful with Tkinter and wxPython... >> >> IronPython may be helpful too since you can use Visual Studio >> to layout >> your application and IronPython to control it. >> >> ------------------- >> Mike Driscoll >> >> > > I think Greg is aware of the various Python GUI libraries: > > http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ > > ;-) > Ah-ha! I knew his name looked familiar. I should have googled it... Mike From Kyle.Rickey at bakerhughes.com Mon Mar 2 15:42:33 2009 From: Kyle.Rickey at bakerhughes.com (Rickey, Kyle W) Date: Mon, 2 Mar 2009 08:42:33 -0600 Subject: [python-win32] Eject a Removable USB drive Message-ID: <59FACAE10BA736419936C90B4E60D4590158E531@MSGHOUMBX07.ent.bhicorp.com> Hello everyone, I would like to be able to eject a usb drive based on drive letter. I've done a bit of googling and came across the CM_Request_Device_Eject function on MSDN (http://msdn.microsoft.com/en-us/library/ms790831.aspx) However, I am not quite sure how to supply the necessary parameter to the function (dnDevInst). Does it have anything to do with: win32file.GetVolumeNameForVolumeMountPoint("F:\\") I'm kind of thinking that I have to get some handle to my removable drive and then go up the device tree using CM_Get_Parent (http://msdn.microsoft.com/en-us/library/ms791198.aspx) and then call CM_Request_Device_Eject on the appropriate node. I am on the right track with this? Any help would be greatly appreciated. -Kyle Rickey From simon.king at motorola.com Mon Mar 2 15:45:14 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Mon, 2 Mar 2009 14:45:14 -0000 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <49ABEA99.5020107@co.marshall.ia.us> Message-ID: <8D20BBB55F590E42AADF592A815E861703EE9DB6@zuk35exm65.ds.mot.com> > -----Original Message----- > From: python-win32-bounces+simon.king=motorola.com at python.org > [mailto:python-win32-bounces+simon.king=motorola.com at python.or > g] On Behalf Of Mike Driscoll > Sent: 02 March 2009 14:18 > To: Python-Win32 List > Subject: Re: [python-win32] OnCtlColor not working? > [SNIP] > > I'm probably being naive, but why don't you just use one of Python > excellent GUI toolkits? You'll get cross-platform code out of > the box, > if you're careful with Tkinter and wxPython... > > IronPython may be helpful too since you can use Visual Studio > to layout > your application and IronPython to control it. > > ------------------- > Mike Driscoll > I think Greg is aware of the various Python GUI libraries: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ ;-) From vernondcole at gmail.com Mon Mar 2 17:12:45 2009 From: vernondcole at gmail.com (Vernon Cole) Date: Mon, 2 Mar 2009 09:12:45 -0700 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <49ABF158.9020804@co.marshall.ia.us> References: <8D20BBB55F590E42AADF592A815E861703EE9DB6@zuk35exm65.ds.mot.com> <49ABF158.9020804@co.marshall.ia.us> Message-ID: So, Greg, can we anticipate a python_gui flavor for Windows in native mode? -- Vernon Cole On Mon, Mar 2, 2009 at 7:46 AM, Mike Driscoll wrote: > King Simon-NFHD78 wrote: >>> >>> -----Original Message----- >>> From: python-win32-bounces+simon.king=motorola.com at python.org >>> [mailto:python-win32-bounces+simon.king=motorola.com at python.or >>> g] On Behalf Of Mike Driscoll >>> Sent: 02 March 2009 14:18 >>> To: Python-Win32 List >>> Subject: Re: [python-win32] OnCtlColor not working? >>> >>> >> >> [SNIP] >> >> >>> >>> I'm probably being naive, but why don't you just use one of Python >>> excellent GUI toolkits? You'll get cross-platform code out of the box, if >>> you're careful with Tkinter and wxPython... >>> >>> IronPython may be helpful too since you can use Visual Studio to layout >>> your application and IronPython to control it. >>> >>> ------------------- >>> Mike Driscoll >>> >>> >> >> I think Greg is aware of the various Python GUI libraries: >> >> http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ >> >> ;-) >> > > Ah-ha! I knew his name looked familiar. I should have googled it... > > Mike > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > From greg.ewing at canterbury.ac.nz Mon Mar 2 22:16:38 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 03 Mar 2009 10:16:38 +1300 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <49ABEA99.5020107@co.marshall.ia.us> References: <49AB507D.5010306@canterbury.ac.nz> <49ABEA99.5020107@co.marshall.ia.us> Message-ID: <49AC4CB6.8050404@canterbury.ac.nz> Mike Driscoll wrote: > I'm probably being naive, but why don't you just use one of Python > excellent GUI toolkits? I'm implementing my own cross-platform toolkit, because I don't like any of the existing ones. See http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ -- Greg From greg.ewing at canterbury.ac.nz Mon Mar 2 22:34:58 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 03 Mar 2009 10:34:58 +1300 Subject: [python-win32] OnCtlColor not working? In-Reply-To: References: <8D20BBB55F590E42AADF592A815E861703EE9DB6@zuk35exm65.ds.mot.com> <49ABF158.9020804@co.marshall.ia.us> Message-ID: <49AC5102.1090706@canterbury.ac.nz> Vernon Cole wrote: > So, Greg, can we anticipate a python_gui flavor for Windows in native mode? Yes, it looks like there's a reasonable chance of that happening fairly soon. There are actually two possible ways it could go. I have a partial implementation contributed by one of my users based on ctypes, but it has some issues, and programming at the raw win32api level is a bit much for me to cope with just yet. So I'm working on an alternative implementation based on the mfc layer of pywin32. This does mean an extra dependency, but I consider pywin32 to be fairly standard equipment and not too much of an imposition to require. Also it will work with older versions of Python that don't come with ctypes. It's coming along nicely -- tests up to 07 are working well enough. It's a bit disappointing that buttons don't play fair with respect to colour customisation, but not a serious problem. Now, on to menus... -- Greg From patrick at raptr.com Tue Mar 3 02:10:17 2009 From: patrick at raptr.com (Patrick Li) Date: Mon, 2 Mar 2009 17:10:17 -0800 Subject: [python-win32] How to launch an executable in elevated mode on Vista with UAC on? Message-ID: <2b5a48740903021710q4e25f31ep9e4c84f037cdbed8@mail.gmail.com> Hello, I have a python program that needs to launch an executable (it is an installer executable) that requires admin privileges. This works fine on XP and Vista machines where UAC is turned off. On Vista machines with UAC on, however, it doesn't appear to allow the program to launch the executable. I currently use win32process.CreateProcess() to launch the executable. Does anyone know of a way I can launch the executable with UAC on? Ideally, it should prompt the user to run the executable in elevated mode. Any help would be greatly appreciated. Thanks, Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Tue Mar 3 03:01:34 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 03 Mar 2009 13:01:34 +1100 Subject: [python-win32] How to launch an executable in elevated mode on Vista with UAC on? In-Reply-To: <2b5a48740903021710q4e25f31ep9e4c84f037cdbed8@mail.gmail.com> References: <2b5a48740903021710q4e25f31ep9e4c84f037cdbed8@mail.gmail.com> Message-ID: <49AC8F7E.9080009@gmail.com> On 3/03/2009 12:10 PM, Patrick Li wrote: > Hello, > > I have a python program that needs to launch an executable (it is an > installer executable) that requires admin privileges. This works fine > on XP and Vista machines where UAC is turned off. On Vista machines > with UAC on, however, it doesn't appear to allow the program to launch > the executable. > > I currently use win32process.CreateProcess() to launch the executable. > > Does anyone know of a way I can launch the executable with UAC on? > Ideally, it should prompt the user to run the executable in elevated mode. > > Any help would be greatly appreciated. The only way I'm aware of is to use ShellExecute[Ex] with the 'runas' verb. Cheers, Mark From theller at ctypes.org Tue Mar 3 12:59:15 2009 From: theller at ctypes.org (Thomas Heller) Date: Tue, 03 Mar 2009 12:59:15 +0100 Subject: [python-win32] OnCtlColor not working? In-Reply-To: <49AC5102.1090706@canterbury.ac.nz> References: <8D20BBB55F590E42AADF592A815E861703EE9DB6@zuk35exm65.ds.mot.com> <49ABF158.9020804@co.marshall.ia.us> <49AC5102.1090706@canterbury.ac.nz> Message-ID: Greg Ewing schrieb: > Vernon Cole wrote: > >> So, Greg, can we anticipate a python_gui flavor for Windows in native mode? > > Yes, it looks like there's a reasonable chance of that > happening fairly soon. > > There are actually two possible ways it could go. I > have a partial implementation contributed by one of > my users based on ctypes, but it has some issues, > and programming at the raw win32api level is a bit > much for me to cope with just yet. While I have promised writing one based on ctypes myself I never got around for that. But I would be interested in helping out to fix the remaining issues. Is the ctypes implementation available somewhere? -- Thanks, Thomas From greg.ewing at canterbury.ac.nz Tue Mar 3 22:59:18 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Wed, 04 Mar 2009 10:59:18 +1300 Subject: [python-win32] Finding attached object? Message-ID: <49ADA836.3000400@canterbury.ac.nz> Given a PyAssocObject, is there some way of finding the object that was attached to it with AttachObject? -- Greg From skippy.hammond at gmail.com Wed Mar 4 00:29:56 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 04 Mar 2009 10:29:56 +1100 Subject: [python-win32] Finding attached object? In-Reply-To: <49ADA836.3000400@canterbury.ac.nz> References: <49ADA836.3000400@canterbury.ac.nz> Message-ID: <49ADBD74.7080103@gmail.com> On 4/03/2009 8:59 AM, Greg Ewing wrote: > Given a PyAssocObject, is there some way of finding > the object that was attached to it with AttachObject? Apparently not from Python. It would be easy to add, but I guess that doesn't help you much now (or parse the repr() and use ctypes to de-ref the pointer, then wash your hands ;) Cheers, Mark From greg.ewing at canterbury.ac.nz Wed Mar 4 02:01:40 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Wed, 04 Mar 2009 14:01:40 +1300 Subject: [python-win32] Finding attached object? In-Reply-To: <49ADBD74.7080103@gmail.com> References: <49ADA836.3000400@canterbury.ac.nz> <49ADBD74.7080103@gmail.com> Message-ID: <49ADD2F4.7030408@canterbury.ac.nz> Mark Hammond wrote: > Apparently not from Python. It would be easy to add, If you do happen to add this, another thing you might want to investigate is why PyCCmdUI isn't automatically doing this when you read the m_pMenu property, as seems to happen in most other places if you call a method that returns a wrapped MFC object. > but I guess that > doesn't help you much now (or parse the repr() and use ctypes to de-ref > the pointer, then wash your hands ;) I was hoping to avoid having to use ctypes:-(. I'm working around it for now using weak refs and a global dict to make my own reverse mapping, but it's disappointing having to do this when the information is hidden in there all along. -- Greg From skippy.hammond at gmail.com Thu Mar 5 00:38:08 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 05 Mar 2009 10:38:08 +1100 Subject: [python-win32] Finding attached object? In-Reply-To: <49ADD2F4.7030408@canterbury.ac.nz> References: <49ADA836.3000400@canterbury.ac.nz> <49ADBD74.7080103@gmail.com> <49ADD2F4.7030408@canterbury.ac.nz> Message-ID: <49AF10E0.9070202@gmail.com> On 4/03/2009 12:01 PM, Greg Ewing wrote: > If you do happen to add this, another thing you might > want to investigate is why PyCCmdUI isn't automatically > doing this when you read the m_pMenu property, as seems > to happen in most other places if you call a method > that returns a wrapped MFC object. Hrm - m_pMenu (and m_pSubMenu) is *supposed* to return a PyCMenu object - what are you seeing? Cheers, Mark From greg.ewing at canterbury.ac.nz Thu Mar 5 02:48:20 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Thu, 05 Mar 2009 14:48:20 +1300 Subject: [python-win32] Finding attached object? In-Reply-To: <49AF10E0.9070202@gmail.com> References: <49ADA836.3000400@canterbury.ac.nz> <49ADBD74.7080103@gmail.com> <49ADD2F4.7030408@canterbury.ac.nz> <49AF10E0.9070202@gmail.com> Message-ID: <49AF2F64.1040808@canterbury.ac.nz> Mark Hammond wrote: > Hrm - m_pMenu (and m_pSubMenu) is *supposed* to return a PyCMenu object > - what are you seeing? They're returning a PyCMenu, but not the object that I have attached to the PyCMenu. This seems to happen automatically in some other places, e.g. ui.GetFocus(). If m_pMenu behaved that way as well, I wouldn't have had a problem. While on the subject, there's something I'm a bit confused about. According to the MS docs, when you destroy an HMENU that has sub-menus attached, the sub-menus are destroyed as well. This suggests that the only reasonable way to attach a PyCMenu as a sub-menu is to Detach its menu handle first. If that's true, then the PyCMenu object isn't much use any more, so you might as well throw it away, and not getting the attached object from m_pMenu probably isn't so much of a problem. But what happens if a PyCMenu object returned by m_pMenu or m_pSubMenu gets deallocated before the parent menu? It seems as though it will end up destroying an HMENU that it doesn't really own, and stuff up the menu that contains it. On another topic, another thing it would have really been handy to have access to is the m_bAutoMenuEnable property of CFrameWnd. PyGUI has its own scheme for managing menu item enabling, and MFC's one just gets in the way. If I could turn it off, it would save me a lot of hassle. -- Greg From adit99 at gmail.com Fri Mar 6 02:58:35 2009 From: adit99 at gmail.com (Aditya Jayraman) Date: Thu, 5 Mar 2009 17:58:35 -0800 Subject: [python-win32] LsaLogonUser in win32security? Message-ID: I was wondering if the pywin32 package implements the LsaLogonUser() method (not to be confused with the LogonUser() method) I looked through the win32security module and could not find it. Thanks --Aditya -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Fri Mar 6 07:04:55 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 06 Mar 2009 19:04:55 +1300 Subject: [python-win32] Confused about PreTranslateMessage Message-ID: <49B0BD07.9050302@canterbury.ac.nz> I'm having trouble understanding how PreTranslateMessage is supposed to work. According to M$: Return value: Nonzero if the message was translated and should not be dispatched; 0 if the message was not translated and should be dispatched. and according to the pywin32 docs: The result should be a tuple of the same format as the msg param, in which case the MSG structure will be updated and TRUE returned from the C++ function. If all of that is true, I don't see what the purpose is of updating the MSG, since it's just going to be ignored when TRUE is returned. But in any case it doesn't seem to be working -- the original message gets dispatched anyway, regardless of what I return from my PreTranslateMessage method. So I'm totally confused at this point. Should I be able to prevent the original message from being dispatched, and if so, how do I go about it? -- Greg From niki at vintech.bg Fri Mar 6 09:35:35 2009 From: niki at vintech.bg (niki) Date: Fri, 06 Mar 2009 10:35:35 +0200 Subject: [python-win32] Confused about PreTranslateMessage In-Reply-To: <49B0BD07.9050302@canterbury.ac.nz> References: <49B0BD07.9050302@canterbury.ac.nz> Message-ID: <49B0E057.4090803@vintech.bg> Greg Ewing wrote: > I'm having trouble understanding how PreTranslateMessage > is supposed to work. > > According to M$: > > Return value: Nonzero if the message was translated > and should not be dispatched; 0 if the message was > not translated and should be dispatched. > > and according to the pywin32 docs: > > The result should be a tuple of the same format as > the msg param, in which case the MSG structure will > be updated and TRUE returned from the C++ function. > > If all of that is true, I don't see what the purpose > is of updating the MSG, since it's just going to be > ignored when TRUE is returned. > > But in any case it doesn't seem to be working -- the > original message gets dispatched anyway, regardless > of what I return from my PreTranslateMessage method. > > So I'm totally confused at this point. Should I be > able to prevent the original message from being > dispatched, and if so, how do I go about it? > IIRC one have to patch PreTranslateMessage code in order to get all variants to work. I can dig my old patches if required, but using MFC is PITA anyway. Venster project has some good substitute ctypes code. Niki From julio.dilisa at thalesaleniaspace.com Fri Mar 6 10:09:36 2009 From: julio.dilisa at thalesaleniaspace.com (julio.dilisa at thalesaleniaspace.com) Date: Fri, 6 Mar 2009 10:09:36 +0100 Subject: [python-win32] Python activex Scripting engine error Message-ID: Hello, If I run the code (with wsscript small_pys.pys) given here under, I got this error ========================================================== " Windows Script Host" Error ___________________________ Script:... Line 9 char 0 Error: Traceback... File " Note : J'ai repris votre script tel quel, mais tkinter n'est pas utilis?... @-salutations -- Michel Claveau From rwupole at msn.com Sat Mar 7 12:25:29 2009 From: rwupole at msn.com (Roger Upole) Date: Sat, 7 Mar 2009 06:25:29 -0500 Subject: [python-win32] Re: COM server accessible via "GetObject" Message-ID: pythoncom.RegisterActiveObject inserts an object into the ROT. Roger From greg.ewing at canterbury.ac.nz Mon Mar 9 11:49:26 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Mon, 09 Mar 2009 23:49:26 +1300 Subject: [python-win32] PyCScrollView with no PyCDocument? Message-ID: <49B4F436.9070002@canterbury.ac.nz> Is there any way of creating a ScrollView without needing a Document? I just want a scrollable user-drawable area, but CreateView insists that I supply a Document. What's more, the only way to create a Document seems to be to use a DocTemplate, and the only way to get one of those is to use a resource. But I don't have any resources. -- Greg From skippy.hammond at gmail.com Mon Mar 9 12:09:40 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 09 Mar 2009 22:09:40 +1100 Subject: [python-win32] COM server accessible via "GetObject" In-Reply-To: <49B1D20F.8090803@ata-e.com> References: <49B1D20F.8090803@ata-e.com> Message-ID: <49B4F8F4.5070102@gmail.com> On 7/03/2009 12:46 PM, Greg Antal wrote: > there I've missed it. (Do I have to deal with Monikers and the > RunningObjectTable myself? If so, exactly what are the arguments for the > ROT's "Register" method?) I'm afraid you do, and I'm afraid I can't point you at a reference at the moment (if I could, it would be via either grep or google ;) Cheers, Mark From skippy.hammond at gmail.com Mon Mar 9 12:14:28 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 09 Mar 2009 22:14:28 +1100 Subject: [python-win32] PyCScrollView with no PyCDocument? In-Reply-To: <49B4F436.9070002@canterbury.ac.nz> References: <49B4F436.9070002@canterbury.ac.nz> Message-ID: <49B4FA14.9070807@gmail.com> On 9/03/2009 9:49 PM, Greg Ewing wrote: > Is there any way of creating a ScrollView without needing > a Document? One of the problems with win32ui and the entire MFC world is that you have 3 layers; pywin32 on top of MFC, which is on top of the core win32 ui API (and now appears to be kinda via ATL). MFC is very much an early implementation of the 'model-doc-view' pattern and working without a document is often a real PITA. No not only can I no longer answer your question, I'm quite confident I never could :( [But I will get back to the other unread mails from you once I recover from an awesome long weekend :-] Cheers, Mark From greg.ewing at canterbury.ac.nz Mon Mar 9 12:36:37 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 10 Mar 2009 00:36:37 +1300 Subject: [python-win32] PyCScrollView with no PyCDocument? In-Reply-To: <49B4FA14.9070807@gmail.com> References: <49B4F436.9070002@canterbury.ac.nz> <49B4FA14.9070807@gmail.com> Message-ID: <49B4FF45.50008@canterbury.ac.nz> Mark Hammond wrote: > No not only can I no longer answer your question, I'm quite confident I > never could :( Alternatively, is there a way of getting a valid DocTemplate without having to put a resource in the executable? Some kind of in-memory resource creation or something? -- Greg From greg.ewing at canterbury.ac.nz Tue Mar 10 06:49:26 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 10 Mar 2009 18:49:26 +1300 Subject: [python-win32] PyCScrollView with no PyCDocument? In-Reply-To: <49B4FA14.9070807@gmail.com> References: <49B4F436.9070002@canterbury.ac.nz> <49B4FA14.9070807@gmail.com> Message-ID: <49B5FF66.1080906@canterbury.ac.nz> Well, I think I've found a workaround. The following hack seems to create something looking enough like a PyCDocument to keep it happy while creating a PyCView: dummy = win32ui.CreateRichEditView().GetDocument() The result of this appears to be a PyCDocument that's wrapping a null pointer. The fact that CreateView accepts this suggests that there's really no need to supply a document at creation time as far as the C++ level is concerned. I can't find anything in the MS docs to say there's any such need. Looking at the source, you seem to be doing some very strange things. In the PyCView constructor, first you're hacking around protected members to stuff the CDocument pointer into the m_pDocument member. Then in CreateWindow you're taking it out again and putting it in the CCreateContext. I don't know why you can't just leave all this alone at creation time, or at least make the document argument optional, and expose the AddView method of CDocument as a way of setting the document afterwards. -- Greg From kerneldude at gmail.com Tue Mar 10 07:29:19 2009 From: kerneldude at gmail.com (kerneldude) Date: Tue, 10 Mar 2009 11:59:19 +0530 Subject: [python-win32] Need help in MKS Message-ID: Hi All, I just started working on Mouse, keyboard and screen related automation work, But do not know from where to start as i am newbie with python. If any one knows good newbie tutorial, it would be great help of mine. (I did google also but could not get some thing for basics). Many thanks in advance. Best & warm regards, Kerneldude -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Mar 10 18:44:33 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 10 Mar 2009 10:44:33 -0700 Subject: [python-win32] Need help in MKS In-Reply-To: References: Message-ID: <49B6A701.9080703@probo.com> kerneldude wrote: > > I just started working on Mouse, keyboard and screen related > automation work, > > But do not know from where to start as i am newbie with python. > > If any one knows good newbie tutorial, it would be great help of mine. > (I did google also but could not get some thing for basics). You will have to be more specific about what you hope to accomplish. Your target is way too broad. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kerneldude at gmail.com Wed Mar 11 06:27:22 2009 From: kerneldude at gmail.com (kerneldude) Date: Wed, 11 Mar 2009 10:57:22 +0530 Subject: [python-win32] Need help in MKS In-Reply-To: <49B6A701.9080703@probo.com> References: <49B6A701.9080703@probo.com> Message-ID: Hi Tim, I need to work on all the standard keyboard strokes i.e And on mouse point of view i need to work on mouse events, scrolling , If i am running my scripts it should test all the keystrokes and mouse functionality on the particular Operating system as in my case Windows, linux favour. and i should have log information of each and every check. So could you please provide me some pointer .. Thanks, Mukul ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- On Tue, Mar 10, 2009 at 11:14 PM, Tim Roberts wrote: > kerneldude wrote: > > > > I just started working on Mouse, keyboard and screen related > > automation work, > > > > But do not know from where to start as i am newbie with python. > > > > If any one knows good newbie tutorial, it would be great help of mine. > > (I did google also but could not get some thing for basics). > > You will have to be more specific about what you hope to accomplish. > Your target is way too broad. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From le.dahut at laposte.net Wed Mar 11 10:47:42 2009 From: le.dahut at laposte.net (le dahut) Date: Wed, 11 Mar 2009 10:47:42 +0100 Subject: [python-win32] User transparent authentication with PDC In-Reply-To: <4976588F.4050200@gmail.com> References: <49748FA1.10303@laposte.net> <4974FFBD.3000703@gmail.com> <4975FD36.2090109@laposte.net> <4976588F.4050200@gmail.com> Message-ID: <49B788BE.3050904@laposte.net> I come back with this subject because I still experience some difficulties. I understand well now the principle of "sspi.py". The problem is that the server is a Linux box, I can obviously not use pywin32 on it so how can I manage to do the same thing ? I'm thinking about a ntlm compatible proxy which is able to do transparent win32 authentication. Any ideas ? Mark Hammond wrote : > > On 21/01/2009 3:35 AM, le dahut wrote: > >> I thought using some sort of NTLM like in squid. Your example deals with >> NTLM but reading "Lib/site-packages/win32/lib/sspi.py" I don't >> understand everything. > > > > Can you enlight me ? > > > > In general, NTLM auth is tricky, but enlightenment can probably only > come from reading the MSDN articles on the various functions used. But > in summary, the auth-process is multi-step - generate a request token, > get a response token, generate another request token from that response, > then get a final response with the final auth token. At the end if > this, all you get is a token which identifies the user, and depending on > a number of things, the ability to impersonate that user. > > Cheers, > > Mark > >> >> Mark Hammond wrote : >>> >>> On 20/01/2009 1:35 AM, le dahut wrote: >>>> Hello, >>>> I've written a python network app in which the server runs on a >>>> Samba-PDC (NT Domain controler) and the client on the windows NTdomain >>>> clients. >>>> >>>> I want to authenticate the connexions to the python server using a >>>> transparent method. >>>> >>>> Is there a way to get a user NTdomain authentication token and give it >>>> back to the python-server so that it can validate it against the PDC ? >>> >>> Look for the 'sspi' functions and demos, particularly the >>> win32\demos\security\sspi directory. >>> >>> Cheers, >>> >>> Mark >>> >>> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> http://mail.python.org/mailman/listinfo/python-win32 > > > From timr at probo.com Wed Mar 11 17:20:41 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 11 Mar 2009 09:20:41 -0700 Subject: [python-win32] Need help in MKS In-Reply-To: References: <49B6A701.9080703@probo.com> Message-ID: <49B7E4D9.70003@probo.com> kerneldude wrote: > > I need to work on all the standard keyboard strokes i.e windows menu button, capslock, numlocks, tab key, ESC etc> > > And on mouse point of view i need to work on mouse events, scrolling , > > If i am running my scripts it should test all the keystrokes and mouse > functionality on the particular Operating system as in my case > Windows, linux favour. and i should have log information of each and > every check. This STILL doesn't say anything about what you actually plan to do. For example, are you developing mouse and keyboard hardware, and you want to test whether they actually do the right thing? Are you testing an application you are developing, and you want to inject fake data into that application to see how it responds? Are you trying to learn how to write filter drivers to add some kind of hardware features? Those are three VERY different kinds of tasks, requiring very different approaches. The more specific you can be, the better the advice we can offer. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kerneldude at gmail.com Thu Mar 12 11:40:17 2009 From: kerneldude at gmail.com (kerneldude) Date: Thu, 12 Mar 2009 16:10:17 +0530 Subject: [python-win32] Need help in MKS In-Reply-To: <49B7E4D9.70003@probo.com> References: <49B6A701.9080703@probo.com> <49B7E4D9.70003@probo.com> Message-ID: Hi Tem, Ya i have an application and i need to test that application by providing fake input from keyboard and mouse . In which i need to shoot keystrokes and need to compare it with standard US keyboard keystrokes values . and need to verify if it is correct. Same is true for mouse movement i.e if i am clicking right, left button i need to check whether my application is giving correct o/p. If that mouse is having scroll button, whether it is working or not on application. My Application works on linux as well as on windows too. Regards, Kerneldude -------------------------------------------------------------------------------------------------- On Wed, Mar 11, 2009 at 9:50 PM, Tim Roberts wrote: > kerneldude wrote: > > > > I need to work on all the standard keyboard strokes i.e > windows menu button, capslock, numlocks, tab key, ESC etc> > > > > And on mouse point of view i need to work on mouse events, scrolling , > > > > If i am running my scripts it should test all the keystrokes and mouse > > functionality on the particular Operating system as in my case > > Windows, linux favour. and i should have log information of each and > > every check. > > This STILL doesn't say anything about what you actually plan to do. > > For example, are you developing mouse and keyboard hardware, and you > want to test whether they actually do the right thing? Are you testing > an application you are developing, and you want to inject fake data into > that application to see how it responds? Are you trying to learn how to > write filter drivers to add some kind of hardware features? Those are > three VERY different kinds of tasks, requiring very different approaches. > > The more specific you can be, the better the advice we can offer. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Mar 12 17:22:46 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 12 Mar 2009 09:22:46 -0700 Subject: [python-win32] Need help in MKS In-Reply-To: References: <49B6A701.9080703@probo.com> <49B7E4D9.70003@probo.com> Message-ID: <49B936D6.1000107@probo.com> kerneldude wrote: > > Ya i have an application and i need to test that application by > providing fake input from keyboard and mouse . > > In which i need to shoot keystrokes and need to compare it with > standard US keyboard keystrokes values . and need to verify if it is > correct. > > Same is true for mouse movement i.e if i am clicking right, left > button i need to check whether my application is giving correct o/p. > > If that mouse is having scroll button, whether it is working or not on > application. > > My Application works on linux as well as on windows too. I suggest you take a close look at the "pyAA" library here: http://www.cs.unc.edu/Research/assist/developer.shtml This is a library designed specifically for automating other applications, for doing GUI tests. It was designed by a research team in computing for handicapped folks. I think it will do what you need. This is Windows only. Linux will require a different approach, but then, you did ask this question on a Python-for-Windows mailing list... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kerneldude at gmail.com Fri Mar 13 05:34:21 2009 From: kerneldude at gmail.com (kerneldude) Date: Fri, 13 Mar 2009 10:04:21 +0530 Subject: [python-win32] Need help in MKS In-Reply-To: <49B936D6.1000107@probo.com> References: <49B6A701.9080703@probo.com> <49B7E4D9.70003@probo.com> <49B936D6.1000107@probo.com> Message-ID: Tim, Thanks alot it works for me :-) Regards, KD ----------------------------------------------------------------------------------------------------------------- On Thu, Mar 12, 2009 at 9:52 PM, Tim Roberts wrote: > kerneldude wrote: > > > > Ya i have an application and i need to test that application by > > providing fake input from keyboard and mouse . > > > > In which i need to shoot keystrokes and need to compare it with > > standard US keyboard keystrokes values . and need to verify if it is > > correct. > > > > Same is true for mouse movement i.e if i am clicking right, left > > button i need to check whether my application is giving correct o/p. > > > > If that mouse is having scroll button, whether it is working or not on > > application. > > > > My Application works on linux as well as on windows too. > > I suggest you take a close look at the "pyAA" library here: > http://www.cs.unc.edu/Research/assist/developer.shtml > > This is a library designed specifically for automating other > applications, for doing GUI tests. It was designed by a research team > in computing for handicapped folks. I think it will do what you need. > > This is Windows only. Linux will require a different approach, but > then, you did ask this question on a Python-for-Windows mailing list... > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > http://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From randy at rcs-comp.com Fri Mar 13 16:39:29 2009 From: randy at rcs-comp.com (Randy Syring) Date: Fri, 13 Mar 2009 11:39:29 -0400 Subject: [python-win32] TypeError: PyTime cannot be compared to other types Message-ID: <49BA7E31.5040204@rcs-comp.com> I have a Python script that interacts with Excel files through COM. In one section of the code, I do a loop that compares values: def find_row(self, sheet, needle, column, start=1, end=100): for x in range(start, end+1): if sheet.Range('%s%s' % (column, x)).Value == needle: return x raise ValueNotFound In build 212, this worked fine. However, with build 213, I am now getting the exception: ", line 170, in find_row if sheet.Range('%s%s' % (column, x)).Value == needle: TypeError: PyTime cannot be compared to other types I read the release notes for build 213, but did not find anything specifically mentioning changes related to PyTime. So, is this a bug or a just part of the upgrades in build 213? If its not a bug, what would be the proper way to implement find_row() taking into consideration that some values will be PyTime objects that can not be directly compared to other types. I guess I could just catch the exception and do something with it. But I am not sure how to work with PyTime objects. Thanks. -- -------------------------------------- Randy Syring RCS Computers & Web Solutions 502-644-4776 http://www.rcs-comp.com "Whether, then, you eat or drink or whatever you do, do all to the glory of God." 1 Cor 10:31 -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Sun Mar 15 23:45:24 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Mon, 16 Mar 2009 09:45:24 +1100 Subject: [python-win32] TypeError: PyTime cannot be compared to other types In-Reply-To: <49BA7E31.5040204@rcs-comp.com> References: <49BA7E31.5040204@rcs-comp.com> Message-ID: <49BD8504.1010706@gmail.com> On 14/03/2009 2:39 AM, Randy Syring wrote: > I have a Python script that interacts with Excel files through COM. In > one section of the code, I do a loop that compares values: > > def find_row(self, sheet, needle, column, start=1, end=100): > for x in range(start, end+1): > if sheet.Range('%s%s' % (column, x)).Value == needle: > return x > raise ValueNotFound > > In build 212, this worked fine. However, with build 213, I am now > getting the exception: > > ", line 170, in find_row > if sheet.Range('%s%s' % (column, x)).Value == needle: > TypeError: PyTime cannot be compared to other types Ouch - that does look like a regression caused by the implementation of rich comparisons. For now you should just catch and ignore that error. Cheers, Mark From greg.ewing at canterbury.ac.nz Tue Mar 17 02:01:05 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 17 Mar 2009 13:01:05 +1200 Subject: [python-win32] PyCSlider notification messages Message-ID: <49BEF651.5010400@canterbury.ac.nz> I'm having trouble getting notification messages from a Slider control. According to MS, a Slider is supposed to send WM_HSCROLL messages to its parent window when the user changes it, but this isn't happening. I can get WM_HSCROLL messages from a normal scroll bar, but either the Slider isn't sending them or I'm somehow failing to intercept them. Is HookMessage the right way to catch these? Or is there some other trick to this that I'm missing? -- Greg From skippy.hammond at gmail.com Tue Mar 17 04:06:37 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Tue, 17 Mar 2009 14:06:37 +1100 Subject: [python-win32] PyCSlider notification messages In-Reply-To: <49BEF651.5010400@canterbury.ac.nz> References: <49BEF651.5010400@canterbury.ac.nz> Message-ID: <49BF13BD.5010103@gmail.com> On 17/03/2009 12:01 PM, Greg Ewing wrote: > I'm having trouble getting notification messages from > a Slider control. > > According to MS, a Slider is supposed to send WM_HSCROLL > messages to its parent window when the user changes it, > but this isn't happening. Works for me. In sliderdemo.py, directly after the creation of the control I added: self.HookMessage(self.OnSliderMove, win32con.WM_HSCROLL) and the method: def OnSliderMove(self, params): print "Slider moved" and I see the print as I slide the slider. Cheers, Mark From greg.ewing at canterbury.ac.nz Tue Mar 17 11:40:15 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 17 Mar 2009 22:40:15 +1200 Subject: [python-win32] PyCSlider notification messages In-Reply-To: <49BF13BD.5010103@gmail.com> References: <49BEF651.5010400@canterbury.ac.nz> <49BF13BD.5010103@gmail.com> Message-ID: <49BF7E0F.3050102@canterbury.ac.nz> Mark Hammond wrote: > Works for me. In sliderdemo.py, directly after the creation of the > control I added: > > self.HookMessage(self.OnSliderMove, win32con.WM_HSCROLL) Okay, I've modified that demo similarly and it works for me too. I can investigate further from there, thanks. -- Greg From timr at probo.com Tue Mar 17 17:49:37 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 17 Mar 2009 09:49:37 -0700 Subject: [python-win32] PyCSlider notification messages In-Reply-To: <49BEF651.5010400@canterbury.ac.nz> References: <49BEF651.5010400@canterbury.ac.nz> Message-ID: <49BFD4A1.2010406@probo.com> Greg Ewing wrote: > I'm having trouble getting notification messages from > a Slider control. > > According to MS, a Slider is supposed to send WM_HSCROLL > messages to its parent window when the user changes it, > but this isn't happening. > > I can get WM_HSCROLL messages from a normal scroll bar, > but either the Slider isn't sending them or I'm > somehow failing to intercept them. Remember that a slider oriented vertically will produce WM_VSCROLL messages... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From madhubalav at infotechsw.com Wed Mar 18 06:11:45 2009 From: madhubalav at infotechsw.com (Madhubala) Date: Wed, 18 Mar 2009 10:41:45 +0530 Subject: [python-win32] issue regarding connectivity between client and com server. In-Reply-To: <000a01c9a784$a8cb0990$fa611cb0$@com> References: <000a01c9a784$a8cb0990$fa611cb0$@com> Message-ID: <001701c9a788$08a287f0$19e797d0$@com> Hi , I have an issue regarding connectivity between client and com server. I have a com server implemented in MFC dll having MFC as static library. The requirement is to write python wrapper to it . Using ctypes I wrote a wrapper to MFC dll which exports couple of functions for com initialization and registration. Following is My python pseudo code ----------------------- Loading the dll Call to initialization function in the dll Call to rigstration function in dll (this sequence is specified by the dll documentation. I tried changing the sequence too ) While true loop - this is just to keep server running GUID for com server object is passed as argument to initialization script and all the registry entries seems to be correct when tested with Microsoft visual studio 6.0 tool "ole view" . But when I try to instantiate through ole view tool or through any other client - it hangs up forever till I break the server and shows an error that either no inproc /local server is found . when I create a 'c' application linking to the same above MFC dll , it is working fine to initialize and register and running a server. All security initialization is taken care in the dll . So the way my c code is working , my python code also should work. When I compared the registry entries of servers registered with c application and python application I found that both entries are similar and could not find any faulty entry for python code . Can anyone explain why this behavior is and any solution to the above problem? Thanks, Madhubala -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Thu Mar 19 02:06:23 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 19 Mar 2009 12:06:23 +1100 Subject: [python-win32] issue regarding connectivity between client and com server. In-Reply-To: <001701c9a788$08a287f0$19e797d0$@com> References: <000a01c9a784$a8cb0990$fa611cb0$@com> <001701c9a788$08a287f0$19e797d0$@com> Message-ID: <49C19A8F.6010701@gmail.com> [Oops - forgot to CC the list...] On 7/03/2009 12:46 PM, Greg Antal wrote: > there I've missed it. (Do I have to deal with Monikers and the > RunningObjectTable myself? If so, exactly what are the arguments for the > ROT's "Register" method?) I'm afraid you do, and I'm afraid I can't point you at a reference at the moment (if I could, it would be via either grep or google ;) Cheers, Mark From skippy.hammond at gmail.com Thu Mar 19 02:07:54 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Thu, 19 Mar 2009 12:07:54 +1100 Subject: [python-win32] issue regarding connectivity between client and com server. In-Reply-To: <49C19A8F.6010701@gmail.com> References: <000a01c9a784$a8cb0990$fa611cb0$@com> <001701c9a788$08a287f0$19e797d0$@com> <49C19A8F.6010701@gmail.com> Message-ID: <49C19AEA.1010900@gmail.com> On 19/03/2009 12:06 PM, Mark Hammond wrote: > [Oops - forgot to CC the list...] And when I did it was the wrong message anyway :( Please ignore that... Mark From pbloom at crystald.com Thu Mar 19 23:25:56 2009 From: pbloom at crystald.com (Philip Bloom) Date: Thu, 19 Mar 2009 15:25:56 -0700 Subject: [python-win32] Question on parsing Reparse Points Message-ID: <2DEFEB25B65B1D4C962D79E3CCBAFC7F06E881BA@mpkexc01.eidos.com> Hello, This is my first post the python win32 programming list, so hello. I'm trying to figure out a way to tell where a Reparse Point () is really pointing programmatically. I can determine pretty easily a folder is a Junction (win32api.GetFileAttributes(folder)==1040), but from there, I can't seem to find a way to tell where that reparse point is reparsing into. I've seen C++ code that does it, but it depends on FindFirstFile, which I don't see in win32api or win32file for python. Any ideas? ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Fri Mar 20 02:05:02 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 20 Mar 2009 13:05:02 +1200 Subject: [python-win32] GDI+ text rendering screwed up Message-ID: <49C2EBBE.8070905@canterbury.ac.nz> I'm trying to use GDI+ (via ctypes) to draw text. It works for some fonts but messes up with others. Using Times, for example, it seems to be using the glyphs for one character earlier in the code sequence, so that "Times" comes out as "Shldr" -- except that it uses the widths of the original characters for positioning. Can someone please run the attached code and tell me whether it works for them or not? And any ideas on what I could be doing wrong to cause this? -- Greg -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: win_gdip_text_ctypes.py URL: From timr at probo.com Fri Mar 20 02:55:35 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 19 Mar 2009 18:55:35 -0700 Subject: [python-win32] GDI+ text rendering screwed up In-Reply-To: <49C2EBBE.8070905@canterbury.ac.nz> References: <49C2EBBE.8070905@canterbury.ac.nz> Message-ID: <49C2F797.4080607@probo.com> Greg Ewing wrote: > I'm trying to use GDI+ (via ctypes) to draw text. > It works for some fonts but messes up with others. > Using Times, for example, it seems to be using the > glyphs for one character earlier in the code sequence, > so that "Times" comes out as "Shldr" -- except that it > uses the widths of the original characters for positioning. > > Can someone please run the attached code and tell me > whether it works for them or not? And any ideas on what > I could be doing wrong to cause this? Sadly, I see "Times Italic 48" in black-on-yellow. Do you really have a font called "Times"? The TrueType font is actually called "Times New Roman". There is a "substitution" list for common font names, but I'm not sure I'd want to rely on it. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From greg.ewing at canterbury.ac.nz Fri Mar 20 05:15:30 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 20 Mar 2009 17:15:30 +1300 Subject: [python-win32] GDI+ text rendering screwed up In-Reply-To: <49C2F797.4080607@probo.com> References: <49C2EBBE.8070905@canterbury.ac.nz> <49C2F797.4080607@probo.com> Message-ID: <49C31862.7040608@canterbury.ac.nz> Tim Roberts wrote: > Sadly, I see "Times Italic 48" in black-on-yellow. > > Do you really have a font called "Times"? I'm not sure, but I can use the name "Times" with plain GDI and it works fine, so it seems to be able to find something equivalent. But I'll try using the exact name and see if it works any better. Thanks, Greg From greg.ewing at canterbury.ac.nz Fri Mar 20 06:16:07 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Fri, 20 Mar 2009 17:16:07 +1200 Subject: [python-win32] GDI+ text rendering screwed up In-Reply-To: <49C2F797.4080607@probo.com> References: <49C2EBBE.8070905@canterbury.ac.nz> <49C2F797.4080607@probo.com> Message-ID: <49C32697.7020700@canterbury.ac.nz> Turns out I *sort* of have a font called Times... I've got "Times Bold", "Times Italic" and "Times Bold Italic", but no plain "Times"! "Times New Roman" works fine, though, and it seems that the same is true of all the other fonts for which there is a full set of variations. So it looks like I'll be building in my own translation table. Thanks for the help, Greg From mail at timgolden.me.uk Fri Mar 20 10:58:38 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 20 Mar 2009 09:58:38 +0000 Subject: [python-win32] Question on parsing Reparse Points In-Reply-To: <2DEFEB25B65B1D4C962D79E3CCBAFC7F06E881BA@mpkexc01.eidos.com> References: <2DEFEB25B65B1D4C962D79E3CCBAFC7F06E881BA@mpkexc01.eidos.com> Message-ID: <49C368CE.3030702@timgolden.me.uk> Philip Bloom wrote: > Hello, > > This is my first post the python win32 programming list, so hello. > > I'm trying to figure out a way to tell where a Reparse Point > () is really pointing programmatically. I can determine > pretty easily a folder is a Junction > (win32api.GetFileAttributes(folder)==1040), but from there, I can't seem > to find a way to tell where that reparse point is reparsing into. I've > seen C++ code that does it, but it depends on FindFirstFile, which I > don't see in win32api or win32file for python. You'll need to use the DeviceIoControl function, exposed in win32file from the pywin32 package. I don't think I've got an example to hand, but you can pretty much transliterate any C++ code. You'll have to roll your own structures, tho'. There's a (random) example here in case it helps: http://www.flexhex.com/docs/articles/hard-links.phtml If I get the chance I'll put an example together. FindFirstFile, btw, is sort-of exposed via win32file.FindFilesIterator which wraps it and its companions as a Python iterator. TJG From rwupole at msn.com Fri Mar 20 11:50:06 2009 From: rwupole at msn.com (Roger Upole) Date: Fri, 20 Mar 2009 06:50:06 -0400 Subject: [python-win32] Re: Question on parsing Reparse Points Message-ID: The only way I know of is to call win32file.DeviceIoControl with FSCTL_GET_REPARSE_POINT, and unpack the buffer yourself. Roger -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: get_reparse_target.py URL: From pbloom at crystald.com Mon Mar 23 18:45:43 2009 From: pbloom at crystald.com (Philip Bloom) Date: Mon, 23 Mar 2009 10:45:43 -0700 Subject: [python-win32] Question on parsing Reparse Points In-Reply-To: References: Message-ID: <2DEFEB25B65B1D4C962D79E3CCBAFC7F06E881C8@mpkexc01.eidos.com> Thanks very much for that. That was pretty much old win32 black magic to me and it totally solved my trouble. :) -----Original Message----- From: python-win32-bounces+pbloom=crystald.com at python.org [mailto:python-win32-bounces+pbloom=crystald.com at python.org] On Behalf Of Roger Upole Sent: Friday, March 20, 2009 3:50 AM To: python-win32 at python.org Subject: [python-win32] Re: Question on parsing Reparse Points The only way I know of is to call win32file.DeviceIoControl with FSCTL_GET_REPARSE_POINT, and unpack the buffer yourself. Roger ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From greeder221 at gmail.com Mon Mar 23 18:57:56 2009 From: greeder221 at gmail.com (Gerald Reeder) Date: Mon, 23 Mar 2009 10:57:56 -0700 Subject: [python-win32] Is this a bug? -- pywin32, excel, range addressing Message-ID: <9d256afc0903231057x504b69d6j9dc6be7abe86df4e@mail.gmail.com> I'm trying to return an Excel range using the "A1" type of notation. Specifically: 'e5:e10,e35'. (6 contiguous cells plus 1 more). The return is always just the 6 contiguous cells (e5:e10) but not the one at e35. If I try something like ?a1,a5?, the return is only the value of ?a5?, everything after the comma is ignored. To experiment I've changed the comma with a period, space, semi-colon, etc. (which are all improper Excel syntax) and an exception gets thrown at the gen.py file at line 31739 which is the range() method, so that's working correctly. If I look at the range.count property it is 7 which is also correct. If I look at the len() of the returned tuple it also shows 7 but the tuple only has 6 elements. I've tried changing the .Empty/.Missing/.ArgNotFound on the three lines (71, 18, and 19) but that makes no difference. I've searched the groups and lists but haven't found anything on this. Why is that last cell value never returned? Am I missing something or is this maybe a bug? I?m using Python 2.6 PythonWin 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32. I?ve searched but haven?t found anything on this issue, thanks in advance, JR -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Tue Mar 24 10:02:37 2009 From: greg.ewing at canterbury.ac.nz (Greg Ewing) Date: Tue, 24 Mar 2009 21:02:37 +1200 Subject: [python-win32] Rendering to bitmap with OpenGL Message-ID: <49C8A1AD.80804@canterbury.ac.nz> I'm trying to create an OpenGL context for rendering to an offscreen bitmap. The attached program gets as far as trying to call wglCreateContext, then fails with WindowsError: [Errno 8] Not enough storage is available to process this command. Can anyone see what's going wrong here? Thanks, Greg -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: win_opengl_offscreen.py URL: From etaoinbe at yahoo.com Tue Mar 24 17:23:56 2009 From: etaoinbe at yahoo.com (jo) Date: Tue, 24 Mar 2009 09:23:56 -0700 (PDT) Subject: [python-win32] how to hibernate from python ? how to detect idleness of the pc ? Message-ID: <328555.45777.qm@web50905.mail.re2.yahoo.com> Hi I would like to automatically hibernate my home pc when my wife has not been using it for say half an hour. Two things I dont know - how to hibernate from python - how to detect idleness of the pc The pc is not set for automatic hibernate as we sometimes run longer running tasks that hibernate ignores about. My script would ofcourse know not to shut in that case. tx J. From mail at timgolden.me.uk Tue Mar 24 17:52:57 2009 From: mail at timgolden.me.uk (Tim Golden) Date: Tue, 24 Mar 2009 16:52:57 +0000 Subject: [python-win32] how to hibernate from python ? how to detect idleness of the pc ? In-Reply-To: <328555.45777.qm@web50905.mail.re2.yahoo.com> References: <328555.45777.qm@web50905.mail.re2.yahoo.com> Message-ID: <49C90FE9.8050308@timgolden.me.uk> jo wrote: > Hi > > I would like to automatically hibernate my home pc when my wife has not been using it for say half an hour. > > Two things I dont know > > - how to hibernate from python http://mail.python.org/pipermail/python-win32/2008-June/007698.html > - how to detect idleness of the pc That's more tricky. You can use GetLastInputInfo from user32.dll via ctypes. But that only gives you info about the app which called it (!). You could try installing a system hook, but that's way too elaborate and intrusive, I think. What I suggest is that you simply detect when the system goes into screen lock of its own accord. You can use the technique described here, mutatis mutandis: http://timgolden.me.uk/python/win32_how_do_i/see_if_my_workstation_is_locked.html and then check additionally for whatever other long-running processes you want to keep running. TJG From andrews at korbitec.com Mon Mar 30 10:09:58 2009 From: andrews at korbitec.com (Andrew Spagnoletti) Date: Mon, 30 Mar 2009 10:09:58 +0200 Subject: [python-win32] Probelm with win32api dll load failed Message-ID: Hi, ? I have developed an application with Python 2.6 and wxPython and prepared the set up using py2exe and InstallJammer. ? When I generated the installation from ?my Vista machine and then install it on an XP computer (not sure if there is any significance to the Vista -> XP), when I run the installed program on the XP machine I get the following log (note that LegaliteInvoice contains the following import, but so does LegaliteMain ? which calls LegaliteViewTransactions which calls LegaliteInvoice): - from win32com.client import Dispatch ? Traceback (most recent call last): ? File "LegaliteMain.pyw", line 13, in ? File "LegaliteViewTransactions.pyc", line 8, in ? File "LegaliteInvoice.pyc", line 7, in ? File "win32com\__init__.pyc", line 5, in ? File "win32api.pyc", line 12, in ? File "win32api.pyc", line 10, in __load ImportError: DLL load failed: The specified procedure could not be found. ? Any ideas? ? Andrew Spagnoletti -------------------------- Sent using BlackBerry From etaoinbe at yahoo.com Mon Mar 30 15:24:42 2009 From: etaoinbe at yahoo.com (jo) Date: Mon, 30 Mar 2009 06:24:42 -0700 (PDT) Subject: [python-win32] d:\python25\lib\site-packages\pytz\__init__.py:29: UserWarning: Module pythoncom was already imported from C:\WINDOWS\system32\pythoncom25.dll, but d:\python25\lib\site-packages\pywin32-210-py2.5-win32.egg is being added to sys.path Message-ID: <877572.95442.qm@web50902.mail.re2.yahoo.com> What is the best way to solve this conflict ? from pylab import * d:\python25\lib\site-packages\pytz\__init__.py:29: UserWarning: Module pywintypes was already imported from C:\WINDOWS\system32\pywintypes25.dll, but d:\python25\lib\site-packages\pywin32-210-py2.5-win32.egg is being added to sys.path from pkg_resources import resource_stream d:\python25\lib\site-packages\pytz\__init__.py:29: UserWarning: Module pythoncom was already imported from C:\WINDOWS\system32\pythoncom25.dll, but d:\python25\lib\site-packages\pywin32-210-py2.5-win32.egg is being added to sys.path from pkg_resources import resource_stream Tx J. From siddhartha.veedaluru at gmail.com Mon Mar 30 17:25:31 2009 From: siddhartha.veedaluru at gmail.com (siddhartha veedaluru) Date: Mon, 30 Mar 2009 20:55:31 +0530 Subject: [python-win32] is these modules available for IA64bit Message-ID: <424b71ec0903300825p380d51a9yffc4f25e57536a@mail.gmail.com> hi, i have a product (client/server based) that can be installed on any window server os with 32,x64 and IA64 bit support. i need to run my scripts which will update my product. i wrote for 32bit using python2.5 and using pyodbc, pywin32 modules. I see that i can use 32bit ones on x64 but not on IA64 Are these modules available for IA64 pyodbc pywin32. If this message seems wrong.Please correct me and help me on achiving this? Also i want to know if "wmi" module is availble for IA64 Please point to right people regards, Sid -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Mar 30 19:05:06 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 30 Mar 2009 10:05:06 -0700 Subject: [python-win32] is these modules available for IA64bit In-Reply-To: <424b71ec0903300825p380d51a9yffc4f25e57536a@mail.gmail.com> References: <424b71ec0903300825p380d51a9yffc4f25e57536a@mail.gmail.com> Message-ID: <49D0FBC2.8030405@probo.com> siddhartha veedaluru wrote: > > i have a product (client/server based) that can be installed on any > window server os with 32,x64 and IA64 bit support. > i need to run my scripts which will update my product. > i wrote for 32bit using python2.5 and using pyodbc, pywin32 modules. > > I see that i can use 32bit ones on x64 but not on IA64 Why do you think so? 32-bit Python should work seamlessly on IA64. Microsoft has gone to great pains to ensure that. > Are these modules available for IA64 > pyodbc > pywin32. > > If this message seems wrong.Please correct me and help me on achiving > this? > > Also i want to know if "wmi" module is availble for IA64 There is virtually no real development going on for IA64, because there are virtually no sales of IA64 systems. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From rdahlstrom at directedge.com Mon Mar 30 19:06:15 2009 From: rdahlstrom at directedge.com (Dahlstrom, Roger) Date: Mon, 30 Mar 2009 13:06:15 -0400 Subject: [python-win32] is these modules available for IA64bit In-Reply-To: <49D0FBC2.8030405@probo.com> References: <424b71ec0903300825p380d51a9yffc4f25e57536a@mail.gmail.com> <49D0FBC2.8030405@probo.com> Message-ID: <70D9B06B9E99EE4E98E4893703ADA141146A6667DE@EXCHANGE1.global.knight.com> Possibly 64 bit python is installed instead of 32 bit python? If you install 32 bit python, you'll have your libraries. -----Original Message----- From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org] On Behalf Of Tim Roberts Sent: Monday, March 30, 2009 1:05 PM To: Python-Win32 List Subject: Re: [python-win32] is these modules available for IA64bit siddhartha veedaluru wrote: > > i have a product (client/server based) that can be installed on any > window server os with 32,x64 and IA64 bit support. > i need to run my scripts which will update my product. > i wrote for 32bit using python2.5 and using pyodbc, pywin32 modules. > > I see that i can use 32bit ones on x64 but not on IA64 Why do you think so? 32-bit Python should work seamlessly on IA64. Microsoft has gone to great pains to ensure that. > Are these modules available for IA64 > pyodbc > pywin32. > > If this message seems wrong.Please correct me and help me on achiving > this? > > Also i want to know if "wmi" module is availble for IA64 There is virtually no real development going on for IA64, because there are virtually no sales of IA64 systems. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32 at python.org http://mail.python.org/mailman/listinfo/python-win32 DISCLAIMER: This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this in error, please immediately notify me and permanently delete the original and any copy of any e-mail and any printout thereof. E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. NOTICE REGARDING PRIVACY AND CONFIDENTIALITY Direct Edge ECN LLC may, at its discretion, monitor and review the content of all e-mail communications. www.directedge.com From cappy2112 at gmail.com Mon Mar 30 22:04:45 2009 From: cappy2112 at gmail.com (Tony Cappellini) Date: Mon, 30 Mar 2009 13:04:45 -0700 Subject: [python-win32] Specifying an initial directory name for win32ui.CreateFileDialog() Message-ID: <8249c4ac0903301304o455d07b2lc38be5de8edc52b7@mail.gmail.com> I want to specify the directory in which win32ui .CreateFileDialog() should be displayed. The arguments in the help PyCFileDialog = * CreateFileDialog(bFileOpen, defExt , fileName , flags , filter , parent *) don't seem to allow this. I know I can specify the initial director (among other things) when I invoke the File Open browser from wxPython and other gui frameworks. How do I do this with the bare bones Win32 api? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Mar 30 22:29:20 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 30 Mar 2009 13:29:20 -0700 Subject: [python-win32] Specifying an initial directory name for win32ui.CreateFileDialog() In-Reply-To: <8249c4ac0903301304o455d07b2lc38be5de8edc52b7@mail.gmail.com> References: <8249c4ac0903301304o455d07b2lc38be5de8edc52b7@mail.gmail.com> Message-ID: <49D12BA0.1090908@probo.com> Tony Cappellini wrote: > > I want to specify the directory in which win32ui > .CreateFileDialog() should be displayed. > The arguments in the help PyCFileDialog = > *CreateFileDialog(/bFileOpen//, defExt/ /, fileName/ /, flags/ /, > filter/ /, parent/ *) > don't seem to allow this. > > I know I can specify the initial director (among other things) when I > invoke the File Open browser from wxPython and other gui frameworks. > > How do I do this with the bare bones Win32 api? That function returns an object to you, which wraps the OPENFILENAME structure from the common dialog. You can call dlg.SetOFNInitialDir( 'xxx' ) to set the initial directory before you call dlg.DoModal() to display the dialog. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From skippy.hammond at gmail.com Tue Mar 31 15:40:22 2009 From: skippy.hammond at gmail.com (Mark Hammond) Date: Wed, 01 Apr 2009 00:40:22 +1100 Subject: [python-win32] d:\python25\lib\site-packages\pytz\__init__.py:29: UserWarning: Module pythoncom was already imported from C:\WINDOWS\system32\pythoncom25.dll, but d:\python25\lib\site-packages\pywin32-210-py2.5-win32.egg is being added to sys.path In-Reply-To: <877572.95442.qm@web50902.mail.re2.yahoo.com> References: <877572.95442.qm@web50902.mail.re2.yahoo.com> Message-ID: <49D21D46.1020908@gmail.com> On 31/03/2009 12:24 AM, jo wrote: > What is the best way to solve this conflict ? > > from pylab import * > d:\python25\lib\site-packages\pytz\__init__.py:29: UserWarning: Module pywintypes was already imported from C:\WINDOWS\system32\pywintypes25.dll, but d:\python25\lib\site-packages\pywin32-210-py2.5-win32.egg is being added to sys.path > from pkg_resources import resource_stream > d:\python25\lib\site-packages\pytz\__init__.py:29: UserWarning: Module pythoncom was already imported from C:\WINDOWS\system32\pythoncom25.dll, but d:\python25\lib\site-packages\pywin32-210-py2.5-win32.egg is being added to sys.path > from pkg_resources import resource_stream Probably to remove the .egg install of pywin32-210 (check easy-install.pth for references to that .egg too) and stick with the .exe installers from sourceforge (.egg installers for pywin32 aren't 'official' (ie, released by me) yet...) Cheers, Mark. From mdriscoll at co.marshall.ia.us Tue Mar 31 16:08:18 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Tue, 31 Mar 2009 09:08:18 -0500 Subject: [python-win32] Probelm with win32api dll load failed In-Reply-To: References: Message-ID: <49D223D2.9000502@co.marshall.ia.us> Andrew Spagnoletti wrote: > Hi, > ? > I have developed an application with Python 2.6 and wxPython and prepared the set up using py2exe and InstallJammer. > ? > When I generated the installation from ?my Vista machine and then install it on an XP computer (not sure if there is any significance to the Vista -> XP), when I run the installed program on the XP machine I get the following log (note that LegaliteInvoice contains the following import, but so does LegaliteMain ? which calls LegaliteViewTransactions which calls LegaliteInvoice): - > from win32com.client import Dispatch > ? > Traceback (most recent call last): > ? File "LegaliteMain.pyw", line 13, in > ? File "LegaliteViewTransactions.pyc", line 8, in > ? File "LegaliteInvoice.pyc", line 7, in > ? File "win32com\__init__.pyc", line 5, in > ? File "win32api.pyc", line 12, in > ? File "win32api.pyc", line 10, in __load > ImportError: DLL load failed: The specified procedure could not be found. > ? > Any ideas? > ? > > Andrew Spagnoletti > > ---------- This is a py2exe question, but I think you need to specifically include the win32com library in your setup.py file that you use to build the executable with py2exe. See their docs for how to do that. - Mike