Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Instructions .ODL pour creer un .TLB (demande d'exemple our un type simple)

3 réponses
Avatar
xx
Bonjour

J'essaye de m'instruire et je souhaiteras creer un .TLB exemple pour declarer un type qui s'ecrirait en VB:

Public Type myUDT
a As String
b As String
c As Long
d As Integer
End Type

Si quelq'un pouvait me tenir la main et me fournir les instructions .ODL et autres directives pour creer le .TLB correspondant.

Merci
Je viens de telecharger MkTypLib.Exe, GuidGen.exe, Midl.Exe (PlatformSDK),
qui semblent etre les outils indispensables?

3 réponses

Avatar
Fabrice MALAINGRE
Bonjour "xx",

Ton fichier "IMyInterface.idl" ressemblera à quelque chose du genre :
========================================= import "oaidl.idl";
import "ocidl.idl";

[
object,
uuid(9C6C9360-11DA-11d4-BA7A-00105AD7BBC8),
dual,
helpstring("IMyInterface Interface"),
pointer_default(unique)
]

interface IMyInterface : IDispatch
{
typedef struct {
[helpstring("My first string")]
BSTR a;
[helpstring("My second string")]
BSTR b;
[helpstring("My long")]
long c;
[helpstring("My short")]
short d;
} myUDT;

[id(0x60030001), helpstring("My Method using the struct")]
HRESULT MyFirstMethod([in, out] myUDT* lpMyStruct,
[in, out] VARIANT_BOOL* bMyBool);
};

[
uuid(9C6C9365-11DA-11d4-BA7A-00105AD7BBC8),
version(1.0),
helpstring("IMyInterface Type Library")
]
library IMyInterfaceLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IMyInterface;
};
=========================================
Pour compiler cet IDL, il suffit alors d'utiliser la commande suivante :
"midl.exe /ms_ext /char unsigned /c_ext IMyInterface.idl"

En espérant t'avoir aidé

Cordialement

____________________________
Fabrice MALAINGRE
Architecte Logiciel - Chef de Projet
THEORIS - www.theoris.fr
Avatar
xx
"Fabrice MALAINGRE" a écrit dans le message de news:
Bonjour "xx",

Ton fichier "IMyInterface.idl" ressemblera à quelque chose du genre :
========================================= > import "oaidl.idl";
import "ocidl.idl";

[
object,
uuid(9C6C9360-11DA-11d4-BA7A-00105AD7BBC8),
dual,
helpstring("IMyInterface Interface"),
pointer_default(unique)
]

interface IMyInterface : IDispatch
{
typedef struct {
[helpstring("My first string")]
BSTR a;
[helpstring("My second string")]
BSTR b;
[helpstring("My long")]
long c;
[helpstring("My short")]
short d;
} myUDT;

[id(0x60030001), helpstring("My Method using the struct")]
HRESULT MyFirstMethod([in, out] myUDT* lpMyStruct,
[in, out] VARIANT_BOOL* bMyBool);
};

[
uuid(9C6C9365-11DA-11d4-BA7A-00105AD7BBC8),
version(1.0),
helpstring("IMyInterface Type Library")
]
library IMyInterfaceLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IMyInterface;
};
========================================= >
Pour compiler cet IDL, il suffit alors d'utiliser la commande suivante :
"midl.exe /ms_ext /char unsigned /c_ext IMyInterface.idl"

En espérant t'avoir aidé

Cordialement

____________________________
Fabrice MALAINGRE
Architecte Logiciel - Chef de Projet
THEORIS - www.theoris.fr



Je crois etre sur la bonne piste.
2 questions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
J'ai une erreur:
MsXml.Idl(52) : fatal error C1034: xmldom.idl: no include path set
midl : command line error MIDL1003 : error returned by the C preprocessor (2)

Aucun fichier xmldom.idl sur mon disque. Je suppose que je dois telecharger davantage de SDK que ce que j'ai? Lesquels?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Mes SDK se sont installes sur C:Program FilesMicrosoft SDK
Pour compiler comme indique pour PtrStrArray
http://support.microsoft.com/default.aspx?scid=kb;EN-US;199824
J'ai ajoute a mon PATH
C:Program FilesMicrosoft SDKBinWin64;C:Program FilesMicrosoft SDKBin
je me place dans C:Program FilesMicrosoft SDKinclude; et j'ai compile mon .ODL qui se trove sur V:xxx
Y a-t'il une organisation plus simple?


Merci beaucoup.
Avatar
xx
"xx" a écrit dans le message de news:
"Fabrice MALAINGRE" a écrit dans le message de news:
> Bonjour "xx",
>
> Ton fichier "IMyInterface.idl" ressemblera à quelque chose du genre :
> ========================================= > > import "oaidl.idl";
> import "ocidl.idl";
>
> [
> object,
> uuid(9C6C9360-11DA-11d4-BA7A-00105AD7BBC8),
> dual,
> helpstring("IMyInterface Interface"),
> pointer_default(unique)
> ]
>
> interface IMyInterface : IDispatch
> {
> typedef struct {
> [helpstring("My first string")]
> BSTR a;
> [helpstring("My second string")]
> BSTR b;
> [helpstring("My long")]
> long c;
> [helpstring("My short")]
> short d;
> } myUDT;
>
> [id(0x60030001), helpstring("My Method using the struct")]
> HRESULT MyFirstMethod([in, out] myUDT* lpMyStruct,
> [in, out] VARIANT_BOOL* bMyBool);
> };
>
> [
> uuid(9C6C9365-11DA-11d4-BA7A-00105AD7BBC8),
> version(1.0),
> helpstring("IMyInterface Type Library")
> ]
> library IMyInterfaceLib
> {
> importlib("stdole32.tlb");
> importlib("stdole2.tlb");
> interface IMyInterface;
> };
> ========================================= > >
> Pour compiler cet IDL, il suffit alors d'utiliser la commande suivante :
> "midl.exe /ms_ext /char unsigned /c_ext IMyInterface.idl"
>
> En espérant t'avoir aidé
>
> Cordialement
>
> ____________________________
> Fabrice MALAINGRE
> Architecte Logiciel - Chef de Projet
> THEORIS - www.theoris.fr

Je crois etre sur la bonne piste.
2 questions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
J'ai une erreur:
MsXml.Idl(52) : fatal error C1034: xmldom.idl: no include path set
midl : command line error MIDL1003 : error returned by the C preprocessor (2)

Aucun fichier xmldom.idl sur mon disque. Je suppose que je dois telecharger davantage de SDK que ce que j'ai? Lesquels?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Mes SDK se sont installes sur C:Program FilesMicrosoft SDK
Pour compiler comme indique pour PtrStrArray
http://support.microsoft.com/default.aspx?scid=kb;EN-US;199824
J'ai ajoute a mon PATH
C:Program FilesMicrosoft SDKBinWin64;C:Program FilesMicrosoft SDKBin
je me place dans C:Program FilesMicrosoft SDKinclude; et j'ai compile mon .ODL qui se trove sur V:xxx
Y a-t'il une organisation plus simple?



Les 2 problemes resolus apres avoir lance SetEnv.Bat
Il me reste a comprendre ce qui se passe

MERCI encore