GetWindowModuleFileName and EnumWindows Being Odd

BlitzMax Forums/BlitzMax Beginners Area/GetWindowModuleFileName and EnumWindows Being Odd

Gabriel(Posted 2005) [#1]
Yes, apparently I'm having even more problems with WinAPI programming. Nothing seems to work as advertised.

GetWindowModuleFileName is just wrong most of the time. It says it returns the EXE but it doesn't. For example, FireFox instances return the name of MYPROGRAM.exe ( IE: the name of the BMax program which is querying this information. And the process id's are all the same too. Now ok, FireFox has tabbed windows, so I'm ok with it return the same process id for each window, but it really shouldn't be returning the same process id for my blitzmax program and firefox. And some other stuff too.

GetWindowThreadProcessId is the same as above really. As I mentioned, the process id's are not unique, nor close.

EnumWindows is supposed to return only top level windows but it returns a huge number of windows. Is this really right?

I've spent hours googling for this stuff, but all I can find is numerous pages offering the same explanations and people describing how it does exactly what I want in each case. Except that none of it does.


Perturbatio(Posted 2005) [#2]
Using win2k/winNT/(XP?) - http://support.microsoft.com/default.aspx?scid=kb;en-us;228469


Gabriel(Posted 2005) [#3]
Ok thanks, now that I've got OS detection working correctly, I can look into that.

And I've figured out why the thread id's were the same. I was looking at some code for B3d where someone was returning thread id's as int's and just assumed that was correct, but it's not. Thread ID's are, in fact, 64 bit numbers and need to be returned as Long's. When I do that, they're all different, except that multiple instances of FireFox return the same Process ID, which is the desired behaviour.

Getting somewhere, at last, I think.