Autor Beitrag
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 02.02.09 14:44 
Hallo.

Hat man auf seiner Form einen TButton und ein TXPManifest platziert und erstellt nun manuell die TJvAviCapture-Komponente*, so kommt es zu einer Endlosschleife in folgender Funktion:

ausblenden 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:
function CustomWndProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
  SelfObj: TJvAVICapture;
begin
  Result := 0;

  // get the Pointer to self from the window user data
  SelfObj := TJvAVICapture(GetWindowLong(hWnd, GWL_USERDATA));
  if SelfObj <> nil then
  begin
    // send the message to the containing window,
    // except for WM_NCHITTEST during design
    // This will prevent 100% processor usage when the mouse is kept over
    // the control during design time
    // Note: We MUST convert SelfObj to a TWinControl as the Handle
    // property of TJvAVICapture returns the handle of the AVICap window
    // thus leading to an infinite loop if we were to use it...
    if (Msg <> WM_NCHITTEST) or not (csDesigning in SelfObj.ComponentState) then
        PostMessage(TWinControl(SelfObj).Handle, Msg, wParam, lParam);

    // sending the message to the original window proc
    Result := CallWindowProc(SelfObj.FPreviousWndProc, hWnd, Msg, wParam, lParam);
  end;
end;


Ich hänge mal ein Testprojekt an, vllt. findet einer die Lösung für das Problem (JEDIs nicht benötigt, Dateien liegen bei).

*Wahrscheinlich auch, wenn man die Komponente auch normal auf der Form plaziert.


Grüße
GTA-Place
Einloggen, um Attachments anzusehen!
_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)


Zuletzt bearbeitet von GTA-Place am Mo 02.02.09 16:12, insgesamt 2-mal bearbeitet
GTA-Place Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 02.02.09 15:06 
Anmerkung: Wenn ich die Komponente in OnShow erstelle, funktioniert der Start, aber: Wenn ich nun ein TPageControl mit Buttons auf den Seiten habe und die Seite wechsle, hängt das Programm wieder.


EDIT: Das Problem (wenn ich OnShow nehme) scheint nicht zu bestehen, wenn man das Programm extern aufruft, also nicht aus Delphi heraus - bei OnCreate geht es nie :gruebel:

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)