Bonjour a tous,
Cela fait 6 jours que je m**dois, avec les objet COM de Metaframe. Sous D7 (puis D2005, pour le FOR ... IN) je n'arrive pas a lister les serveurs d'une batterie. Dans l'urgence j'ai fini le projet en VB6.
La question: Quelqu'un a t'il deja utilise le MFCOM sous Delphi ?
Pour info:
- j'ai cree le MetaFrameCOM_TLB.pas depuis mfcom.tlb du RSK citrix.
- La connection COM est Correct, je peux faire des query sur la batterie....
Voici un exemple de code VB qui fonctionne:
en gros c'est la bloucle FOR EACH ou je bloque en Delphi.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Dim theFarm As MetaFrameFarm Dim aServer As MetaFrameServer Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm") theFarm.Initialize MetaFrameWinFarmObject For Each aServer In theFarm.Servers List1.AddItem (aServer.ServerName) Next
code Delphi (2005)
la compilation me retourne une erreur:
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 use (...),MetaFrameCOM_TLB,(...); (...) procedure TForm1.BtListClick(Sender: TObject); var thefarm: MetaFrameFarm; theserver: MetaFrameServer; i: Integer; begin ListBox1.Clear; try thefarm := CoMetaFrameFarm.Create; thefarm.Initialize(MetaFrameWinFarmObject ); ListBox1.AddItem('Batterie: '+ thefarm.FarmName, Self ); // me retourne le nom de la batterie sans probleme. theserver := CoMetaFrameServer.Create; for theserver in thefarm.Servers do begin ListBox1.AddItem('server: '+ theserver.ServerName, Self ); end; finally thefarm := nil; end; (...)
SVP je suis un
Code : Sélectionner tout - Visualiser dans une fenêtre à part [Error] Unit1.pas(44): E2431 for-in statement cannot operate on collection type 'IMetaFrameServers' because 'IMetaFrameServers' does not contain a member for 'GetEnumerator', or it is inaccessiblesur Delphi mais
![]()
Partager