By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,537 Members | 1,440 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,537 IT Pros & Developers. It's quick & easy.

Passing COM VB6 strings weirdness

P: n/a
List:

I've a Python COM server that keeps an event logs.

I've been using it from VB6:

logEvent "Message"

The Python side of things looks like:

def logEntry(self, caller = u'Unknown Caller', \
message = u'Unknown Message'):
if self.fileOpen == True:
return self.__Logger(str(caller), str(message))
else:
return -1
The which refers back to the base logger class method:

def __call__(self, caller = 'Unknown Caller', \
message = 'Unknown Message'):
self.logFile.write(ctime(time()) + ', <' + caller \
+ '>, -- ' + message + '\n')
return 0

When I log certain events from VB, I also display a message box for the
user or for me, depending on the specific message.

If I call messageBox BEFORE I invoke logEntry, all is well.

BUT if I invoke logEntry first, the passed string becomes a literal
zero.

Any thoughts on this? I'm not certain why I'm getting the returned
value from this at all, let alone why it's being assigned to the
argument string.

Is my code telling Python to alter the value or is this a VB oddity?

Thanks
Charles


Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
drs
"U-CDK_CHARLES\Charles" <"Charles Krug"@cdksystems.com> wrote in message
news:z3******************@nwrdny02.gnilink.net...
List:

I've a Python COM server that keeps an event logs.

I've been using it from VB6:

* * *

When I log certain events from VB, I also display a message box for the
user or for me, depending on the specific message.

If I call messageBox BEFORE I invoke logEntry, all is well.

BUT if I invoke logEntry first, the passed string becomes a literal
zero.

Any thoughts on this? I'm not certain why I'm getting the returned
value from this at all, let alone why it's being assigned to the
argument string.


I don't know if this is the same thing, but I have found that often passing
variables from VB to Python COM servers mucks up the variables on the VB
side. I think I have posted this issue here (probably a few years back),
but I have never gotten a reason why -- i think. Also, I have never really
pinned down exectly what circumstances lead to it. Instead, I have gotten
used to declaring two identicle variables in VB when I need to do what you
are doing. It is an awful hack, but it works.

Sorry for such a lame answer.

-doug
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.