Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
Questionhow can i use delegate to output several param in multi-thread? Pin
smallkubi21-Dec-15 3:29
smallkubi21-Dec-15 3:29 
AnswerRe: how can i use delegate to output several param in multi-thread? Pin
OriginalGriff21-Dec-15 3:53
mveOriginalGriff21-Dec-15 3:53 
GeneralRe: how can i use delegate to output several param in multi-thread? Pin
smallkubi21-Dec-15 4:44
smallkubi21-Dec-15 4:44 
AnswerRe: how can i use delegate to output several param in multi-thread? Pin
Eddy Vluggen21-Dec-15 6:32
professionalEddy Vluggen21-Dec-15 6:32 
GeneralRe: how can i use delegate to output several param in multi-thread? Pin
smallkubi21-Dec-15 15:13
smallkubi21-Dec-15 15:13 
GeneralRe: how can i use delegate to output several param in multi-thread? Pin
Eddy Vluggen22-Dec-15 0:18
professionalEddy Vluggen22-Dec-15 0:18 
AnswerRe: how can i use delegate to output several param in multi-thread? Pin
BillWoodruff21-Dec-15 18:20
professionalBillWoodruff21-Dec-15 18:20 
QuestionOPC / Rockwell for automation problem Pin
Roberto64_Ge21-Dec-15 0:07
Roberto64_Ge21-Dec-15 0:07 
I use Interop.RSIOPC.dll to connect via "OPC" a c# code with the PLC. I browse between the tags in the PLC memory and to do that I am using some functions. Browsing is mainly "moveDown(branch name)" or "MoveUp()". This is working. But if I need to jump staright to a branch I have to use MoveTo(ref System.Array). The array is created typeof string. At runtime MoveTo returns with a generic error and after many test my guess is that problem is related to the fact that I am using managed objects while the dll operated unmanaged.
Many thanks in advance for any help.
Regards
Roberto

I add here some more details:

my c# code :

System.Array branches;
branches = System.Array.CreateInstance(typeof(string),1);
branches.Initialize();
branches.SetValue("SLC_MODBUS_BASIC", 0); //name of the branch I need to move to
MyOpcBrowserName.MoveTo(ref branches); //pass the System.Array by ref as requested by the dll

This generate the unmanaged exception "Error HRESULT E_FAIL has been returned from a call to a COM component."
Error code -2147467259
Source "Interop.RsiOPCAuto" " at RsiOPCAuto.OPCBrowser.MoveTo(Array& Branches)\r\n at ... my code..

Here below the code from OPC foundation

OPCBrowser.cpp
// (c) Copyright 1998 The OPC Foundation
.
.
.

#include "stdafx.h"
#include "OPCBrowser.h"

.
.
.

// OPCBrowser::MoveTo method
STDMETHODIMP COPCBrowserImpl::MoveTo( SAFEARRAY ** ppBranches )
{
if(*ppBranches == NULL)
return E_INVALIDARG;

// Clear out the list
ClearNames();

HRESULT hr = S_OK;
LONG lBound=0;
LONG uBound=0;
// ServerHandles
hr = SafeArrayGetLBound(*ppBranches, 1, &lBound);
if( FAILED(hr) )
return hr;
hr = SafeArrayGetUBound(*ppBranches, 1, &uBound);
if( FAILED(hr) )
return hr;

hr = MoveToRoot();
if( FAILED(hr) )
return hr;

for( LONG index=lBound; index<=uBound; index++ )
{
BSTR Branch;
hr = SafeArrayGetElement(*ppBranches, &index, &Branch);
if( FAILED(hr) )
return hr;
if(*Branch != 0 )
{
hr = m_pOPCBrowser->ChangeBrowsePosition( OPC_BROWSE_DOWN, Branch );
SysFreeString( Branch );
if( FAILED(hr) )
return hr;
}
}
return hr;
}


Thank you in any case
Roberto Smile | :)

modified 22-Dec-15 4:25am.

Questionc# classes methods Pin
Member 1221945620-Dec-15 14:55
Member 1221945620-Dec-15 14:55 
AnswerRe: c# classes methods Pin
User 418025420-Dec-15 15:13
User 418025420-Dec-15 15:13 
GeneralRe: c# classes methods Pin
Member 1221945620-Dec-15 15:17
Member 1221945620-Dec-15 15:17 
GeneralRe: c# classes methods Pin
OriginalGriff20-Dec-15 19:53
mveOriginalGriff20-Dec-15 19:53 
AnswerRe: c# classes methods Pin
OriginalGriff20-Dec-15 19:58
mveOriginalGriff20-Dec-15 19:58 
AnswerRe: c# classes methods Pin
BillWoodruff20-Dec-15 23:42
professionalBillWoodruff20-Dec-15 23:42 
QuestionIncorrect syntax near ',' Pin
Member 1144944719-Dec-15 5:00
Member 1144944719-Dec-15 5:00 
AnswerRe: Incorrect syntax near ',' Pin
Dave Kreskowiak19-Dec-15 5:07
mveDave Kreskowiak19-Dec-15 5:07 
GeneralRe: Incorrect syntax near ',' Pin
Member 1144944719-Dec-15 10:18
Member 1144944719-Dec-15 10:18 
GeneralRe: Incorrect syntax near ',' Pin
Dave Kreskowiak19-Dec-15 11:48
mveDave Kreskowiak19-Dec-15 11:48 
GeneralRe: Incorrect syntax near ',' Pin
Foothill21-Dec-15 6:00
professionalFoothill21-Dec-15 6:00 
GeneralRe: Incorrect syntax near ',' Pin
Dave Kreskowiak21-Dec-15 7:09
mveDave Kreskowiak21-Dec-15 7:09 
QuestionHow can I include house address finder in my application? Pin
naouf1019-Dec-15 3:21
naouf1019-Dec-15 3:21 
AnswerRe: How can I include house address finder in my application? Pin
OriginalGriff19-Dec-15 4:08
mveOriginalGriff19-Dec-15 4:08 
GeneralRe: How can I include house address finder in my application? Pin
Mycroft Holmes20-Dec-15 12:01
professionalMycroft Holmes20-Dec-15 12:01 
AnswerRe: How can I include house address finder in my application? Pin
Gerry Schmitz19-Dec-15 8:59
mveGerry Schmitz19-Dec-15 8:59 
GeneralRe: How can I include house address finder in my application? Pin
naouf1019-Dec-15 11:09
naouf1019-Dec-15 11:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.