Club Builder - Foros de discusión Club Builder
Foro de C++Builder en español
 
 FAQFAQ   BuscarBuscar   MiembrosMiembros   Grupos de UsuariosGrupos de Usuarios   RegistrarseRegistrarse 
 PerfilPerfil   Entra para ver tus mensajes privadosEntra para ver tus mensajes privados   EntrarEntrar 

Ayuda en Conversion de Tipos (ocx) (leo?)

 
Publicar nuevo tema   Responder al tema    Foros de discusión -> Consultas
Ver tema anterior :: Ver tema siguiente  
Autor Mensaje
Mensaje    Asunto: Ayuda en Conversion de Tipos (ocx) (leo?) Responder citando

Importe una libreria que contiene las funciones de la siguiente forma:

Código:

Int EnrollUser(char *Template, char *ImagePath, char *GuideMessage, HWND
Owner, int x1, int y1, int x2, int y2, int Core)


Se ve facil no?

Hice esto,despues de importar el ocx y agregar las dlls de microsfot

Código:

wchar_t *sTemplate;
wchar_t *sSalida;
wchar_t *sDirImagen=NULL;
int i=0;
AnsiString s;
//l_ret = EnrollUser(l_ptr,l_ptr1,l_ptr2,this.Handle.ToInt32(),1,1,200,200,1);

i=LectorHuella->EnrollUser(*sTemplate,"",*sSalida, this->Handle, 404, 112, 604, 312, 1);


Y me marca Borland 5 los sig:

[C++ Error] FirmaDigital.cpp(545): E2034 Cannot convert 'char *' to 'wchar_t * *'
[C++ Error] FirmaDigital.cpp(545): E2342 Type mismatch in parameter 'Template' (wanted 'wchar_t * *', got 'char *')
[C++ Error] FirmaDigital.cpp(545): E2034 Cannot convert 'char *' to 'wchar_t *'
[C++ Error] FirmaDigital.cpp(545): E2342 Type mismatch in parameter 'ImagePath' (wanted 'wchar_t *', got 'char *')
[C++ Error] FirmaDigital.cpp(545): E2034 Cannot convert 'int' to 'wchar_t * *'
[C++ Error] FirmaDigital.cpp(545): E2342 Type mismatch in parameter 'GuideMessage' (wanted 'wchar_t * *', got 'wchar_t')
[C++ Error] FirmaDigital.cpp(545): E2034 Cannot convert 'void *' to 'long'
[C++ Error] FirmaDigital.cpp(545): E2342 Type mismatch in parameter 'hOwner' (wanted 'long', got 'void *')

Help
_________________
Ing. Gabriel Góngora Navarrete
TouchSoftwares Inc

http://www.touchsoftwares.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
Mensaje    Asunto: Responder citando

Poco puedo ayudarte porque no conozco la librería ni tengo idea de lo que hace la función, así que no puedo comprobar nada.

Pero lo que no entiendo es si la función mas arriba espera char* la razón por la que le pasas wchar_t*.
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Es un OCX que al importarlo, convierte los tipos a BSTR

ya medio funciona asi, solo estioy trabado en comopasar una cadena en el parametro LImagePath (donde va el directoriodonde se guardara la imagen)
Código:

BSTR *LTemplate;
BSTR LImagePath;
BSTR *LGuideMessage;
StrCopyBStr
//LImagePath.Copy("NULL");
//Int EnrollUser(char *Template, char *ImagePath, char *GuideMessage, HWND
//Owner, int x1, int y1, int x2, int y2, int Core)
if(huella->ISReaderAttached()!=0)
  if(huella->ISFingerOn()!=0)
     {huella->EnrollUser(LTemplate,LImagePath,LGuideMessage,(long)Form1->Handle,10,10,150,250,1);
      //ShowMessage((AnsiString)LTemplate);
     }

_________________
Ing. Gabriel Góngora Navarrete
TouchSoftwares Inc

http://www.touchsoftwares.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
Mensaje    Asunto: Responder citando

Ya quedo asi, solo indica una violacion , pero me muestra la imagen

Código:

BSTR *bstrTemplate;
BSTR bstrImagePath;
BSTR *bstrGuideMessage;

 bstrImagePath = SysAllocString(L"C:\\");

if(huella->ISReaderAttached()!=0)
  if(huella->ISFingerOn()!=0)
     {huella->EnrollUser(bstrTemplate,bstrImagePath,bstrGuideMessage,(long)Form1->Handle,10,10,150,250,1);
     
     }

_________________
Ing. Gabriel Góngora Navarrete
TouchSoftwares Inc

http://www.touchsoftwares.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
Mensaje    Asunto: Responder citando

Ayudaría mas ver como queda la declaración de la función al importarla en el ocx...

Prueba con "WideString" o échale un vistazo en la ayuda a la función "StringToOleStr". Por ejemplo:

    WideString bstrTemplate = "algo";
    WideString bstrImagePath= "algo";
    WideString bstrGuideMessage = "algo";

    ...->EnrollUser(bstrTemplate, bstrImagePath, bstrGuideMessage, ...

Viendo los mensajes de error es posible que tengas que pasar los parámetros así:

    ...->EnrollUser(&bstrTemplate, bstrImagePath, &bstrGuideMessage, ...


o bien con StringToOleStr:

    BSTR bstrTemplate = StringToOleStr("prueba");
    BSTR bstrImagePath = StringToOleStr("prueba");
    BSTR bstrGuideMessage = StringToOleStr("prueba");

    ...->EnrollUser(&bstrTemplate, bstrImagePath, &bstrGuideMessage, ...

y luego tienes que liberar la memoria con SysFreeString:

    SysFreeString(bstrTemplate);
    SysFreeString(bstrImagePath);
    SysFreeString(bstrGuideMessage);
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

EL archivo de cabecera resultante de la importacion

Código:

// ************************************************************************ //
// WARNING                                                                   
// -------                                                                   
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via       
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all       
// manual modifications will be lost.                                         
// ************************************************************************ //

// C++ TLBWRTR : $Revision:   1.134.1.39  $
// File generated on 01/09/2005 21:21:59 from Type Library described below.

// ************************************************************************ //
// Type Lib: C:\Archivos de programa\UF100_SDK\UF100X.ocx (1)
// IID\LCID: {145E573D-C1A5-4A8C-8D59-B58E2F50F8DF}\0
// Helpfile: C:\Archivos de programa\UF100_SDK\UF100X.hlp
// DepndLst:
//   (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
//   (2) v4.0 StdVCL, (C:\WINDOWS\system32\STDVCL40.DLL)
// ************************************************************************ //
#ifndef   __UF100XLib_OCX_h__
#define   __UF100XLib_OCX_h__

#pragma option push -b -w-inl

#include <utilcls.h>
#if !defined(__UTILCLS_H_VERSION) || (__UTILCLS_H_VERSION < 0x0500)
//
// The code generated by the TLIBIMP utility or the Import|TypeLibrary
// and Import|ActiveX feature of C++Builder rely on specific versions of
// the header file UTILCLS.H found in the INCLUDE\VCL directory. If an
// older version of the file is detected, you probably need an update/patch.
//
#error "This file requires a newer version of the header UTILCLS.H" \
       "You need to apply an update/patch to your copy of C++Builder"
#endif
#include <olectl.h>
#include <ocidl.h>
#if !defined(_NO_VCL)
#include <stdvcl.hpp>
#endif  //   _NO_VCL
#include <ocxproxy.h>

#include "UF100XLib_TLB.h"
namespace Uf100xlib_tlb
{

// *********************************************************************//
// HelpString: UF100X ActiveX Control module
// Version:    1.0
// *********************************************************************//


// *********************************************************************//
// COM Component Proxy Class Declaration
// Component Name   : TUF100X
// Help String      : UF100X Control
// Default Interface: _DUF100X
// Def. Intf. Object: _DUF100XDisp
// Def. Intf. DISP? : Yes
// Event   Interface: _DUF100XEvents
// TypeFlags        : (38) CanCreate Licensed Control
// *********************************************************************//

// *********************************************************************//
// Definition of closures to allow VCL handlers to catch OCX events.     
// *********************************************************************//
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
// Proxy class to host UF100X Control in CBuilder IDE/Applications.
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
class PACKAGE TUF100X : public TOleControl
{
  OVERLOADED_PROP_METHODS;
  static TNoParam  OptParam;
  static GUID      DEF_CTL_INTF;

  // Instance of Closures to expose OCX Events as VCL ones
  //

  // Default Interace of OCX
  //
  _DUF100XDisp m_OCXIntf;

  // VCL Property Getters/Setters which delegate to OCX
  //

  // Static variables used by all instances of OCX proxy
  //
  static WCHAR        wLicenseKey[38];
  static TControlData CControlData;
  static GUID         CTL_DEF_INTF;

  // Method providing access to interface as __property
  //
  _DUF100XDisp __fastcall GetDefaultInterface();
  _DUF100XDisp __fastcall GetControlInterface()
  { return GetDefaultInterface(); }

protected:
  void     __fastcall CreateControl  ();
  void     __fastcall InitControlData();

public:
  virtual  __fastcall TUF100X(TComponent* AOwner) : TOleControl(AOwner)
  {};
  virtual  __fastcall TUF100X(HWND        Parent) : TOleControl(Parent)
  {};

  // OCX methods
  //
  long            __fastcall EnrollUser(BSTR* Template, BSTR ImagePath, BSTR* GuideMessage,
                                        long hOwner, long x1, long y1, long x2, long y2, long core);
  long            __fastcall VerifyUser(BSTR Template, long SecLevel, long hOwner, long x1, long y1,
                                        long x2, long y2, long core);
  long            __fastcall VerifyTemplates(BSTR Templates, long NumTemplates, long SecLevel,
                                             long hOwner, long x1, long y1, long x2, long y2,
                                             long core);
  long            __fastcall CaptureFP(long hOwner, long x1, long y1, long x2, long y2, long core);
  long            __fastcall ISReaderAttached(void);
  long            __fastcall ISFingerOn(void);
  long            __fastcall EnrollUserDB(BSTR ID, long hOwner, BSTR Caption);
  long            __fastcall SetupDialogDB(long hOwner, BSTR Caption);
  long            __fastcall VerifyUserDB(BSTR ID, long ShowWindow);
  long            __fastcall UpdateFingerprintDB(BSTR ID, BSTR Template, long Index, BSTR FileName);
  long            __fastcall ReadFingerprintDB(long Index, BSTR ID, BSTR Template);
  long            __fastcall WriteFingerprintDB(BSTR ID, BSTR Template, BSTR FileName);
  long            __fastcall DeleteFingerprint(long Index, BSTR ID);
  long            __fastcall VerifyID(BSTR ID);
  long            __fastcall WriteTemplateBMPDB(BSTR Path, BSTR ID, long Index);
  long            __fastcall FingerprintsCount(void);
  void            __fastcall AboutBox(void);

  // OCX properties
  //
  __property _DUF100XDisp ControlInterface={ read=GetDefaultInterface };

  // Published properties
  //
__published:

  // Standard/Extended properties
  //

  // OCX properties
  //

  // OCX Events
  //
};
typedef TUF100X  TUF100XProxy;

};     // namespace Uf100xlib_tlb

#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using  namespace Uf100xlib_tlb;
#endif

#pragma option pop

#endif // __UF100XLib_OCX_h__

_________________
Ing. Gabriel Góngora Navarrete
TouchSoftwares Inc

http://www.touchsoftwares.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
Mensaje    Asunto: Responder citando

Has probado lo que he puesto mas arriba ? que error te da al probarlo ?
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Como siempre , me has ayudado muchisimo Very Happy

Ni siquiera el proveedor del lector me habia respondido. Te lo agradezco otra vez, cuando vengas ala Riviera Maya estas invitado a mi casaa comer, avisa cuando atravieses el Atlantico!!!

Saludos
_________________
Ing. Gabriel Góngora Navarrete
TouchSoftwares Inc

http://www.touchsoftwares.com
Volver arriba
Ver perfil de usuario Enviar mensaje privado Visitar sitio web del autor MSN Messenger
Mostrar mensajes de anteriores:   
Cambiar a:  
No puedes publicar temas nuevos en este foro
No puedes responder a temas en este foro
No puedes editar tus mensajes en este foro
No puedes borrar tus mensajes en este foro
No puedes votar en las encuestas de este foro


Hosting WordPress Indedmedia desde 3,99 €
© 2002–2026 Club Builder · Funciona con phpBB.