BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I import a IDL file to DELPHI Project?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
darnis
Guest





PostPosted: Tue Jun 14, 2005 2:55 am    Post subject: How can I import a IDL file to DELPHI Project? Reply with quote



Hi, all

I have a problem how can I import the third provide IDL file? For
example, the OPC Server's IDL file from www.opcfoundation.org , how can I
import it to my project?


OPC.IDL is download from opcfoundation. It's attached following.

Thanks.

Darnis

-----------------------------OPC.IDL---------------------------------
// OPC.IDL
// REVISION: 8/28 8:00 pm

import "oaidl.idl" ;

typedef enum { OPC_DS_CACHE = 1, OPC_DS_DEVICE } OPCDATASOURCE ;

typedef enum { OPC_BRANCH = 1, OPC_LEAF, OPC_FLAT} OPCBROWSETYPE;

typedef enum { OPC_NS_HIERARCHIAL = 1, OPC_NS_FLAT} OPCNAMESPACETYPE;

typedef enum { OPC_BROWSE_UP = 1, OPC_BROWSE_DOWN} OPCBROWSEDIRECTION;

typedef enum { OPC_READABLE = 1, OPC_WRITEABLE } OPCACCESSRIGHTS;

typedef enum { OPC_NOENUM = 0, OPC_ANALOG, OPC_ENUMERATED } OPCEUTYPE;

typedef enum { OPC_STATUS_RUNNING = 1,
OPC_STATUS_FAILED,
OPC_STATUS_NOCONFIG,
OPC_STATUS_SUSPENDED,
OPC_STATUS_TEST } OPCSERVERSTATE;

typedef enum { OPC_ENUM_PRIVATE_CONNECTIONS = 1,
OPC_ENUM_PUBLIC_CONNECTIONS,
OPC_ENUM_ALL_CONNECTIONS,
OPC_ENUM_PRIVATE,
OPC_ENUM_PUBLIC,
OPC_ENUM_ALL } OPCENUMSCOPE;

typedef DWORD OPCHANDLE;

typedef struct {
DWORD dwSize;
DWORD dwItemCount;
OPCHANDLE hClientGroup;
DWORD dwTransactionID;
HRESULT hrStatus;
} OPCGROUPHEADER;

typedef struct {
OPCHANDLE hClient;
DWORD dwValueOffset;
WORD wQuality;
WORD wReserved;
FILETIME ftTimeStampItem;
} OPCITEMHEADER1;

typedef struct {
OPCHANDLE hClient;
DWORD dwValueOffset;
WORD wQuality;
WORD wReserved;
} OPCITEMHEADER2;

typedef struct {
DWORD dwItemCount;
OPCHANDLE hClientGroup;
DWORD dwTransactionID;
HRESULT hrStatus;
} OPCGROUPHEADERWRITE;

typedef struct {
OPCHANDLE hClient;
HRESULT dwError;
} OPCITEMHEADERWRITE;

typedef struct {
OPCHANDLE hClient;
FILETIME ftTimeStamp;
WORD wQuality;
WORD wReserved;
VARIANT vDataValue;
} OPCITEMSTATE;

typedef struct {
FILETIME ftStartTime;
FILETIME ftCurrentTime;
FILETIME ftLastUpdateTime;
OPCSERVERSTATE dwServerState;
DWORD dwGroupCount;
DWORD dwBandWidth;
WORD wMajorVersion;
WORD wMinorVersion;
WORD wBuildNumber;
WORD wReserved;
[string] LPWSTR szVendorInfo;
} OPCSERVERSTATUS;

typedef struct {
[string] LPWSTR szAccessPath;
[string] LPWSTR szItemID;
BOOL bActive ;
OPCHANDLE hClient;
DWORD dwBlobSize;
[size_is(dwBlobSize)] BYTE * pBlob;
VARTYPE vtRequestedDataType;
WORD wReserved;
} OPCITEMDEF;

typedef struct {
[string] LPWSTR szAccessPath;
[string] LPWSTR szItemID;
BOOL bActive;
OPCHANDLE hClient;
OPCHANDLE hServer;
DWORD dwAccessRights;
DWORD dwBlobSize;
[size_is(dwBlobSize)] BYTE * pBlob;
VARTYPE vtRequestedDataType;
VARTYPE vtCanonicalDataType;
OPCEUTYPE dwEUType;
VARIANT vEUInfo;
} OPCITEMATTRIBUTES;

typedef struct {
OPCHANDLE hServer;
VARTYPE vtCanonicalDataType;
WORD wReserved;
DWORD dwAccessRights;
DWORD dwBlobSize;
[size_is(dwBlobSize)] BYTE * pBlob;
} OPCITEMRESULT;


[
object,
uuid(39c13a4d-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCServer : IUnknown
{
HRESULT AddGroup(
[in, string] LPCWSTR szName,
[in] BOOL bActive,
[in] DWORD dwRequestedUpdateRate,
[in] OPCHANDLE hClientGroup,
[unique, in] LONG * pTimeBias,
[unique, in] float * pPercentDeadband,
[in] DWORD dwLCID,
[out] OPCHANDLE * phServerGroup,
[out] DWORD * pRevisedUpdateRate,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);

HRESULT GetErrorString(
[in] HRESULT dwError,
[in] LCID dwLocale,
[out, string] LPWSTR * ppString
);

HRESULT GetGroupByName(
[in, string] LPCWSTR szName,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);

HRESULT GetStatus(
[out] OPCSERVERSTATUS ** ppServerStatus
);

HRESULT RemoveGroup(
[in] OPCHANDLE hServerGroup,
[in] BOOL bForce
);

HRESULT CreateGroupEnumerator(
[in] OPCENUMSCOPE dwScope,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN* ppUnk
);

}

[
object,
uuid(39c13a4e-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCServerPublicGroups : IUnknown
{
HRESULT GetPublicGroupByName(
[in, string] LPCWSTR szName,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);

HRESULT RemovePublicGroup(
[in] OPCHANDLE hServerGroup,
[in] BOOL bForce
);
}


[
object,
uuid(39c13a4f-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCBrowseServerAddressSpace: IUnknown
{
HRESULT QueryOrganization(
[out] OPCNAMESPACETYPE * pNameSpaceType
);

HRESULT ChangeBrowsePosition(
[in] OPCBROWSEDIRECTION dwBrowseDirection,
[in, string] LPCWSTR szString
);

HRESULT BrowseOPCItemIDs(
[in] OPCBROWSETYPE dwBrowseFilterType,
[in, string] LPCWSTR szFilterCriteria,
[in] VARTYPE vtDataTypeFilter,
[in] DWORD dwAccessRightsFilter,
[out] LPENUMSTRING * ppIEnumString
);

HRESULT GetItemID(
[in] LPWSTR szItemDataID,
[out, string] LPWSTR * szItemID
);

HRESULT BrowseAccessPaths(
[in, string] LPCWSTR szItemID,
[out] LPENUMSTRING * ppIEnumString
);
}



[
object,
uuid(39c13a50-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCGroupStateMgt : IUnknown
{
HRESULT GetState(
[out] DWORD * pUpdateRate,
[out] BOOL * pActive,
[out, string] LPWSTR * ppName,
[out] LONG * pTimeBias,
[out] float * pPercentDeadband,
[out] DWORD * pLCID,
[out] OPCHANDLE * phClientGroup,
[out] OPCHANDLE * phServerGroup
);

HRESULT SetState(
[unique, in] DWORD * pRequestedUpdateRate,
[out] DWORD * pRevisedUpdateRate,
[unique, in] BOOL * pActive,
[unique, in] LONG * pTimeBias,
[unique, in] float * pPercentDeadband,
[unique, in] DWORD * pLCID,
[unique, in] OPCHANDLE * phClientGroup
);

HRESULT SetName(
[in, string] LPCWSTR szName
);

HRESULT CloneGroup(
[in, string] LPCWSTR szName,
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
}



[
object,
uuid(39c13a51-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCPublicGroupStateMgt : IUnknown
{
HRESULT GetState(
[out] BOOL * pPublic
);

HRESULT MoveToPublic(
void
);
}



[
object,
uuid(39c13a52-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCSyncIO : IUnknown
{
HRESULT Read(
[in] OPCDATASOURCE dwSource,
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[out, size_is(,dwNumItems)] OPCITEMSTATE ** ppItemValues,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT Write(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] VARIANT * pItemValues,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);
}

[
object,
uuid(39c13a53-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCAsyncIO : IUnknown
{
HRESULT Read(
[in] DWORD dwConnection,
[in] OPCDATASOURCE dwSource,
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[out] DWORD * pTransactionID,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT Write(
[in] DWORD dwConnection,
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] VARIANT * pItemValues,
[out] DWORD * pTransactionID,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT Refresh(
[in] DWORD dwConnection,
[in] OPCDATASOURCE dwSource,
[out] DWORD * pTransactionID
);

HRESULT Cancel(
[in] DWORD dwTransactionID
);

}


[
object,
uuid(39c13a54-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IOPCItemMgt: IUnknown
{
HRESULT AddItems(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCITEMDEF * pItemArray,
[out, size_is(,dwNumItems)] OPCITEMRESULT ** ppAddResults,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT ValidateItems(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCITEMDEF * pItemArray,
[in] BOOL bBlobUpdate,
[out, size_is(,dwNumItems)] OPCITEMRESULT ** ppValidationResults,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT RemoveItems(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT SetActiveState(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in] BOOL bActive,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT SetClientHandles(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] OPCHANDLE * phClient,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT SetDatatypes(
[in] DWORD dwNumItems,
[in, size_is(dwNumItems)] OPCHANDLE * phServer,
[in, size_is(dwNumItems)] VARTYPE * pRequestedDatatypes,
[out, size_is(,dwNumItems)] HRESULT ** ppErrors
);

HRESULT CreateEnumerator(
[in] REFIID riid,
[out, iid_is(riid)] LPUNKNOWN * ppUnk
);
}


[
object,
uuid(39c13a55-011e-11d0-9675-0020afd8adb3),
pointer_default(unique)
]
interface IEnumOPCItemAttributes : IUnknown
{
HRESULT Next(
[in] ULONG celt,
[out, size_is(,*pceltFetched)] OPCITEMATTRIBUTES ** ppItemArray,
[out] ULONG * pceltFetched
);

HRESULT Skip(
[in] ULONG celt
);

HRESULT Reset(
void
);

HRESULT Clone(
[out] IEnumOPCItemAttributes ** ppEnumItemAttributes
);
}


Back to top
George Birbilis
Guest





PostPosted: Tue Jun 14, 2005 2:20 pm    Post subject: Re: How can I import a IDL file to DELPHI Project? Reply with quote



Quote:
I have a problem how can I import the third provide IDL file? For
example, the OPC Server's IDL file from www.opcfoundation.org , how can I
import it to my project?


OPC.IDL is download from opcfoundation. It's attached following.


the Type Library Viewer (make a new Type Library or ActiveX server project
to enable it [it's located at Project menu I think]) has "Text" tab and an
option to not be
"read only" so that you can edit the IDL text

at Delphi environment options there's also a Type Library tab with option to
use IDL or Pascal, set it to use IDL there

cheers,
George

-----
George Birbilis (birbilis (AT) kagi (DOT) com)
Microsoft Most Valuable Professional
MVP J# for 2004 & 2005
http://www.kagi.com/birbilis
QuickTime, Delphi, ActiveX, .NET, IPC
http://www.mech.upatras.gr/~robgroup
Robotics



Back to top
John Carlyle-Clarke
Guest





PostPosted: Tue Jun 14, 2005 4:01 pm    Post subject: Re: How can I import a IDL file to DELPHI Project? Reply with quote



"George Birbilis" <birbilis (AT) kagi (DOT) com> wrote in
news:42aee7bc (AT) newsgroups (DOT) borland.com:

Quote:
I have a problem how can I import the third provide IDL file?
For
example, the OPC Server's IDL file from www.opcfoundation.org ,
how can I import it to my project?


OPC.IDL is download from opcfoundation. It's attached
following.


the Type Library Viewer (make a new Type Library or ActiveX server
project to enable it [it's located at Project menu I think]) has
"Text" tab and an option to not be
"read only" so that you can edit the IDL text

at Delphi environment options there's also a Type Library tab with
option to use IDL or Pascal, set it to use IDL there

I had a go at this too, and at using midl, but there are some
problems, as this IDL is not in the correct format.

I have used the OPC client interfaces, and they are all automation
compatible. What puzzles me most about this one - given that OPC
stands for "OLE for Process Control" - is that these are not
automation compatible types in this IDL.

At the very least, it needs to be wrapped in something like:

[
uuid(F2F13D0C-0A82-420A-8F45-F1E63BAC30AC),
version(1.0),
helpstring("OPC Server Type library")
]
library OPCServer
{

... // all the IDL // ...

};


Back to top
darnis
Guest





PostPosted: Wed Jun 15, 2005 1:53 am    Post subject: Re: How can I import a IDL file to DELPHI Project? Reply with quote

Quote:
the Type Library Viewer (make a new Type Library or ActiveX server project
to enable it [it's located at Project menu I think]) has "Text" tab and an
option to not be
"read only" so that you can edit the IDL text

at Delphi environment options there's also a Type Library tab with option
to
use IDL or Pascal, set it to use IDL there

cheers,
George


Thank a lot.

The problem is same to John Carlyle-Clarke.



Back to top
darnis
Guest





PostPosted: Wed Jun 15, 2005 1:54 am    Post subject: Re: How can I import a IDL file to DELPHI Project? Reply with quote

Quote:
I had a go at this too, and at using midl, but there are some
problems, as this IDL is not in the correct format.

I have used the OPC client interfaces, and they are all automation
compatible. What puzzles me most about this one - given that OPC
stands for "OLE for Process Control" - is that these are not
automation compatible types in this IDL.

At the very least, it needs to be wrapped in something like:

[
uuid(F2F13D0C-0A82-420A-8F45-F1E63BAC30AC),
version(1.0),
helpstring("OPC Server Type library")
]
library OPCServer
{

... // all the IDL // ...

};

I want to plan the OPC Server use delphi.
In Delphi7, I do this

Quote:
[
uuid(F2F13D0C-0A82-420A-8F45-F1E63BAC30AC),
version(1.0),
helpstring("OPC Server Type library")
]
library OPCServer
{

... // all the IDL // ...

};

there is a error "Unexpected identifier" when i save the type library.
And it seems that any change in tab "Text" bring on this error.
Why ? How about to wrap the IDL?


thanks,
darnis



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.