Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 24-08-2006
harpo harpo is offline
Miembro
 
Registrado: jul 2006
Posts: 35
Poder: 0
harpo Va por buen camino
Muchas gracias, funciona perfectamente

Ahora el código me queda así:
Código:
procedure CreateDevice (StillImage:IStillImage);
var
  hr: HRESULT;
  dwItemsReturned:Pointer;
  pBuffer:PSTI_DEVICE_INFORMATION_ARRAY;
  DeviceInformation:STI_DEVICE_INFORMATION;
  dwType:LongWord;
  dwFlags:LongWord;
  pDevice:IStiDevice;    //IStiDevice
  DeviceName:PWideChar;
  DeviceInternalName:string;
  i:integer;
begin
  CoInitialize(nil);
  hr := CoCreateInstance(CLSID_Sti, nil, CLSCTX_INPROC_SERVER, IID_IStillImage,stillImage);
  if Succeeded(hr) and Assigned(stillImage) then
  begin
    StillImage.Initialize(STI_VERSION,STI_DEVICE_CREATE_BOTH);
    hr:=StillImage.GetDeviceList(dwType,dwFlags,dwItemsReturned,pBuffer);
    for i:=0 to 1 do
    begin
         if pBuffer^[i].DeviceType = 131072 then
            DeviceInformation:=pBuffer^[i];
    end;
    for i:=0 to STI_MAX_INTERNAL_NAME_LENGTH do
    begin
        if DeviceInformation.szDeviceInternalName[i] <> '' then
             DeviceInternalName:=DeviceInternalName+STI_DEVICE_INFORMATION(pBuffer^).szDeviceInternalName[i];
    end;
   DeviceName:=StringToWideChar(DeviceInternalName,DeviceName,Length(DeviceInternalName));
   hr:=StillImage.CreateDevice(DeviceName,STI_DEVICE_CREATE_DATA,pDevice,nil);
   StillImage:=nil;
  end;
  CoUninitialize;

end;
El problema está en la función CreateDevice, creo q probablemente en el nombre que le estoy pasando. La cabecera en el sti.pas viene así:

Código:
 function CreateDevice(pwszDeviceName: PWideChar; dwMode: DWORD; out pDevice: IStiDevice; punkOuter: IUnknown): HRESULT; stdcall;
Y en la referencia de msdn viene lo siguiente:

Cita:
IStillImage::CreateDevice

The IStillImage::CreateDevice method creates an instance of the COM object that defines the IStiDevice COM Interface, and returns a pointer to the interface.
HRESULT
CreateDevice(
LPWSTRpwszDeviceName,
DWORDdwMode,
PSTIDEVICE*pDevice,
LPUNKNOWNpunkOuter
);

Parameters

pwszDeviceNameCaller-supplied pointer to a string representing an internal device name, obtained by calling IStillImage::GetSTILaunchInformation or IStillImage::GetDeviceList.

dwMode
Caller-supplied constant value indicating the Transfer Modes in which the device is to be used. The following values are valid. Mode Description
STI_DEVICE_CREATE_BOTH The device is being opened for both obtaining status and transferring data.
STI_DEVICE_CREATE_DATA The device is being opened only for data transfers.
STI_DEVICE_CREATE_STATUS The device is being opened only for obtaining status information.

pDeviceReceives a pointer to the IStiDevice COM Interface.

punkOuterOptional, caller-supplied pointer to the "controlling unknown" for object aggregation. See the following Comments section. Return Value

If the operation succeeds, the method returns S_OK. Otherwise, it returns one of the STIERR-prefixed error codes defined in stierr.h.
Headers

Declared in sti.h. Include sti.h.
Comments

For an application to use the IStiDevice interface, it must first call IStillImage::StiCreateInstance to get a pointer to the IStillImage interface, then call IStillImage::CreateDevice to get a pointer to the IStiDevice interface. The pointer received in pDevice is used subsequently when calling IStiDevice methods, as illustrated in the sample still image code, to obtain access to the specified device.
If you want to create an aggregate COM object that includes IStiDevice, you must supply a pointer to the "controlling unknown" in punkOuter. In most cases you will not be creating an aggregate object, so punkOuter should be NULL. Object aggregation and the controlling unknown are described in the Platform SDK documentation and in the Component Object Model Specification.
See Also

IStiDevice::Release

Al hacer la llamada a esta función , pDevice apunta a nil

A ver si alguien me ilumina. Muchas gracias
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Componete DICOM para imagenes. JuanErasmo C++ Builder 4 08-05-2007 17:40:35
imágenes de fondo para una aplicación rls Varios 3 16-11-2005 22:56:24
Problemas con Streams e Imágenes Elfoscuro Gráficos 2 09-05-2005 19:42:26
problemas con mail e imagenes hugokizo PHP 2 11-10-2004 10:02:14
Manual para programar utilizando las DirectX Jan_polero OOP 0 23-05-2004 22:34:23


La franja horaria es GMT +2. Ahora son las 00:28:07.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi