Autor Beitrag
henny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Sa 18.07.09 15:35 
Hallo zusammen
ich habe gerade ein Programm programmiert
bei dem in einem Panel das Bild einer Webcam angezeigt wird
doch das Bild ist zu klein
Wie kann ich das Bild vergrößern?
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 18.07.09 15:36 
Zieh das Panel größer.

_________________
PROGRAMMER: A device for converting coffee into software.
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Sa 18.07.09 15:38 
Hab ich aber dann ist links oben das Bild der Wabcam und der Rest des Panels ist weiß
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 18.07.09 15:40 
Tja.. dann solltest du uns vielleicht erstmal verraten, wie du das Bild da drauf zeichnest.

Vielleicht gibts dabei Parameter für Höhe und Breite, oder eine Stretch Methode oder sowas.

_________________
PROGRAMMER: A device for converting coffee into software.
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Sa 18.07.09 15:44 
O.K.
Hier der Code:
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

  const
WM_CAP_DRIVER_CONNECT = WM_USER + 10;
  WM_CAP_EDIT_COPY = WM_USER + 30;
  WM_CAP_SET_PREVIEW = WM_USER + 50;
  WM_CAP_SET_OVERLAY = WM_USER + 51;
  WM_CAP_SET_PREVIEWRATE = WM_USER + 52;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function capCreateCaptureWindow(lpszWindowName: LPCSTR;
  dwStyle: DWORD;
  x, y,
  nWidth,
  nHeight: integer;
  hwndParent: HWND;
  nID: integer): HWND; stdcall;
  external 'AVICAP32.DLL' name 'capCreateCaptureWindowA';

procedure TForm1.FormShow(Sender: TObject);

var handle:THandle;
begin
  handle := capCreateCaptureWindow('Video',ws_child+ws_visible, 0,
  0320240, Panel1.Handle, 1); //Wie du siehst, brauchst du ein Panel in diesem Beispiel ;-)
  SendMessage(handle, WM_CAP_DRIVER_CONNECT, 00);
  SendMessage(handle, WM_CAP_SET_PREVIEWRATE, 300);
  sendMessage(handle, WM_CAP_SET_OVERLAY, 10);
  SendMessage(handle, wm_cap_set_preview, 10);


end;
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Sa 18.07.09 15:49 
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:
function capCreateCaptureWindow(lpszWindowName: LPCSTR;
  dwStyle: DWORD;
  x, y,
  nWidth,
  nHeight: integer;

  hwndParent: HWND;
  nID: integer): HWND; stdcall;
  external 'AVICAP32.DLL' name 'capCreateCaptureWindowA';

procedure TForm1.FormShow(Sender: TObject);

var handle:THandle;
begin
  handle := capCreateCaptureWindow('Video',ws_child+ws_visible, 0,
  0Panel1.Width, Panel1.Height, Panel1.Handle, 1); //Sehe ich, aber man sollte sich auch mal die Parameter anschauen, bevor man Code übernimmt ;-)
  SendMessage(handle, WM_CAP_DRIVER_CONNECT, 00);
  SendMessage(handle, WM_CAP_SET_PREVIEWRATE, 300);
  sendMessage(handle, WM_CAP_SET_OVERLAY, 10);
  SendMessage(handle, wm_cap_set_preview, 10);


end;

Vielleicht solltest du diesen Code nicht in FormShow aufrufen, weil sonst nicht akutalisiert wird, aber das ist eine andere Frage ;)
DonManfred
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148
Erhaltene Danke: 2

Windows 7
Delphi XE3 Pro + HTML5Builder
BeitragVerfasst: Sa 18.07.09 15:53 
ausblenden Delphi-Quelltext
1:
2:
  handle := capCreateCaptureWindow('Video',ws_child+ws_visible, 0,
  0320240, Panel1.Handle, 1); //Wie du siehst, brauchst du ein Panel in diesem Beispiel ;-)


Hast Du die 320 und 240 mal verändert?

_________________
Gruss Manfred
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: Sa 18.07.09 15:54 
Ja die hab ich verändert nur das ist dann total komisch
weil dann das Bild der Webcam und ein Stück vom Desktop angezeigt wird
Weiß vieleicht jemand wie ich das Problem beheben kann?
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: Sa 18.07.09 18:29 
Du möchtest das Image mit dem gesamten Panel vergrößern?
Also ich meine, dass müsste doch mit Image.align:=clClient gehen.
Oder?
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 18.07.09 18:52 
user profile iconffgorcky hat folgendes geschrieben Zum zitierten Posting springen:
Du möchtest das Image mit dem gesamten Panel vergrößern?
Also ich meine, dass müsste doch mit Image.align:=clClient gehen.
Oder?

Hä? Was für ein Image?
Lies nochmal, worum es hier geht.

_________________
PROGRAMMER: A device for converting coffee into software.
henny Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 126



BeitragVerfasst: So 19.07.09 11:23 
Gibt es eigentlich noch eine Andere Möglichkeit Bilder von einer Webcam anzeigen zu lassen?
Also z.B. einen Komponenten oder so was?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 19.07.09 11:32 
Das DSPack kann sowas sicherlich auch. Es ist aber nicht besonders einfach zu benutzen, das muss ich zugeben.