Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Karl-Heinz" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: C-DLL with paramter VARIANT and FILETIME? Date: Tue, 23 Oct 2018 18:20:33 +0200 Lines: 119 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 8bit X-Trace: individual.net XRrvOOjjJEbGKQE7SrGfxg3bHbAkAHMcIPcVThMm6miMTfz1s= Cancel-Lock: sha1:h71yWcT0O1vqQH+Q5gs10VTCgDY= In-Reply-To: X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3564.1216 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3564.1216 Xref: csiph.com comp.lang.clipper.visual-objects:12081 Hi Gerhard, puuh, i´m running out of ideas... In the VO28RUN.dll there are two more "Variant" funcs. After reading your msgs again, it seems you didn´t try the Usual2Variant() till now ? _DLL FUNCTION Usual2Variant (pItem AS PTR, pvarg AS PTR) AS LOGIC PASCAL:VO28RUN.Usual2Variant _DLL FUNCTION Variant2Usual (pvarg AS PTR, pItem AS PTR) AS LOGIC PASCAL:VO28RUN.Variant2Usual i´ve searched the SDK prg sources but both funcs are never used. So the param usage is not clear. i think the best would be to contact the vendor for a C sample that shows the OPCReaditem() usage. Good luck ! regards Karl-Heinz "Gerhard Bunzel" schrieb im Newsbeitrag news:pqncac$vuj$1@news-1.m-online.net... Hi Karl-Heinz, thanks for your answer. In VB a Handle is a LONG - so I used it the same way. A PTR is also only a numeric value. http://codingdomain.com/visualbasic/win32api/datatypes/ A C-Wrapper for VPE from Wolfgang Riedmann is also using LONG for the handle - and it's working perfect. The VB-Sample is working and shows the items values. This is from that sample: Private Record(1 To 1000) As Rec Private myconnectionhandle(100), mygrouphandle(100), myitemhandle(1000) As Long Private mytimestamp As Date Private myitemdata As Variant Private myrate, myquality As Long Private Type Rec Key As String ConnectionHandle As Long GroupHandle As Long TagHandle As Long Description As String Kind As String Units As String ArrayNumber As Integer Room As Integer Value As Variant FieldName As String End Type And here reading of an item: tf = ReadOPCItem(ByVal Record(i).ConnectionHandle, ByVal Record(i).GroupHandle, ByVal Record(i).TagHandle, Record(i).Value, mytimestamp, myquality) Out of the file opcda.h from a C-Sample: typedef DWORD OPCHANDLE; The data type LONG for the handles schound not b the problem. All other functions without VARIANT and FILETIME are working. I can read the server- and the itemnames, connect to the server, create a group, add an item to the group, disconnect from server. But I can't read a itemvalue :-( Thanks in advance. Best regards Gerhard Am 22.10.2018 um 21:20 schrieb Karl-Heinz: > Hi Gerhard, > >> ReadOPCItem(myserverhandle, mygrouphandle, myItemhandle, ptrVariant, >> ptrFileTime, @nQuality) >> gives back a TRUE. GetLastError() is 0 - no Error. > > strange .... > > >> This is the C-function: >> BOOL ReadOPCItem (HANDLE hConnect, HANDLE hGroup, HANDLE hItem, VARIANT >> *pVar, FILETIME *pTimeStamp, DWORD *pQuality); > > > _DLL FUNCTION ReadOPCItem (nConnect AS LONG, pGroupConnect AS LONG, > pItemConnect AS LONG, pVariant AS _winVARIANT, pFileTime AS _winFILETIME, > pQuality REF DWORD) AS LOGIC PASCAL:WTclient._ReadOPCItem@24 > > Why "AS LONG" ? IMO nConnect, pGroupConnect and pItemConnect should be > declared "AS PTR" and not "AS LONG" ? > > Have you tried to run the VB sample exe files that are included in > WTclient.zip - just to see that ReadOPCItem() works at least with VB ? > > > Isn´t there any C sample that shows how ReadOPCItem() is called ? > > > regards > Karl -Heinz