Autor Beitrag
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Fr 20.04.07 12:12 
Hi,

ich habe eben nach ewig langer suche rausgefunden warum bei mir eine sache mit der QuickTime API nicht funktioniert...
Die QTAPI erstellt ein Modalen dialog zur auswahl des gewünschten Codecs.. diesen konnte man bei meinen Programmen nie anklicken, da er selber auch modal war..

Ich habe jetzt eben alles mit Spy++ untersucht und rausgefunden das die VCL, sobald ich z.B. die Unit "Dialogs" einbinde beim Programmstart ein 0x0 pixel großes Window erstellt.

Hier an meinem kleinen test Programm könnt ihr es sehr gut sehen:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
program NonVCL;

uses Windows, Messages {, Dialogs};

const
  ClassName = 'WndClass';
  AppName = 'NonVCL Test';
  WindowWidth = 500;
  WindowHeight = 350;
  IDC_CLOSE = 1;
  IDC_CAPTION = 1;

var
  hClose: DWORD;
  MyFont: HFONT;

function WndProc(hWnd: HWND; uMsg: UINT; wParam: wParam; lParam: LParam): lresult; stdcall;
var
  x, y : integer;
begin
  Result:=0;
  case uMsg of
    WM_CREATE: begin
      x:=GetSystemMetrics(SM_CXSCREEN);
      y:=GetSystemMetrics(SM_CYSCREEN);
      MoveWindow(hWnd,(x div 2)-(WindowWidth div 2),(y div 2)-(WindowHeight div 2),WindowWidth,WindowHeight,true);
      hClose:=CreateWindowEx(WS_EX_CLIENTEDGE, 'BUTTON', '&Schließen',WS_VISIBLE or WS_CHILD, WindowWidth-115, WindowHeight-60, 100, 25,hWnd, IDC_CLOSE, hInstance, nil);
      MyFont := GetStockObject(DEFAULT_GUI_FONT);
      if MyFont <> 0 then
        SendMessage(hClose, WM_SETFONT, Integer(MyFont), Integer(true));
    end;
    WM_DESTROY: begin
      DeleteObject(MyFont);
      PostQuitMessage(0);
    end;
    WM_SIZE:
      MoveWindow(hClose, LoWord(lParam)-115, HiWord(lParam)-40, 100, 25, true);
    WM_COMMAND: begin
     if hiword(wParam)=BN_CLICKED then
        case loword(wParam) of
          IDC_CLOSE:
            SendMessage(hWnd,WM_DESTROY,0,0);
        end;
    end;
    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;
  );
  msg: TMsg;

begin
  wc.hInstance  := hInstance;
  wc.hIcon      := LoadIcon(0,IDI_APPLICATION);
  wc.hCursor    := LoadCursor(0,IDC_ARROW);
  RegisterClassEx(wc);
  CreateWindowEx(0,ClassName,AppName,WS_CAPTION or WS_VISIBLE or WS_SYSMENU or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_SIZEBOX,Integer(CW_USEDEFAULT),Integer(CW_USEDEFAULT),WindowWidth,WindowHeight,0,0,hInstance,nil);
  while true do begin
    if not GetMessage(msg,0,0,0) then
      break
    else begin
      TranslateMessage(msg);
      DispatchMessage(msg);
    end;
  end;
end.


Wenn man nun da die Dialogs-Uses mit einbindet, wird ein 0x0 großes fenster erstellt.

Seht ihr, wenn ihr Spy++ habt:
Startet das Programm und dann in Spy++ CTRL+W (Öffnet die Window-Übersicht).
Dann mit STRG+F das Fenster auswählen und Ok klicken.
Dann bei den Karteikarten auf "Window" und dort seht ihr dann bei "Next Window" ein Fenster mit der Caption "Nonvcl". Wenn ihr das anklickt und auf "General" klickt seht ihr dort, dass das Fenster 0x0 groß ist.

Und das verursacht bei der QuickTime API riesen probleme...

Hat jemand eine idee was ich dagegen tun kann?
Klar, "Dialogs" überall rauswerfen, allerdings wird das ja z.B. bei "SysUtils" auch benutzt = ich dürfte auch kein SysUtils verwenden etc... bliebe nurnoch NonVCL zu coden, aber das geht bei meinem projekt im moment nichtmehr...

Hoffe irgendwer hat einen rat..

Aya~

PS: Benutze Delphi6 Pro

_________________
Aya
I aim for my endless dreams and I know they will come true!
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Fr 20.04.07 12:38 
Hi,

ich hab jetzt das 0x0 große Fenster einfach größer gemacht via:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var
  H: THandle;
begin
  H:=FindWindow(nil, PChar('Project1'));
  SetWindowPos(H, 0, 100, 100, 200, 200, 0);


Wozu ist das Fenster da?!
Wenn ich es via klick auf X schließe wird das Programm beendet....

_________________
Aya
I aim for my endless dreams and I know they will come true!
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Fr 20.04.07 13:36 
Hi,

hab es hinbekommen.. hab jetzt in der Forms.pas einfach die Zeile auskommentiert in der das 0x0er Fenster erstellt wird.
Anscheinend ist das Fenster nur dazu da, das auf dem Task-Button eine andere Caption stehen kann als im MainForm... wozu auch immer...

Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!