IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

API, COM et SDKs Delphi Discussion :

.NET TLB Events


Sujet :

API, COM et SDKs Delphi

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2002
    Messages : 6
    Par défaut .NET TLB Events
    Bonjour,
    J'ai un souci sur l'import dans Delphi d'un composant COM .NET. La bibliothèque est fournie par Philips pour piloter les dictaphones numériques Speechmike, sous forme de fichiers TLB.
    J'ai importé via l'EDI Delphi (Version XE5) la bibliothèque de type et généré le composant TSpeechExecDictation qui s'installe dans la palette d'outils. (J'ai essayé aussi avec Delphi 2007 qui génère le meme fichier _TLB.pas avec les memes problèmes).

    Toutes les méthodes et propriétés du composant marchent parfaitement bien. Je peux ouvrir / créer un fichier audio, régler de nombreux paramètres, etc...

    Ce qui ne fonctionne pas c'est la gestion des Événements. Aucun évènement ne se produit.
    Lorsque je crée pour essayer un projet en VB.NET avec une procédure WithEvents les événements sont correctement traités ce qui exclut a priori un probleme du Framework Philips. En particulier l'évènement OnDeviceControlEvent se déclenche normalement quand un bouton du dictaphone est utilisé ce qui est bien pratique pour réagir dans l'application.

    Dans un premier temps, j'ai parcouru le fichier PSP_SpeechExec_Dictation_TLB.pas généré, je trouve une première anomalie.
    La procédure censée gérer les évènements est mal importée.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    procedure TSpeechExecDictation.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
    begin
      case DispID of
        -1: Exit;  // DISPID_UNKNOWN
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnUIControlEvent) then
             FOnUIControlEvent(Self, Params[0] {enUIControlEvent});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnDeviceControlEvent) then
             FOnDeviceControlEvent(Self,
                                   Params[0] {enAudioControlDeviceEvent},
                                   Params[1] {enAudioControlDevice});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnErrorEvent) then
             FOnErrorEvent(Self, Params[0] {enError});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnHideEvent) then
             FOnHideEvent(Self);
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnCloseEvent) then
             FOnCloseEvent(Self);
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnFileLengthEvent) then
             FOnFileLengthEvent(Self, Params[0] {Integer});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnFilePositionEvent) then
             FOnFilePositionEvent(Self, Params[0] {Integer});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnStateEvent) then
             FOnStateEvent(Self, Params[0] {enAudioState});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnLevelEvent) then
             FOnLevelEvent(Self, Params[0] {Integer});
    *)
    (*{The DispID for this method is DISPID_UNKNOWN!?. }
        -1: if Assigned(FOnStereoLevelEvent) then
             FOnStereoLevelEvent(Self,
                                 Params[0] {Integer},
                                 Params[1] {Integer});
    *)
      end; {case DispID}
    end;
    En corrigeant cela (Thanks to Remy Lebeau), je n'arrive toujours pas à récupérer les événements.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    procedure TSpeechExecDictation.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
    begin
      case DispID of
        -1: Exit; // DISPID_UNKNOWN
        1610743808: if Assigned(FOnUIControlEvent) then FOnUIControlEvent(Self, 
    Params[0] {enUIControlEvent});
        1610743809: if Assigned(FOnDeviceControlEvent) then FOnDeviceControlEvent(Self, 
    Params[0] {enAudioControlDeviceEvent}, Params[1] {enAudioControlDevice});
        1610743810: if Assigned(FOnErrorEvent) then FOnErrorEvent(Self, Params[0] 
    {enError});
        1610743811: if Assigned(FOnHideEvent) then FOnHideEvent(Self);
        1610743812: if Assigned(FOnCloseEvent) then FOnCloseEvent(Self);
        1610743813: if Assigned(FOnFileLengthEvent) then FOnFileLengthEvent(Self, 
    Params[0] {Integer});
        1610743814: if Assigned(FOnFilePositionEvent) then FOnFilePositionEvent(Self, 
    Params[0] {Integer});
        1610743815: if Assigned(FOnStateEvent) then FOnStateEvent(Self, Params[0] 
    {enAudioState});
        1610743816: if Assigned(FOnLevelEvent) then FOnLevelEvent(Self, Params[0] 
    {Integer});
        1610743817: if Assigned(FOnStereoLevelEvent) then FOnStereoLevelEvent(Self, 
    Params[0] {Integer}, Params[1] {Integer});
      end; {case DispID}
    end;
    Je mets en PJ le PAS généré et les fichiers TLB.

    Si quelqu'un a une idée ?

    J'ai essayé également avec EventSinkImp de Laurent Dardenne sans plus de succès.

    Merci pour votre aide.
    Thomas
    Fichiers attachés Fichiers attachés

  2. #2
    Rédacteur


    Profil pro
    Inscrit en
    Janvier 2003
    Messages
    7 171
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2003
    Messages : 7 171
    Billets dans le blog
    1
    Par défaut
    Bonjour Thomas,
    vérifie les points énoncés sur ce post (avec ILSpy par exemple), on peut supposer que c'est la déclaration initiale qui est en cause et pas la transformation de la TLB.
    Sinon qq piste sur google avec 'delphi COM .NET event'.

Discussions similaires

  1. [VB.NET 2003] events : RightClick ?
    Par Kropernic dans le forum Windows Forms
    Réponses: 6
    Dernier message: 30/08/2007, 16h08
  2. [asp.net C#] Event onclick ne fonctionne pas
    Par vin100H dans le forum ASP.NET
    Réponses: 3
    Dernier message: 10/08/2007, 10h35
  3. [C#.NET] DataGridViewComboBoxColumn, events et valeur de depart ?
    Par TheParadoX dans le forum Windows Forms
    Réponses: 9
    Dernier message: 30/11/2006, 16h39
  4. [VB.NET] Events + Héritage
    Par BenoitM dans le forum Windows Forms
    Réponses: 2
    Dernier message: 16/02/2005, 09h32
  5. [VB.NET] Recuperer numero ligne dans DATAGRID apres event
    Par stephane93fr dans le forum Windows Forms
    Réponses: 4
    Dernier message: 13/01/2005, 11h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo