This project is read-only.

NDDE - Win Server sample code

Apr 3, 2009 at 4:19 PM
Hello everyone,

there has been a brilliant NDDE library developed and published here. Thanks!

I've got my own C# test applications, based on sample code, easily running the proper way, but - unfortunately there is none of type, I'd like to develop. I have a controller with serial communication, protocol of which I have and use, and I have a fine visualisation software, acting as a DDE client. Therefore I'd like to create a Win DDE server, that would communicate to controller and transmit data to visualizer. There are samples of DDE client for both console and winapp, and there is server code for console. But there is no basic sample for Win server. I've tried to make one, but it never hears the connection attempt from any client. So I'm doing it wrong, although I've struggled with it several ways, and I obviously need a kind help to move on.

Does anyone have knowledge about working Win DDE server sample code with NDDE? Is it somewhere downloadable in the net, can somebody please provide a link to it or even e-mail the tiny archive?

Many thanks in advance!,
NunSdi (nunsdi@gmail.com)
Apr 21, 2009 at 9:59 PM
Edited Apr 21, 2009 at 10:20 PM
I probably should not be responding to this because I am a nubie but I did get a server working in VB .net with a form.  It might not be the most elegant or best way to do it but it works.  You need to inherit DdeServer of course.  After that I just needed to use a delegate to get the data from the Ndde thread to the UI thread.  Here are some snippets as an example of what I did.  Hope it helps.  I can send my vb app if needed.  It is not complete but it does connect and pass data.  

EDIT - I tried to send my code to your email and it got rejected.  If you have a place I can post it I can do that.  

    Delegate Sub SetTextCallback(ByVal [text] As String)

    ' This is an event that I created that is fired in the OnBeforeConnect override function.  
    Private Sub Server_evBeforeConnect(ByVal Topic As String) Handles Server.evBeforeConnect
        SetText(Topic & " Connecting")
    End Sub


    Private Sub SetText(ByVal [text] As String)

        Try
            ' InvokeRequired required compares the thread ID of the
            ' calling thread to the thread ID of the creating thread.
            ' If these threads are different, it returns true.
            If Me.ListBox1.InvokeRequired Then
                Dim d As New SetTextCallback(AddressOf SetText)
                Me.Invoke(d, New Object() {[text]})
            Else
                Me.ListBox1.Items.Insert(0, [text])
            End If
        Catch ex As Exception
            MsgBox("SetText: " & ex.Message)
        End Try
    End Sub

Jul 14, 2009 at 8:48 AM

A first look at the NDde Server solution seems quite complex, indicative of a simpler solution, but with the absence of simple constructions it works.  How would you add the Topic (e.g., 'myTopic')  and Items (e.g., 'myItems()' ) to the NDde server?  Any thoughts?

Oct 15, 2009 at 7:43 AM
Edited Oct 15, 2009 at 7:44 AM

Could you tell me how to add the Topic and Items to the NDde Server??????

Oct 15, 2009 at 9:23 AM

Sorry I am something wrong!!!

I have used your server sample code.

When put in my case, In advise("*","*") which prompt error and throw exceptions. How to do???

System.Reflection.TargetInvocationException' occurred in mscorlib.dll.

I am using a form with the NDde server sample code .

Do you have any hints??? The pure sample works after I compile and test in the sample, but not in my case???

Please help!!!

 

Oct 15, 2009 at 10:20 AM

I have solved by rebuilding the sample and use this dll, not on the binary folder.

Oct 29, 2009 at 4:45 AM

I understand that you are using the original NDde server sample code and got it to work.  Or are you using Darbyln's ? Have you managed to send  data to different Items? How?