Click here to Skip to main content
15,923,557 members
Home / Discussions / C#
   

C#

 
GeneralRe: create reg_expand_sz key in registry Pin
Heath Stewart20-Jan-05 5:55
protectorHeath Stewart20-Jan-05 5:55 
GeneralRe: create reg_expand_sz key in registry Pin
Dave Kreskowiak20-Jan-05 13:12
mveDave Kreskowiak20-Jan-05 13:12 
Generalpdf as BackGroundImage Pin
Anonymous19-Jan-05 8:13
Anonymous19-Jan-05 8:13 
GeneralRe: pdf as BackGroundImage Pin
Heath Stewart19-Jan-05 8:33
protectorHeath Stewart19-Jan-05 8:33 
GeneralWindows Service Pin
DotNetAppDeveloper19-Jan-05 7:39
DotNetAppDeveloper19-Jan-05 7:39 
GeneralRe: Windows Service Pin
Heath Stewart19-Jan-05 8:08
protectorHeath Stewart19-Jan-05 8:08 
GeneralRe: Windows Service Pin
DotNetAppDeveloper19-Jan-05 9:17
DotNetAppDeveloper19-Jan-05 9:17 
GeneralCalling COM interface from C# Pin
shayw19-Jan-05 7:36
shayw19-Jan-05 7:36 
Hi,

I have a client comopnent (written in C++), which is calling to methods on C# component (using COM Interop).
My problem is, that in some way I need to be able to call from my C# to method implemented in the C++ (kind of a callback...).
Actually it is a kind of "Observer" pattern, where the subscriber is a C++ module and the publisher is a C# component.
for example:

C# Server code:

///
/// The ISink interface is to be implemented by a C++ client
///
interface ISink
{
void OnChange(string msg);
}

interface IServer
{
.
.
int RegistrForChange(ISink sink);
void Broadcast(string msg);
}

class CServer: IServer
{
int IServer.RegisrtForChange(ISing sink)
{
// keep isink in hashtable...
}

int IServer.Broadcast(string msg)
{
foreach (ISink sink in m_hash)
{
sink.OnChange(msg); // OnChange is implemented by the listener (C++)...
}
}
}

C++ Client code

class Client : public ISink //how can this be done...??
{
// Creating IServer object using COM...
void Init()
{
.
.
iServer.RegisterForChange(this);
.
.
}

void OnChange(BSTR msg)
{
printf("Got %s", msg);
}
}

Is there a way of doing this kind of thing???

Thanks!
GeneralRe: Calling COM interface from C# Pin
Heath Stewart19-Jan-05 7:56
protectorHeath Stewart19-Jan-05 7:56 
GeneralRe: Calling COM interface from C# Pin
shayw19-Jan-05 8:20
shayw19-Jan-05 8:20 
GeneralRe: Calling COM interface from C# Pin
Heath Stewart19-Jan-05 8:27
protectorHeath Stewart19-Jan-05 8:27 
GeneralRe: Calling COM interface from C# Pin
shayw19-Jan-05 8:48
shayw19-Jan-05 8:48 
GeneralRe: Calling COM interface from C# Pin
Heath Stewart19-Jan-05 8:54
protectorHeath Stewart19-Jan-05 8:54 
GeneralRe: Calling COM interface from C# Pin
shayw20-Jan-05 7:36
shayw20-Jan-05 7:36 
GeneralRe: Calling COM interface from C# Pin
Heath Stewart20-Jan-05 9:35
protectorHeath Stewart20-Jan-05 9:35 
GeneralAccess COM Collection using InvokeMethod Pin
dlgussin19-Jan-05 5:19
dlgussin19-Jan-05 5:19 
GeneralRe: Access COM Collection using InvokeMethod Pin
Heath Stewart19-Jan-05 7:45
protectorHeath Stewart19-Jan-05 7:45 
GeneralRe: Access COM Collection using InvokeMethod Pin
dlgussin19-Jan-05 9:05
dlgussin19-Jan-05 9:05 
GeneralRe: Access COM Collection using InvokeMethod Pin
dlgussin19-Jan-05 15:59
dlgussin19-Jan-05 15:59 
GeneralSMTP Question Pin
WDI19-Jan-05 4:01
WDI19-Jan-05 4:01 
GeneralRe: SMTP Question Pin
Judah Gabriel Himango19-Jan-05 4:42
sponsorJudah Gabriel Himango19-Jan-05 4:42 
GeneralRe: SMTP Question Pin
Heath Stewart19-Jan-05 7:35
protectorHeath Stewart19-Jan-05 7:35 
GeneralExtended Context Menu Pin
realmontanakid19-Jan-05 3:37
realmontanakid19-Jan-05 3:37 
GeneralRe: Extended Context Menu Pin
leppie19-Jan-05 6:08
leppie19-Jan-05 6:08 
GeneralRe: Extended Context Menu Pin
Anonymous19-Jan-05 7:11
Anonymous19-Jan-05 7:11 

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.