According to the MS documentation ENUM_CURRENT_SETTINGS should have an
integer value of -1 (which doesn't work in a Cardinal or DWORD type).
Does anyone know of an available fix for this problem?
Steve Wyatt
> I am using Delphi 2006 VCL.NET
Then you should post to the .dotnet group instead.
> I think the larger problem is that the type for the "iModeNum"
> parameter of EnumDisplaySettings is defined as "Cardinal" (DWORD
> in Windows.pas), when it should actually be "Integer".
No, it is supposed to be a Cardinal. Look at the declaration of
EnumDisplaySettings() in winuser.h, or in the Win32 API documentation.
iModeNum really is a DWORD, not an integer.
> According to the MS documentation ENUM_CURRENT_SETTINGS
> should have an integer value of -1 (which doesn't work in a Cardinal
> or DWORD type).
In C++ (which the Win32 API is based on), it does work.
> Does anyone know of an available fix for this problem?
Use $FFFFFFFF instead of -1. Or to use -1, type-cast it to Cardinal
(Windows.pas does that for many values).
Gambit
But I must be missing something.
This statement:
EnumDisplaySettings(nil, 0, DeviceMode);
compiles and runs, but does not give me what I need (current settings).
This statement:
EnumDisplaySettings(nil, (-1 as Cardinal), DeviceMode);
Results in this compile error:
[Pascal Error] Unit1.pas(70): E1012 Constant expression violates
subrange bounds
This statement:
EnumDisplaySettings(nil, $FFFFFFFF, DeviceMode);
Results in this compile error:
[Pascal Error] Unit1.pas(70): E1012 Constant expression violates
subrange bounds
Steve Wyatt
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:48924c7a$1...@newsgroups.borland.com...
> I appreciate the response; sorry I posted to the wrong group.
> I'm never very comfortable deciding on which one to use.
When in doubt about where to post, ask in .non-technical first.
> This statement:
> EnumDisplaySettings(nil, 0, DeviceMode);
> compiles and runs, but does not give me what I need (current settings).
You are asking for settings from graphics mode index 0, not from "current
settings".
> This statement:
> EnumDisplaySettings(nil, (-1 as Cardinal), DeviceMode);
> Results in this compile error:
> [Pascal Error] Unit1.pas(70): E1012 Constant expression violates
> subrange bounds
Don't use 'as' for integer casting like that. Use this instead:
EnumDisplaySettings(nil, Cardinal(-1), DeviceMode);
Or better:
EnumDisplaySettings(nil, DWORD(-1), DeviceMode);
Gambit
I will make a point of posting to .non-technical first in the future.
SW
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:4892662a$1...@newsgroups.borland.com...
> I will make a point of posting to .non-technical first in the future.
Only when you in serious doubt, otherwise just post to the most
appropriate/significant group.
--
Pieter