Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9066413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:43:38+00:00 2026-06-16T16:43:38+00:00

I have function function bgSetDisableOverlappedContent(CAA: BOOL; var ErrorCode: DWORD; ErrorText: string): Boolean; begin errorCode

  • 0

I have function

function bgSetDisableOverlappedContent(CAA: BOOL; var ErrorCode: DWORD; ErrorText: string): Boolean;  
begin
  errorCode := ERROR_SUCCESS;
  ErrorText := '';  
  if not GetOSVersion >= 60 then
    Exit;
  Result := SystemParametersInfo(SPI_SETDISABLEOVERLAPPEDCONTENT, 0, @CAA, 0);
  if not Result then
  begin
    ErrorCode := GetLastError;
    ErrorText := GetErrorText(ErrorCode);
  end;
end;

and call it exactly

procedure TForm1.Button3Click(Sender: TObject);
var
  CAA: BOOL;
  OS: TUsableInOS;
  ErrorCode: DWORD;
  ErrorText: string;
begin
  CAA := False;
  if bgSetDisableOverlappedContent(CAA, ErrorCode, ErrorText) then
    ShowMessage('Success');
end;

But, when I inspect again with next code

function bgGetDisableOverlappedContent(var CAA: BOOL; OS: TUsableInOS; ErrorCode: DWORD; ErrorText: string): Boolean;
begin
  errorCode := ERROR_SUCCESS;
  ErrorText := '';
  os := tosVistaUp;   
  if not GetOSVersion >= 60 then
    Exit;   
  Result := SystemParametersInfo(SPI_GETDISABLEOVERLAPPEDCONTENT, 0, @CAA, 0);   
  if not Result then
  begin
    ErrorCode := GetLastError;
    ErrorText := GetErrorText(ErrorCode);
  end;
end;
function GetOSVersion: Integer;
var
  OSVersionInfo : TOSVersionInfo;
begin
  Result:= 0;
  FillChar(OsVersionInfo, Sizeof(OsVersionInfo), 0);
  OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
  if GetVersionEx(OSVersionInfo) then
  begin
    if OSVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT then
    begin
      if (OsVersionInfo.dwMajorVersion = 5) and ((OsVersionInfo.dwMinorVersion = 0)) then
         Result:= 50; //2000
      if (OsVersionInfo.dwMajorVersion = 5) and ((OsVersionInfo.dwMinorVersion = 1)) then
         Result:= 51; //XP
      if (OsVersionInfo.dwMajorVersion = 5) and ((OsVersionInfo.dwMinorVersion = 2)) then
         Result:= 52; //2003, 2003 R2
      if (OsVersionInfo.dwMajorVersion = 6) and ((OsVersionInfo.dwMinorVersion = 0)) then
         Result:= 60; //Vista, Windows Server 2008
      if (OsVersionInfo.dwMajorVersion = 6) and ((OsVersionInfo.dwMinorVersion = 1)) then
         Result:= 61; //Server 2008 R2, 7
    end;
  end;
end;

result for CAA is again True, even I exactly set CAA := False;
I am working on Win 7. and Result of Result := SystemParametersInfo(SPI_SETDISABLEOVERLAPPEDCONTENT, 0, @CAA, 0); is True, but SPI_GETDISABLEOVERLAPPEDCONTENT returns True for CAA, even in step before it exactly was set as False.

procedure TForm1.Button3Click(Sender: TObject);
var
  CAA: BOOL;
  OS: TUsableInOS;
  ErrorCode: DWORD;
  ErrorText: string;
  Res: Bool;
begin
  CAA := False;
{  if bgSetDisableOverlappedContent(CAA, ErrorCode, ErrorText) then
    ShowMessage('Success'); }
  Res := SystemParametersInfo(SPI_SETDISABLEOVERLAPPEDCONTENT,
                                 0,
                                 @CAA,
                                 0);

  Res := SystemParametersInfo(SPI_GETDISABLEOVERLAPPEDCONTENT,
                                 0,
                                 @CAA,
                                 0);
  if Caa then
    ShowMessage('True')
  else
    ShowMessage('False');
end;

CAA is True.

Do you have any idea?

Thanks in advance
Bojan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:43:39+00:00Added an answer on June 16, 2026 at 4:43 pm

    The main problem is that when passing SPI_SETDISABLEOVERLAPPEDCONTENT you are meant to pass a BOOL variable, but you are passing a pointer to a BOOL. The documentation says:

    The pvParam parameter is a BOOL variable. Set pvParam to TRUE to disable overlapped content, or FALSE to enable overlapped content.

    Which means that your code to set the property needs to be like this:

    SystemParametersInfo(SPI_SETDISABLEOVERLAPPEDCONTENT, 0, Pointer(CAA), 0)
    

    Your GetOSVersion is a disaster. Sorry to sound harsh! It returns 0 for Windows 8 and later. And your code has problems with operator precedence. You write:

    if not GetOSVersion >= 60 then
    

    and operator precedence means that is interpreted as

    if (not GetOSVersion) >= 60 then
    

    Since GetOSVersion returns a signed value, (not GetOSVersion) >= 60 evaluates to False irrespective of windows version. That’s because not GetOSVersion is always <= 0.

    You want logical negation rather than bitwise negation. So you should write

    if not (GetOSVersion >= 60) then
    

    or equivalently

    if GetOSVersion < 60 then
    

    In reality there is a built in function to do this. It’s called CheckWin32Version. Call it like this:

    if not CheckWin32Version(6, 0) then
      exit;
    

    The rest of your function is a bit of a mess though. You pass ErrorText by value and then assign to it. Presumably you are intending the caller to receive that value. Which won’t happen unless you passed by var.

    Personally I’d write your procedure like this:

    procedure bgSetDisableOverlappedContent(CAA: BOOL);
    begin
      if CheckWin32Version(6, 0) then
        if not SystemParametersInfo(SPI_SETDISABLEOVERLAPPEDCONTENT, 0, Pointer(CAA), 0) then
          RaiseLastOSError;
    end;
    

    I think it’s better to convert an error in SystemParametersInfo to an exception since it’s an exceptional circumstance. I defy you to actually generate a failure of that call to SystemParametersInfo. In which case there’s no point building an error code returning mechanism for something that simply will not happen. Check for errors and convert to a runtime exception. This makes the calling code so much simpler.

    Your button click handler can be much simpler:

    procedure TForm1.Button3Click(Sender: TObject);
    begin
      bgSetDisableOverlappedContent(False);
    end;
    

    And the getter function is also much more complex than necessary. I’d have it like this:

    function bgGetDisableOverlappedContent: Boolean;
    var
      CAA: BOOL;
    begin
      if not CheckWin32Version(6, 0) then
      begin
        Result := False;//or True, I don't know, you decide
        exit;
      end;
      if not SystemParametersInfo(SPI_GETDISABLEOVERLAPPEDCONTENT, 0, @CAA, 0) then
        RaiseLastOSError;
      Result := CAA;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have function <script type=text/javascript> $(function () { $(#search).click(function() { var text = $(#searchText).val();
I have function to unlock data sets via an API function unlockData() { var
I have function: function get_playlist(){ var result = jQuery.ajax({ url: '<?php echo admin_url('admin-ajax.php'); ?>',
I have function like this in my Bean: public String uploadFile(UploadedFile uploadedFile) { logger.info(Enter:
I have function like this typedef vector<vector<string> > vecArray; vecArray dul(); vecArray dul() {
I have function send mail and it looks like this private void email(String emailTo,
I have function along these lines: public void view(string msg) { messagebox.show(msg); } .
I have function like this in my header function bingframe() { var iframe =
I have function windowHash() { var hash = window.location.hash; if (window.location.hash == hash) {
I have function declaration like: def function(list_of_objects = None) and if *list_of_objects* not passed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.