Ver Mensaje Individual
  #5  
Antiguo 13-06-2019
Avatar de movorack
[movorack] movorack is offline
Miguel A. Valero
 
Registrado: feb 2007
Ubicación: Bogotá - Colombia
Posts: 1.346
Reputación: 20
movorack Va camino a la famamovorack Va camino a la fama
Si, cambiaron los tipos de datos de los parámetros! Pues, de esta manera compila pero...

Código Delphi [-]
procedure TPrinter.GetPrinter(ADevice, ADriver, APort: PChar; var ADeviceMode: THandle);

function DeviceCapabilitiesA(pDriverName, pDeviceName, pPort: PAnsiChar;
  iIndex: Integer; pOutput: PAnsiChar; DevMode: PDeviceModeA): Integer; stdcall;

Function funcSetDuplex(Duplex: Boolean): Boolean;
var
  Device, DeviceName, Driver, Port: PWideChar;
  hDMode: THandle;
  pMode, PDMode: PDevMode;
begin
  {This procedure sets the current printer in duplex or simplex}
  Result := False; { Initialize result to False, may be unnecessary }
  printer.GetPrinter(Device, Driver, Port, hDMode);
  if hDMode <> 0 then
  begin { got handle to Device Mode }
    PDMode := GlobalLock(hDMode);
    if PDMode <> nil then
    begin { set duplex if capable }
      if DeviceCapabilitiesA(PAnsiChar(Device), PAnsiChar(DeviceName),
        PAnsiChar(Port), DC_DUPLEX, nil, nil) = 1 then
      begin
        Result := True; { Printer can do Duplex }
        { DeviceCapsA returns 1 if parameter accepts or 0 if not }
        PDMode^.dmFields := PDMode^.dmFields or dm_Duplex;
        if Duplex then
          PDMode^.dmDuplex := dmDup_VERTICAL
        else
          PDMode^.dmDuplex := dmDup_SIMPLEX;
      end
      else
        Result := False; { return false if printer can't do Duplex }
      GlobalUnlock(hDMode);
    end; { end got pDMode }
  end; { end got handle to DevMode }
end;
__________________
Buena caza y buen remar... http://mivaler.blogspot.com
Responder Con Cita