[python-win32] handle is invalid?
reehdus
sudheer_87 at hotmail.com
Thu Jul 23 02:26:12 CEST 2009
ahha...that would explain a lot...nope...roger's method was excellent...I was
trying this out before I saw his recipe. I see...well...pardon my ignorance
since I'm pretty new at Python...it didn't really occur to me that
FindWindow was redundant. Well, now I know better...hahaha. Thanks!
Tim Roberts wrote:
>
> 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, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
>
--
View this message in context: http://www.nabble.com/handle-is-invalid--tp24599116p24617252.html
Sent from the Python - python-win32 mailing list archive at Nabble.com.
More information about the python-win32
mailing list