Sending an event from a python COM server to a VB COM client

Discussion in 'Python' started by Gary Kshepitzki, Nov 15, 2005.

  1. Hello
    I am trying to send an event from a Python COM server to a VB (or VB.NET)
    COM client.
    I am a newbie both in VB and in python.
    Can anyone give me a simple (but complete) code example both of the Python
    server side and the VB client side for raising a single event.

    Any answer would be highly appreciated.
    Regards
    Gary
     
    Gary Kshepitzki, Nov 15, 2005
    #1
    1. Advertisements

  2. I suggest the book _Python Programming on Win32_ by Mark Hammond and
    Andy Robinson. There is a chapter online and I believe it even includes
    the example you need.

    http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html

    Steve P.
     
    Stephen Prinster, Nov 16, 2005
    #2
    1. Advertisements

  3. Gary Kshepitzki

    Josef Meile Guest

    Hi Gary,
    Do you mean interprocess communication? If so, then you could use the
    WM_CopyData message from the Windows API. However, this will only work
    if the two applications are running in the same machine and if at least
    one of them (the receiver) has a Window were to send the messages.

    I have been used the following application to comunicate two C#
    applications:

    * Simple Interprocess Communications using WM_COPYDATA
    http://www.vbaccelerator.com/home/N...Simple_Interprocess_Communication/article.asp

    However, the zip contains a VB.Net example as well. I haven't ever done
    this with python, so, I don't know how it works. However, you could take
    a look at the following thread, which discuss how to implement this
    with python:

    * PyWin SendMessage
    http://groups.google.ch/group/comp.lang.python/browse_frm/thread/cf7412ec873cd265/c362e88d9e5d7e80

    I have also tried other approaches, but they didn't work on my case, or
    they require you to have additional hardware (ie: a network card), or to
    install additional software (ie: Microsoft Windwos Message Queuing).
    However, they might work for you:

    * Windows Sockets may be the easiest solution and you can find several
    examples of this with google. In my case, I didn't use them 'cause
    they require my users to have a network card and my system is just
    a single user application with several processes running on the same
    machine.

    * Named Pipes, which are a feature of windows:
    - Inter-Process Communication in .NET Using Named Pipes, Part 1
    http://ivanweb.com/articles/namedpipes/index.cfm

    - How to use named pipes for interprocess communication in Visual
    Basic .NET
    http://support.microsoft.com/?kbid=871044

    * Microsoft Windows Message Queuing (MSMQ) -> I don't have a VB/VB.NET
    example for this; only a C# example, but it may work in VB/VB.NET
    as well since if I'm not wrong, it also uses the Windows Api. Again,
    I didn't used it because it requires my users to install the MSMQ
    software from Microsoft, which is included with Windows.

    - Using MSMQ from C#
    http://www.codeproject.com/csharp/mgpMyQueue.asp

    Unfortunatelly, I don't have python examples, but since they use the
    Windows Api it may be possible to implement with the windows extensions
    for python. You just have to look for them in the python list.

    Regards,
    Josef
     
    Josef Meile, Nov 16, 2005
    #3
  4. Thank you Steve.
    I have already went over that book, I didn't find there an example of
    sending events from a python server to a VB client (just direct function
    calls from the VB client to the Python server, which is trivial). And in any
    case, since I am a newbie both in VB and in Python, I am really looking for
    an example that will spell things out for me. There's a lot of 'wrapping'
    happening under the hood in this technology and I am kind of lost between
    what is done for me on each side and what I should explicitly do my self.
    Thanks again for taking the time to answer.
    Gary
     
    Gary Kshepitzki, Nov 16, 2005
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.