consol ile hazırlanmış formu nasıl gizlerim

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
metemete
Üye
Mesajlar: 422
Kayıt: 21 Mar 2004 12:30
Konum: samsun
İletişim:

consol ile hazırlanmış formu nasıl gizlerim

Mesaj gönderen metemete »

form.hide olmuyor
asagıdakı
programı nası gizlerim

Kod: Tümünü seç

program projem;

uses
  windows, messages;

{$R resource.res}
{$INCLUDE AppTools.inc}

const

  IDC_BTNABOUT = 101;
  IDC_EDTLOGGER = 102;
  IDC_CHKALWAYSONTOP = 103;

  FontName = 'Tahoma';
  FontSize = -18;
  FontNameEdt = 'Courier New';
  FontSizeEdt = -12;

const

  APPNAME = 'Proje';
  VER = '1.0';
  INFO_TEXT = APPNAME + ' ' + VER + #13#10 +
    'Copyright © 2008';
 IDC_STATUSBAR = 103;

var
  hApp: THandle;

  whitebrush: HBRUSH = 0;

  WhiteLB: TLogBrush =
  (
    lbStyle: BS_SOLID;
    lbColor: $00FFFFFF;
    lbHatch: 0
    );
function dlgfunc(hDlg: hWnd; uMsg: dword; wParam: wParam; lParam: lParam): bool;
  stdcall;
var
  MyFont: HFONT;
  s: string;
  TextLength: Integer;
  Buffer: PChar;
  EditText: string;
  WndTitle: array[0..255] of Char;

begin
  result := true;
  case uMsg of
    WM_INITDIALOG:
      begin
        hApp := hDlg;

        if SendMessage(hDlg, WM_SETICON, ICON_SMALL, Integer(LoadIcon(hInstance,
          MAKEINTRESOURCE(1)))) = 0 then
          SendMessage(hDlg, WM_SETICON, ICON_BIG, Integer(LoadIcon(hInstance,
            MAKEINTRESOURCE(1))));

        MyFont := CreateFont(FontSize, 0, 0, 0, 900, 0, 0, 0, ANSI_CHARSET,
          OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
          DEFAULT_PITCH, FontName);
        if MyFont <> 0 then
          SendDlgItemMessage(hDlg, 999, WM_SETFONT, Integer(MyFont),
            Integer(true));
        MyFont := CreateFont(FontSizeEdt, 0, 0, 0, 500, 0, 0, 0, ANSI_CHARSET,
          OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
          DEFAULT_PITCH, FontNameEdt);
        if MyFont <> 0 then
          SendDlgItemMessage(hDlg, IDC_EDTLOGGER, WM_SETFONT, Integer(MyFont),
            Integer(true));

        s := APPNAME + ' ' + VER;
        SetWindowText(hDlg, pointer(s));
        SetDlgItemText(hDlg, 999, pointer(s));

        CheckDlgButton(hDlg, IDC_CHKALWAYSONTOP, BST_CHECKED);
        SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
      end;
    WM_CTLCOLORSTATIC:
      begin
        case GetDlgCtrlId(lParam) of
          999: { color the banner white }
            begin
              whitebrush := CreateBrushIndirect(WhiteLB);
              SetBkColor(wParam, WhiteLB.lbColor);
              result := BOOL(whitebrush);
            end;
          IDC_EDTLOGGER:
            begin
              whitebrush := CreateBrushIndirect(WhiteLB);
              SetBkColor(wParam, WhiteLB.lbColor);
              result := BOOL(whitebrush);
            end;
        else
          Result := False;
        end;
      end;
    WM_LBUTTONDOWN:
      begin
        SetCursor(LoadCursor(0, IDC_SIZEALL));
        SendMessage(hDlg, WM_NCLBUTTONDOWN, HTCAPTION, lParam);
      end;
    WM_SIZE:
      begin
        MoveWindow(GetDlgItem(hDlg, 999), 0, 0, loword(lParam), 75, TRUE);
        s := APPNAME + ' ' + VER;
        SetDlgItemText(hDlg, 999, pointer(s));
        SetWindowPos(GetDlgItem(hDlg, 101), GetDlgItem(hDlg, 999), loword(lParam)
          - 47, 7, 40, 22, 0);
        MoveWindow(GetDlgItem(hDlg, IDC_EDTLOGGER), 0, 100, LoWord(lParam),
          HiWord(lParam) - 100, TRUE);
      end;
    WM_CLOSE:
      begin
        EndDialog(hDlg, 0);
      end;
    WM_COMMAND:
      begin
      { accel for closing the dialog with ESC }
        if wParam = ID_CANCEL then
          SendMessage(hDlg, WM_CLOSE, 0, 0);
        if hiword(wParam) = BN_CLICKED then
        begin
          case LoWord(wParam) of
            IDC_BTNABOUT: MyMessageBox(hDlg, APPNAME, INFO_TEXT, 2);
            IDC_CHKALWAYSONTOP:
              begin
                if IsDlgButtonChecked(hDlg, IDC_CHKALWAYSONTOP) = BST_CHECKED
                  then
                  SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or
                    SWP_NOMOVE)
                else
                  SetWindowPos(hDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE or
                    SWP_NOMOVE)
              end;
          end;
        end;
      end;
  else
    result := false;
  end;
end;

begin
  DialogBox(hInstance, MAKEINTRESOURCE(100), 0, @dlgfunc);
  if hLib <> 0 then     FreeLibrary(hLib);
end.




Cevapla