GetVersion() vs GetVersionEx()
Bradley V. Pohl -- brad.pohl@pobox.com Sunday, January 05, 1997 Environment: MSVC 4.1, Windows NT 4.0 Hello, all. If you ever go spelunking through MFC 4.1's source, you will notice that = GetVersion() is used all over the place to determine the platform on which the code is executing. (This is true = in 4.2 as well). =20 Because of the availability of GetVersionEx(), I've become a little = suspicious as to why it is not used instead. I can find no reference to any problems with GetVersionEx() in MSDN, and = the SDK documentation on GetVersionEx also explicity recommends using = GetVersionEx() over GetVersion(). I was simply wondering if there's something I don't know about = GetVersionEx() that I should. Personally, I would much rather call GetVersionEx() and use the nice platform constants rather than call = GetVersion() and check the high-order bit, etc. Thanks, --Brad -- Brad Pohl Custom software development & = solutions brad.pohl@pobox.com Internet and intranet consulting = services The Brads' Consulting Windows NT/Windows 95 software = development http://www.thebrads.com Web site planning, development and = maintenance
Mike Blaszczak -- mikeblas@nwlink.com Monday, January 06, 1997 [Mini-digest: 2 responses] At 21:55 1/5/97 -0500, Bradley V. Pohl wrote: >Environment: MSVC 4.1, Windows NT 4.0 >Because of the availability of GetVersionEx(), I've become a >little suspicious as to why it is not used instead. GetVersionEx() is inconvenient. To use GetVersionEx(), you need to allocate a structure and call the API, like this: OSVERSIONINFO osvi; if (!GetVersionEx()) AfxTerm(); else { party_on_it(); } and that's clumsy. If you use GetVersion(), you can perform the call right there inline: if ((DWORD)(LOBYTE(LOWORD(dwVersion))) >= 4) { // new shell code here } else { // not new shell code here } In many situations where MFC need to know this information, such as during initialization, it's awkward to allocate a structure and code extra if()'s to check it. .B ekiM http://www.nwlink.com/~mikeblas/ Why does the "new" Corvette look like a 1993 RX-7? These words are my own. I do not speak on behalf of Microsoft. -----From: "Otala, Tapani"Brad, GetVersionEx() wasn't introduced until NT 3.51 [and Win95], which is probably why they used GetVersion() instead. Tapani >---------- >From: Bradley V. Pohl[SMTP:brad.pohl@pobox.com] >Sent: Sunday, January 05, 1997 18:55 >To: '_posting: mfc-l' >Subject: GetVersion() vs GetVersionEx() > >Environment: MSVC 4.1, Windows NT 4.0 > >Hello, all. > >If you ever go spelunking through MFC 4.1's source, you will notice that >GetVersion() is used all over the place >to determine the platform on which the code is executing. (This is true in >4.2 as well). > >Because of the availability of GetVersionEx(), I've become a little >suspicious as to why it is not used instead. >I can find no reference to any problems with GetVersionEx() in MSDN, and the >SDK documentation on GetVersionEx also explicity recommends using >GetVersionEx() over GetVersion(). > >I was simply wondering if there's something I don't know about GetVersionEx() >that I should. Personally, I would much rather >call GetVersionEx() and use the nice platform constants rather than call >GetVersion() and check the high-order bit, etc. > >Thanks, > >--Brad > >-- >Brad Pohl Custom software development & solutions >brad.pohl@pobox.com Internet and intranet consulting services >The Brads' Consulting Windows NT/Windows 95 software development >http://www.thebrads.com Web site planning, development and maintenance > >
| Вернуться в корень Архива |