I am writing some C# code to change screen resolution for a shell application.
I am intending to use the Win32 functions:
EnumDisplayDevices ,EnumDisplaySettings, etc
I have written quite alot of code and have had to use Win32 and pinvoke on many occasions. Every time I have the same issue.My question relates to the various Win32 constants that are referred to in the Microsoft documentation. I believe that if you are programming in C++ then you include header files that predefine these constants.
If working in C# where can I look up the values so that I can define these constants myself?
An example of what I am looking for can be found at:
http://msdn.microsoft.com/en-us/library/dd183413(VS.85).aspx
Using the above example URL as an example where can i look up for instance DM_BITSPERPEL or CDS_FULLSCREEN ?
I eventually find the values through Google searches each time I do Win32 programming for each constant but surely there must be a simpler way?
Hope you can help
Regards, Andy
Loading
Sam HobbsPosted Mar 29, 2010, 3:01 PM
So let's look up CDS_FULLSCREEN. Use the Find in Files tool in Visual Studio to search the *.h files. The *.h files are often called #include files, since the C++ #include statement is used to get the definitions in a C++ program. Search the *.h files in the include directory, such as: That assumes you have the SDK installed; if you don't then you need to install it.
When I search, I get the following result:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\WinUser.h(10714):#define CDS_FULLSCREEN 0x00000004
Does that help?
Andy WebsterPosted Apr 1, 2010, 4:02 AM
Sam HobbsPosted Mar 30, 2010, 11:34 AM
One more note. The documentation will usually specify what header (.h) file that a function is in, and you can ususally find what header to look in for a constant based on the function it is used in.
Andy WebsterPosted Mar 30, 2010, 4:01 AM
Thanks for the guidance.
How do you access the find files function of VS? After posting I had managed to figure out the include files were in the path specified and had found the file using the search option in Windows explorer but have not found the find files function in VS. I do use several machines and some have VS 2008 Pro others only have the C# 2008 express edition, is this a Pro only feature as I am currently looking in the express edition? I obviously use the standard find dialogue frequently but was unaware of being able to search the file system from within the environment.
Thanks again
Andy