zw版【转发·台湾nvp系列Delphi例程】HALCON HWindowX 01


procedure TForm1.Button1Click(Sender: TObject);
var
  img : HImageX;
  w, h : OleVariant;
  mtype : OleVariant;
  mode : array[0..3] of Variant;
  values : OleVariant;
begin
  img := CoHImageX.Create;
  img.ReadImage(‘bk45‘);
  img.GetImagePointer1(mtype, w, h);
  HWindowX1.SetPart(0, 0, h - 1, w - 1);
  img.DispObj(HWindowX1);
  mode[0] := ‘histogram‘;
  mode[1] := Panel2.ClientHeight div 2;
  mode[2] := Panel2.ClientWidth div 2;
  mode[3] := 1;
  values := VarArrayOf(mode);
  HWindowX2.SetPart(0, 0, Panel2.ClientHeight - 1, Panel2.ClientWidth - 1);
  HWindowX2.SetPaint(values);
  HWindowX2.ClearWindow();
  img.DispObj(HWindowX2);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  op.CloseWindow(HWindowX1.HalconID);
  op.CloseWindow(HWindowX2.HalconID);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
  ShowMessage(‘Delphi ‘+ IntToStr(Sizeof(Pointer)*8));
  op := CoHOperatorSetX.Create;
  op.SetCheck(‘~father‘);
  HWindowX1 := CoHWindowX.Create();
  HWindowX2 := CoHWindowX.Create();
  HWindowX1.OpenWindow(0,0,Panel1.ClientWidth,Panel1.ClientHeight,Int64(Panel1.Handle),‘visible‘,‘‘);
  HWindowX2.OpenWindow(0,0,Panel2.ClientWidth,Panel2.ClientHeight,Int64(Panel2.Handle),‘visible‘,‘‘);
end;
zw版【转发·台湾nvp系列Delphi例程】HALCON HWindowX 01
原文:http://www.cnblogs.com/ziwang/p/4851411.html