Different structs on different windows versions ? 
Author Message
 Different structs on different windows versions ?

Hi,

I have a problem regarding that structures contain different fields on
different versions of windows.
I want to write a program that gets the maximum of information out of
the structures and the problem
is that the struct contains more fields on windows 2000 than for example
windows 98. Below I have
written a typical example of a MFC struct with preprocessor #IF commands
that makes the struct
different on different windows versions. One way that I have found is to
set WINVER=0x501 or
something which makes the largest struct be allocated on all versions
and then use _winver variable
to check what fields that are really usable to read at the moment. But
this does not work when you
have a struct that has the dwSize field which needs to be set to the
size of the struct.
example->dwSize = sizeof(FOREXAMPLE). Because using WINVER=0x501 as
preprocessor
command makes some of the windows 98 calls reject the struct since on
windows 98 the struct
should have been some other size to be accepted (not the windows 2000
size).
How is cases like this normally shown, this must be a very common
problem ?

Br
Thony

typedef struct ForExample {
#if (WINVER >= 0x401)
  DWORD       dwOne;
#endif
#if (WINVER >= 0x500)
   DWORD    dwTwo;
#endif
#if (WINVER >= 0x501)
  DWORD     dwThree;
#endif

Quote:
} FOREXAMPLE;

  thony.lundin.vcf
< 1K Download


Fri, 26 Mar 2004 15:13:23 GMT  
 Different structs on different windows versions ?
Thony!

The key question is, why do you need the complete Win2000 structure for
Win98? In a case like this, I would have centralized the handling of the
information into a single class, letting the class treat it differently
depending on the Windows version (that is, treat it during runtime instead
of during the compilation.

The use of a centralized class would of course give a common interface to
all of the rest of the program.

Johan Rosengren


Quote:
> Hi,

> I have a problem regarding that structures contain different fields on
> different versions of windows.
> I want to write a program that gets the maximum of information out of
> the structures and the problem
> is that the struct contains more fields on windows 2000 than for example
> windows 98. Below I have
> written a typical example of a MFC struct with preprocessor #IF commands
> that makes the struct
> different on different windows versions. One way that I have found is to
> set WINVER=0x501 or
> something which makes the largest struct be allocated on all versions
> and then use _winver variable
> to check what fields that are really usable to read at the moment. But
> this does not work when you
> have a struct that has the dwSize field which needs to be set to the
> size of the struct.
> example->dwSize = sizeof(FOREXAMPLE). Because using WINVER=0x501 as
> preprocessor
> command makes some of the windows 98 calls reject the struct since on
> windows 98 the struct
> should have been some other size to be accepted (not the windows 2000
> size).
> How is cases like this normally shown, this must be a very common
> problem ?

> Br
> Thony

> typedef struct ForExample {
> #if (WINVER >= 0x401)
>   DWORD       dwOne;
> #endif
> #if (WINVER >= 0x500)
>    DWORD    dwTwo;
> #endif
> #if (WINVER >= 0x501)
>   DWORD     dwThree;
> #endif
> } FOREXAMPLE;



Sat, 27 Mar 2004 11:46:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Different ODBC versions accept different parameters???

2. Different Heights for a Window on different machines

3. CImagelist problem on different versions of Windows

4. CImagelist on different versions of Windows

5. Getting name of PrinterDriver files for different version of Windows

6. different versions of Windows

7. addin on different windows version

8. Globals in different files, different types, same names

9. Different sizes of long int on different machines.

10. ATL7 / different OSs == different results

11. Different results of OpenSchema() with different drivers?

12. Why different run on different systems??

 

 
Powered by phpBB® Forum Software