PromptDataSource gives a Range Error

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33576
    HeDiBo
    Participant

    The ADODB dialog PromptDataSource ends in a Range Error when called with SkinManager active.

    Here is the test project to show the bug: [attachment=3782:PromptDataSource.rar]

    This makes me a bit Range checking and Overflow checking ON to catch these bugs before you release the package.

    #41776
    HeDiBo
    Participant

    This bug stems from a bug in CommCtrl.pas. It contains this function:

    CODE
    function ListView_GetTextColor(hwnd: HWND): TColorRef;
    begin
      Result := SendMessage(hwnd, LVM_GETTEXTCOLOR, 0, 0);
    end;

    Because the Result must be a TColorRef (a DWORD), and SendMessage returns a LongInt, a Range Check error may occur. The function should be:

    CODE
    function ListView_GetTextColor(hwnd: HWND): TColorRef;
    begin
      Result := TColorRef(SendMessage(hwnd, LVM_GETTEXTCOLOR, 0, 0));
    end;

    There are a few more cases of this bug:
    ListView_GetBkColor
    ListView_GetTextBkColor
    and
    DateTime_GetMonthCalColor

    So, in the case of the procedure TacListViewWnd.SaveStdParams in module acSBUtils, the cure would be to do the SendMessage, i.s.o. calling the bugged functions ListView_GetBkColor and ListView_GetTextColor from CommCtrl.

    #38430
    Support
    Keymaster

    QUOTE (HeDiBo @ Feb 23 2010, 06:16 PM) <{POST_SNAPBACK}>
    This makes me a bit Range checking and Overflow checking ON to catch these bugs before you release the package.[/size]


    Hello Dick
    I have enabled these checks by default in IDE options (and “typed @ operator” also) and I'm always working with them.
    Thank you for info, I'll check it.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.