sudheer sivathasan wrote: > Hey guys, > > Another quick question. I'm still trying to do the thing in the email > below. But this time im trying to use the win32api.GetModuleFileName > function. It requires a PyHandle as an input which I think I've > managed to get by using the function handle = > w.FindWindow(0,str(w.GetWindowText(w.GetForegroundWindow()))) where > handle would serve as the input to the win32api.GetModuleFileName > function and w = win32gui. However I'm getting a 'the handle is > invalid' error.
Yes, because FindWindow returns a window handle, and GetModuleFileName expects a module handle. Handles are not all alike. Roger Upole gave you exactly the recipe you need. Was there something about his reply that you didn't like? By the way, your code there is somewhat silly: the FindWindow call will return exactly the same handle that GetForegroundWindow already gave you. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32