msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Interfacing VB6 with Python - How ?

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise
Author Message
Anonymous



Joined: 04 Oct 2007
Posts: 20

PostPosted: Wed Oct 03, 2007 3:48 pm    Post subject: Interfacing VB6 with Python - How ? Reply with quote

I want to write a VB6 command line GUI, that will accept a user keyboard
input and send the commands to a Python interpreter, so I can run python
commands from my VB app - has anyone done this before (can't seem to
find anything after days of searching)

Archived from group: microsoft>public>vb>enterprise
Back to top
View user's profile Send private message
Ralph



Joined: 04 Oct 2007
Posts: 4148

PostPosted: Wed Oct 03, 2007 11:21 am    Post subject: Re: Interfacing VB6 with Python - How ? Reply with quote

"Anonymous" wrote in message@bt.com...
> I want to write a VB6 command line GUI, that will accept a user keyboard
> input and send the commands to a Python interpreter, so I can run python
> commands from my VB app - has anyone done this before (can't seem to
> find anything after days of searching)
>

You need to provide more information about what you are trying to do, for
whether you realize it or not, your requests covers many various techniques
not all of which may be appropriate for you situation.

For example do you want a GUI that takes a command line or do you want to
run you VB application as a Console?
Here is some help on creating a VB Console:
http://vb.mvps.org/samples/project.asp?id=console

[Also appreciate that Python uses a different command line parser than VB.
You may need a GUI just to insure you provide the correct format. ....]

There are many ways to run the Python interpreter from VB, but which to use
will depend if you need to capture any 'returns'.

And just what do you mean by "Python Commands"?
Back to top
View user's profile Send private message
Anonymous



Joined: 04 Oct 2007
Posts: 20

PostPosted: Wed Oct 10, 2007 5:35 am    Post subject: Re: Interfacing VB6 with Python - How ? Reply with quote

Ralph wrote:
> "Anonymous" wrote in message
> @bt.com...
>
>>I want to write a VB6 command line GUI, that will accept a user keyboard
>>input and send the commands to a Python interpreter, so I can run python
>>commands from my VB app - has anyone done this before (can't seem to
>>find anything after days of searching)
>>
>
>
> You need to provide more information about what you are trying to do, for
> whether you realize it or not, your requests covers many various techniques
> not all of which may be appropriate for you situation.
>
> For example do you want a GUI that takes a command line or do you want to
> run you VB application as a Console?
> Here is some help on creating a VB Console:
> http://vb.mvps.org/samples/project.asp?id=console
>
> [Also appreciate that Python uses a different command line parser than VB.
> You may need a GUI just to insure you provide the correct format. ....]
>
> There are many ways to run the Python interpreter from VB, but which to use
> will depend if you need to capture any 'returns'.
>
> And just what do you mean by "Python Commands"?
>
>

Hi Ralph, thanks for the links. Was not exactly what i was looking for -
probably should have made myself more clear. I want to create a command
line GUI (using a VB6 form) and use the form to accept user input.

I want to capture any results returned by the interpreter, and display
them in the 'console' (or perhaps less confusingly) GUI. I want to stay
away from COM because of 'Dll hell' issues - so that leaves me with teh
C/C++ APi approach - which I prefer in any case.

As an aside, is tehre an example of a VB6 sample code that shows how to
build such a command line window that accepts user input? (maybe easy
enough for some of the vB afficicionados in here ?)
Back to top
View user's profile Send private message
Ralph



Joined: 04 Oct 2007
Posts: 4148

PostPosted: Wed Oct 10, 2007 12:13 am    Post subject: Re: Interfacing VB6 with Python - How ? Reply with quote

"Anonymous" wrote in message@bt.com...
>
>
> >
>
> Hi Ralph, thanks for the links. Was not exactly what i was looking for -
> probably should have made myself more clear. I want to create a command
> line GUI (using a VB6 form) and use the form to accept user input.
>
> I want to capture any results returned by the interpreter, and display
> them in the 'console' (or perhaps less confusingly) GUI. I want to stay
> away from COM because of 'Dll hell' issues - so that leaves me with teh
> C/C++ APi approach - which I prefer in any case.
>
> As an aside, is tehre an example of a VB6 sample code that shows how to
> build such a command line window that accepts user input? (maybe easy
> enough for some of the vB afficicionados in here ?)
>

Break it down into its basic steps. Each step has a couple of solutions and
the not surprisingly Gotchas.

One create a Form.
Put a TextBox on it to receive your "Command".
Now where are you going to send that command?
If command line (as per a DOSPrompt) then you can probably use Shell().
But now you want to retrieve the results. That's where Karl's stuff comes
in.
Don't worry about Dll Hell. Dll Hell comes in when people don't follow the
rules.
Now you want to display the results.
Add another TextBox to your form.

Try it and see how far you get.

-ralph
Back to top
View user's profile Send private message
Anonymous



Joined: 04 Oct 2007
Posts: 20

PostPosted: Wed Oct 10, 2007 12:10 pm    Post subject: Re: Interfacing VB6 with Python - How ? Reply with quote

Ralph wrote:

> "Anonymous" wrote in message
> @bt.com...
>
>>
>>>
>>
>>Hi Ralph, thanks for the links. Was not exactly what i was looking for -
>>probably should have made myself more clear. I want to create a command
>>line GUI (using a VB6 form) and use the form to accept user input.
>>
>>I want to capture any results returned by the interpreter, and display
>>them in the 'console' (or perhaps less confusingly) GUI. I want to stay
>>away from COM because of 'Dll hell' issues - so that leaves me with teh
>>C/C++ APi approach - which I prefer in any case.
>>
>>As an aside, is tehre an example of a VB6 sample code that shows how to
>>build such a command line window that accepts user input? (maybe easy
>>enough for some of the vB afficicionados in here ?)
>>
>
>
> Break it down into its basic steps. Each step has a couple of solutions and
> the not surprisingly Gotchas.
>
> One create a Form.
> Put a TextBox on it to receive your "Command".
> Now where are you going to send that command?
> If command line (as per a DOSPrompt) then you can probably use Shell().
> But now you want to retrieve the results. That's where Karl's stuff comes
> in.
> Don't worry about Dll Hell. Dll Hell comes in when people don't follow the
> rules.
> Now you want to display the results.
> Add another TextBox to your form.
>
> Try it and see how far you get.
>
> -ralph
>
>

Ok, done most of the VB side now. Only thing I can't work out to do is this:

1). How do I set the cursor to the end of the last line (prompt)?
2). How do I "trap" scroll up/down, pageup/down and home/end key
presses, - so that the cursor in the text box remains on the "command
prompt" (i.e. last) line ?
Back to top
View user's profile Send private message
Ralph



Joined: 04 Oct 2007
Posts: 4148

PostPosted: Wed Oct 10, 2007 12:45 pm    Post subject: Re: Interfacing VB6 with Python - How ? Reply with quote

"Anonymous" wrote in message@bt.com...
>
>
> >
>
> Ok, done most of the VB side now. Only thing I can't work out to do is
this:
>
> 1). How do I set the cursor to the end of the last line (prompt)?
> 2). How do I "trap" scroll up/down, pageup/down and home/end key
> presses, - so that the cursor in the text box remains on the "command
> prompt" (i.e. last) line ?
>

It gets a little tougher. You are trying to mimic a DOSPrompt window in a
multiline textbox?

Take a peek at this...
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=27604&lngWId=1



Rework your question, be more specific as to what control you are using. And
repost your question to
microsoft.public.vb.general.discussion
There you will find a greater audience for managing VB Controls.

-ralph
Back to top
View user's profile Send private message
Anonymous



Joined: 04 Oct 2007
Posts: 20

PostPosted: Wed Oct 10, 2007 8:29 pm    Post subject: Re: Interfacing VB6 with Python - How ? Reply with quote

Ralph wrote:

> "Anonymous" wrote in message
> @bt.com...
>
>>
>>>
>>
>>Ok, done most of the VB side now. Only thing I can't work out to do is
>
> this:
>
>>1). How do I set the cursor to the end of the last line (prompt)?
>>2). How do I "trap" scroll up/down, pageup/down and home/end key
>>presses, - so that the cursor in the text box remains on the "command
>>prompt" (i.e. last) line ?
>>
>
>
> It gets a little tougher. You are trying to mimic a DOSPrompt window in a
> multiline textbox?
>
> Take a peek at this...
> http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=27604&lngWId=1
>
>
>
> Rework your question, be more specific as to what control you are using. And
> repost your question to
> microsoft.public.vb.general.discussion
> There you will find a greater audience for managing VB Controls.
>
> -ralph
>
>

Good starting point - thanks

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group