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

G

Gary Kshepitzki

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
 
S

Stephen Prinster

Gary said:
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

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.
 
J

Josef Meile

Hi Gary,
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.
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
 
G

Gary Kshepitzki

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top