Re: Python question

  • From: "Dragan Miljojcic" <gagabim@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 9 Apr 2009 17:59:56 +0200

Thanks a lot.

How to call function MyFunc in the MyDll.dll which was created in VB6, not
function from user32.dll ? How to send the string to function, and get back
string as return value? Is that possible from Python?

Sorry, my English is not good. Translation I made with EdSharp program. With
his command, it is now easy.

Thank you again,
Dragan.
----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Thursday, April 09, 2009 4:41 PM
Subject: Re: Python question


Hope this helps,
Jamal

""" MessageBox.py

Here is an example of making a DLL call in Python, using the ctypes
module, which is built into Python 2.5.  Suppose we want to call the
ASCII version of the MessageBox function, MessageBoxA, which is located
in the user32.dll dynamic link library of the Windows API.  The function
signature is described at
http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

Here is an excerpt:
intMessageBox(
HWNDhWnd,
LPCTSTRlpText,
LPCTSTRlpCaption,
UINTuType
);

Parameters
hWnd
[in]Handle to the owner window of the message box to be created. If this
parameter is NULL, the message box has no owner window.
lpText
[in]Pointer to a null-terminated string that contains the message to be
displayed. If the string consists of more than one line, you can
separate the lines
using a carriage return and/or linefeed character between each line.
lpCaption
[in]Pointer to a null-terminated string that contains the dialog box
title. If this parameter is NULL, the default title is Error.
uType
[in]Specifies the contents and behavior of the dialog box.

Here is Python code that calls the function and presents a message box:
"""

import ctypes
dll = ctypes.windll.user32
func = dll.MessageBoxA
func(0, 'My Message', 'My Title', 0)

On
Sun, 5 Apr 2009, Dragan Miljojcic wrote:

Date: Sun, 5 Apr 2009 12:56:16 +0200
From: Dragan Miljojcic <gagabim@xxxxxxxxx>
Reply-To: programmingblind@xxxxxxxxxxxxx
To: programmingblind@xxxxxxxxxxxxx
Subject: Python question

Hello everyone!

My main language is VB6. I have a need to use the Python script. How to
call function that is in the dll, from Python scripts . This dll was
created in VB6. Please for a simple example.

Thank you for your response,
Dragan.

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: