Hello, I received excellent instruction from you. Many thanks, Dragan.----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Thursday, April 09, 2009 7:50 PM Subject: Re: Python question
Yes, that is possible. Look at the ctypes documentation within the Python documentation, or Google for examples. If your VB DLL is a COM server, however, you would use another method to access it, e.g., comtypes. That package is not installed with Python, but a web search will find it. Jamal On Thu, 9 Apr 2009, Dragan Miljojcic wrote:Date: Thu, 9 Apr 2009 17:59:56 +0200 From: Dragan Miljojcic <gagabim@xxxxxxxxx> Reply-To: programmingblind@xxxxxxxxxxxxx To: programmingblind@xxxxxxxxxxxxx Subject: Re: Python question 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__________ 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