Re: Finding HWND of the current thread
Jan Wassenberg <[email protected]>
| Newsgroups | gmane.games.devel.windows |
|---|---|
| Message-ID | <opsbyqwpi7gzpdqz@localhost> |
On Thu, 29 Jul 2004 01:04:04 -0700, Jon Watte <[email protected]> wrote: > May I suggest that you're not guaranteed that GetModuleHandle() returns a > pointer to your executable header, and you're not guaranteed that your > executable loads at 0x400000 ? They might have a hard time changing this > behavior for existing apps, especially because of hacky code like the > posted code, but you never know about future versions. > > If you want the header, use GetModuleFileName() on the main module, and > read the header yourself. Then check whether the header is actually a > "PE" header, and just assume you're not console if it isn't. At least, > that won't CRASH when you port your code, or some new version of > Windows comes out. That would be the more correct way of going about things :) However, I don't think these assumptions can ever be broken (famous last words). The app load address must stay the same, since PE relocation info is no longer generated (because 0x400000 is guaranteed). GetModuleHandle has to return a pointer, since crt0 currently uses it as such (checking if the app is managed). Now if they're willing to break every single (not recompileable) program in existence with future versions, all bets are off. Best Regards Jan ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ Gamedevlists-windows mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555