Auteur

Origineel door Mani, in deze thread

Omschrijving

Procedure waarmee een checkbox kan worden toegevoegd aan een Standaard windows dialoog voor het brosen naar een folder. Dit principe is vergelijkbaar met NLDMessageBox van PsychoMark.

Code

Code:
var
  F_CheckBox: TCheckBox;

function BrowseCallbackProc(hwnd: HWND; uMsg: UINT; lParam, lpData: LPARAM): Integer; stdcall;
var
  Path: array[0..MAX_PATH] of Char;
  ARect: TRect;
begin
case uMsg of
    BFFM_INITIALIZED:
      begin
        F_CheckBox.ParentWindow := hwnd;
        F_CheckBox.SetBounds(10, 272, 126, F_CheckBox.Height);
        ShowWindow(F_Checkbox.Handle, SW_SHOW);
        BringWindowToTop(F_Checkbox.Handle);

        SendMessage(hwnd, BFFM_SETSELECTION, 1, lpData);
        SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, lpData);

        GetWindowRect(hWnd,ARect);
        SetWindowPos(hWnd,
        HWND_TOP,           // placement-order handle
        ARect.Left + ((Screen.Width - ARect.right - ARect.left) div2),        // horizontal position
        ARect.Top + ((Screen.Height - ARect.Bottom - ARect.Top) div2),        // vertical position
        ARect.right - ARect.left,        // width
        ARect.Bottom - ARect.Top,        // height
        SWP_SHOWWINDOW);
      end;

      BFFM_SELCHANGED:
      begin
// Set the status window to the currently selected path.
if SHGetPathFromIDList(Pointer(lParam), Path) then
          SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, Integer(@Path));
      end;
  end;