Delphi-PRAXiS
Seite 1 von 3  1 23      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi [nonVCL] Problem mit Fenster (https://www.delphipraxis.net/82822-%5Bnonvcl%5D-problem-mit-fenster.html)

xZise 20. Dez 2006 09:03


[nonVCL] Problem mit Fenster
 
Ich habe ein Problem, bzw. ein Tester, mit dem Fenster der FileLink-GUI.

Also es erscheinen keine Komponenten...

Vielleicht wisst ihr, woran es liegt?

Ich kann hier (Schule) keinen Code anbieten, aber eigentlich könnt ihr folgenden benutzen:
Delphi-Quellcode:
program FileLink;

uses
  Windows, Messages, CommCtrl;

const
  btnInstall = 5;
  lblStatus = 3;
  lblStatusLabel = 4;

var
  hwndButton, hwndStatusLabel, hwndStatus : DWORD;

{$R FileLink.res}

function WndProc(hWnd: HWND; msg: UINT; wParam: wParam; lParam: LParam) : lresult; stdcall;
var
  font: HFONT;
begin
  result := 0;

  case msg of
    WM_CREATE : begin      

      hwndButton := CreateWindowEx(0, 'BUTTON', 'Installieren',
          WS_VISIBLE or WS_CHILD, 8, 46, 99, 25, hWnd, btnInstall, hInstance,
          nil);
      hwndStatusLabel := CreateWindowEx(0, 'STATIC', 'Status', SS_CENTER or WS_VISIBLE or WS_CHILD, 8, 8, 99, 13, hWnd, lblStatusLabel, HInstance, nil);
      hwndStatus := CreateWindowEx(0, 'STATIC', 'Nicht installiert', SS_CENTER or WS_VISIBLE or WS_CHILD, 8, 27, 99, 13, hWnd, lblStatus, HInstance, nil);

      font := CreateFont(-12, 0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,         DEFAULT_PITCH, 'MS Sans Serif');
      if font <> 0 then begin
        SendMessage(hwndStatus, WM_SETFONT, Integer(font), Integer(true));
        SendMessage(hwndStatusLabel, WM_SETFONT, Integer(font), Integer(true));
        SendMessage(hwndButton, WM_SETFONT, Integer(font), Integer(true));
      end;
    end;

    WM_CTLCOLORSTATIC:
      begin
        case GetDlgCtrlId(lParam) of
          lblStatus: begin
            SetTextColor(wParam, RGB(0,200,0))
            SetBkColor(wParam, GetSysColor(COLOR_3DFACE));
          end;
          else Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
        end;
      end;
    WM_DESTROY : PostQuitMessage(0);
    else result := DefWindowProc(hWnd, uMsg, wParam, lParam);
  end;
end;

var
  wc: TWndClassEx = (
    cbSize         : SizeOf(TWndClassEx);
    Style          : CS_HREDRAW or CS_VREDRAW;
    lpfnWndProc    : @WndProc;
    cbClsExtra     : 0;
    cbWndExtra     : 0;
    hbrBackground  : COLOR_APPWORKSPACE;
    lpszMenuName   : nil;
    lpszClassName  : ClassName;
    hIconSm        : 0;
  );
  icc : TInitCommonControlsEx = (
    dwSize : sizeof(TInitCommonControlsEx);
    dwICC : ICC_INTERNET_CLASSES;
  );
  msg: TMsg;

begin
    wc.hInstance := hInstance;
    wc.hIcon := LoadIcon(hInstance, MAKEINTRESOURCE(2));
    wc.hCursor := LoadCursor(0, IDC_ARROW);
    wc.hbrBackground := GetSysColorBrush(COLOR_3DFACE);

    InitCommonControlsEx(icc);

    RegisterClassEx(wc);

    CreateWindowEx(WS_EX_TOOLWINDOW or WS_EX_APPWINDOW, 'WndClass', 'FileLink', WS_CAPTION or WS_VISIBLE or WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, 119, 103, 0, 0, hInstance, nil);

    while GetMessage(msg,0,0,0) do begin
      TranslateMessage(msg);
      DispatchMessage(msg);
    end;

    ExitCode := msg.wParam;
end.

Luckie 20. Dez 2006 09:08

Re: [nonVCL] Problem mit Fenster
 
Verrätst du uns auch noch, was das Problem ist?

MathiasSimmack 20. Dez 2006 10:00

Re: [nonVCL] Problem mit Fenster
 
Steht als Kommentar im Quelltext. :lol:

Luckie 20. Dez 2006 10:06

Re: [nonVCL] Problem mit Fenster
 
Meine Güte, wer sucht denn in den Kommentaren nach der Problembeschreibung. :roll:

MathiasSimmack 20. Dez 2006 10:07

Re: [nonVCL] Problem mit Fenster
 
Ich hab´s auch nur durch Zufall gesehen. ;)

Luckie 20. Dez 2006 10:23

Re: [nonVCL] Problem mit Fenster
 
Zum einen kompiliert der Code gar nicht mal und zum anderen wird da bei mir gar nichts weiß.

Luckie 20. Dez 2006 11:11

Re: [nonVCL] Problem mit Fenster
 
So geht es:
Delphi-Quellcode:
    WM_CTLCOLORSTATIC:
    begin
      case GetDlgCtrlID(lParam) of
        IDC_STC_BANNER:
        begin
          SetTextColor(wParam, RGB(0,255,0));
          result := GetStockObject(WHITE_BRUSH);
        end;
      else
        Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
      end;
    end;

xZise 20. Dez 2006 15:24

Re: [nonVCL] Problem mit Fenster
 
Ne, ne ;) Das Problem ist behoebn ^^
Ich hatte woanders den Quelltext her, weil es der gleiche ist.

Es geht darum, dass er nicht die Buttons (und ich glaube auch Statics) erstellt.

Luckie 20. Dez 2006 19:05

Re: [nonVCL] Problem mit Fenster
 
Zitat:

Zitat von xZise
Es geht darum, dass er nicht die Buttons (und ich glaube auch Statics) erstellt.

Siehst du Mathias, so viel zur Fehlerbeschreibung als Kommntar im Sourcecode. :roll:

DGL-luke 20. Dez 2006 19:22

Re: [nonVCL] Problem mit Fenster
 
also ich weeß ja nit, meine augen sind auch nicht die besten, aber ich seh da beim besten willen nirgends einen kommentar im quelltext?! :shock:


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:04 Uhr.
Seite 1 von 3  1 23      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz