473,226 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

Using tlb/dll on Windows (VARIANT data type returned)

I have C++ code to import a .tlb and use a .dll that has functions that return VARIANT types and accepts BSTRs (bstrings). I have seen that python has modules that can manipulate VARIANTs and BSTRs in the win32com or comtypes.automation packages. I began to use Boost.Python to script some of my code. I tried to send the VARIANT back to python by having the extension module's functions return a VARIANT or VARIANT*; I even tried _variant_t. In python, I used the comtypes.automation.VARIANT type like so:
varvalue = VARIANT(cppextension.function_call())
But this did not work :(

Qs:
Can I return the VARIANT using Boost.Python?
If not, is there another way?
Also, how can I use the tlb/dll directly in python? Is it similar to in C++, where I import the tlb and then can access the dll's namespace?

Any help would be appreciated!
Dec 2 '07 #1
1 3201
bartonc
6,596 Expert 4TB
I have C++ code to import a .tlb and use a .dll that has functions that return VARIANT types and accepts BSTRs (bstrings). I have seen that python has modules that can manipulate VARIANTs and BSTRs in the win32com or comtypes.automation packages. I began to use Boost.Python to script some of my code. I tried to send the VARIANT back to python by having the extension module's functions return a VARIANT or VARIANT*; I even tried _variant_t. In python, I used the comtypes.automation.VARIANT type like so:
varvalue = VARIANT(cppextension.function_call())
But this did not work :(

Qs:
Can I return the VARIANT using Boost.Python?
If not, is there another way?
Also, how can I use the tlb/dll directly in python? Is it similar to in C++, where I import the tlb and then can access the dll's namespace?

Any help would be appreciated!
The win32 package has support for this type of conversion. The comtypes module (package?) may also have what you are looking for.
Dec 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: David Hoffer | last post by:
Does C# have the same problem as C++ with code like this? if (GetDouble1() == GetDouble2()) { } In C++, due to the IEEE storage format, it is possible to have 2 doubles that are essentially...
6
by: Serkan DIRIARIN | last post by:
hi! i have created a document class. I have a .net client application and a web service. Both of them using same object model and referencing a doctypes.dll file. But when i want to run a client...
4
by: serge | last post by:
I was working on figuring out where a certain application was storing the multiple selection choices I was doing through the app. I finally figured out that they were being store in an IMAGE data...
1
by: Russell Mangel | last post by:
Sorry about the Cross-Post, I posted my question in the wrong group. Hello, What is the simplest way to create a dynamic collection (during run-time), using basic C (Struct data types). Since...
1
by: darrenbenn | last post by:
I need to convert this code to VB .NET (2003). Dim FaxMsg As IFaxMessage Set FaxMsg = gFC.NewMessage Dim Recip As Variant ' add a recipient to the fax recipients collection Set Recip =...
2
by: bloukopkoggelmander | last post by:
Hi all I am getting the following error and it is driving me insane. I just cannot find a fix for it. : You tried to assign the NULL value to a variable that is not a Variant data type. Now...
2
by: empire5 | last post by:
I'm trying to convert a MS-Sql 6.5 VB application to SQL 2005 and vb.net. The vb app has uses a variant data type. When I try to read the variant data type from the sql 2005 database I get 8,000...
3
by: jacob navia | last post by:
Abstract: Continuing the discussion about abstract data types, in this discussion group, a string collection data type is presented, patterned after the collection in C# and similar languages...
0
by: hannoudw | last post by:
Hi. I'm working with a form that contain text boxes ( Invoice_num auto number, and Invoice_date bound to the table Invoice) , and a subform contains (num (and it's an auto number also) , article,...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.