Hi, all.
Just a quick question, when setting a COM process to read a value from
a pre-defined register index, I think, I have to change the variable
that the value will be returned to (as I have to do for the same
function in perl), into a VARIANT, However when i run the variant
code....
'serialIndex = win32com.client .pythoncom.VT_V ARIANT'
no matter what extension I use (i.e. VT_I4 or VT_BOOL etc etc) it
still returns a type mismatch error. I may be doing something wrong or
getting confused with variant processes in python. I do know the code
I use in perl to do this works but I dont know how to translate this,
fully, into python.
perl code for variant =
Win32::OLE::Var iant::Variant(W in32::OLE::Vari ant::VT_VARIANT |Win32::OLE::VA RIANT::VT_BYREF ,
0)
Cheers in advance,
Matt 5 3529
Matt Smith wrote: Hi, all.
Just a quick question, when setting a COM process to read a value from a pre-defined register index, I think, I have to change the variable that the value will be returned to (as I have to do for the same function in perl), into a VARIANT, However when i run the variant code....
'serialIndex = win32com.client .pythoncom.VT_V ARIANT'
no matter what extension I use (i.e. VT_I4 or VT_BOOL etc etc) it still returns a type mismatch error. I may be doing something wrong or getting confused with variant processes in python. I do know the code I use in perl to do this works but I dont know how to translate this, fully, into python.
perl code for variant = Win32::OLE::Var iant::Variant(W in32::OLE::Vari ant::VT_VARIANT |Win32::OLE::VA RIANT::VT_BYREF , 0)
Unfortunately, you really can't do this in a clean way. The best thing
to do is to ensure "makepy" has been run for your COM object, and the
right magic should always happen.
Mark.
Mark Hammond <mh******@skipp inet.com.au> wrote in message news:<bh******* ****@arachne.la byrinth.net.au> ... Matt Smith wrote: Hi, all.
Just a quick question, when setting a COM process to read a value from a pre-defined register index, I think, I have to change the variable that the value will be returned to (as I have to do for the same function in perl), into a VARIANT, However when i run the variant code....
'serialIndex = win32com.client .pythoncom.VT_V ARIANT'
no matter what extension I use (i.e. VT_I4 or VT_BOOL etc etc) it still returns a type mismatch error. I may be doing something wrong or getting confused with variant processes in python. I do know the code I use in perl to do this works but I dont know how to translate this, fully, into python.
perl code for variant = Win32::OLE::Var iant::Variant(W in32::OLE::Vari ant::VT_VARIANT |Win32::OLE::VA RIANT::VT_BYREF , 0)
Unfortunately, you really can't do this in a clean way. The best thing to do is to ensure "makepy" has been run for your COM object, and the right magic should always happen.
Mark.
Hi, thanks for the reply,
My problem is now this, when i go to makepy tool in pythonwin, it does
not see/recognise the type library file I want it to convert. Is there
anyway to add the file to the list of .tlb files it does does?
Cheers,
Matt.
p.s. How do I include the generated makepy file into my code ?
Matt Smith wrote: Mark Hammond <mh******@skipp inet.com.au> wrote in message news:<bh******* ****@arachne.la byrinth.net.au> ...
My problem is now this, when i go to makepy tool in pythonwin, it does not see/recognise the type library file I want it to convert. Is there anyway to add the file to the list of .tlb files it does does?
These type libraries are in the registry. You may be able to pass the
filename on the commandline to makepy.
p.s. How do I include the generated makepy file into my code ?
In generaly, you just need to generate the file and do nothing else. At
runtime, Python will see these generated files and automatically use them.
I don't know how that will go with your type library though.
Mark
Mark Hammond <mh******@skipp inet.com.au> wrote in message news:<bh******* ****@arachne.la byrinth.net.au> ... Matt Smith wrote: Mark Hammond <mh******@skipp inet.com.au> wrote in message news:<bh******* ****@arachne.la byrinth.net.au> ...
My problem is now this, when i go to makepy tool in pythonwin, it does not see/recognise the type library file I want it to convert. Is there anyway to add the file to the list of .tlb files it does does?
These type libraries are in the registry. You may be able to pass the filename on the commandline to makepy.
p.s. How do I include the generated makepy file into my code ?
In generaly, you just need to generate the file and do nothing else. At runtime, Python will see these generated files and automatically use them.
I don't know how that will go with your type library though.
Mark
Hi again,
I had to register the .tlb file (as it didnt do it automatically at
installation [don't know why]) using a vb .tlb registration script,
which worked fine and now I have a lovily makepy.py generated file for
my .tlb file.
My problem is now this, When I try to run the file (in pythonwins
interactive window) using the code:
from win32com.client include gencache
gencache.Ensure Module('{AF6849 23-D245-11D3-8DE8-00A024ACAB85x0x 1x0}',
0, 1, 0)
pythonwin returns the error:
ImportError: No module named
gen_py.AF684923-D245-11D3-8DE8-00A024ACAB85x0x 1x0
I have tested it with other makepy.py generated files and they all
return the same error. Do I need to tell python where to find these
makepy files? or is there some other reason as to why it does not want
to use ANY makepy.py files
thanks for all the help,
matt.
hi again, sorry about all these updates but cant remember what I
posted in the last message and google ahsnt updated yet :/.
My current probelm is that I have generated a makepy file and then run
ensureModule on it to ensure early binding. However when I came to run
Dispatch it still ran with late binding :(. If i ran the script with
ensureDispatch would that help (instead of normal client.Dispatch that
is)
thanks again,
matt.
p.s. forgot to post the .tlb register website address here it is: http://www.vbaccelerator.com/codelib/tlb/vbregtlb.htm This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Smith |
last post by:
Hi, all.
Just a quick question, when setting a COM process to read a value from
a pre-defined register index, I think, I have to change the variable
that the value will be returned to (as I have to do for the same
function in perl), into a VARIANT, However when i run the variant
code....
'serialIndex = win32com.client.pythoncom.VT_VARIANT'
|
by: C. N. Sridhar |
last post by:
Hi,
I'm writing a wrapper to a win32 dll in C#. I need to call
a method in DLL which has a Variant type reference
parameter.
How to marshal variant type from win32 (unmanaged code)
to C# (managed code)?
I tried using Marshal.GetObjectForNativeVariant(), but of
no use.
|
by: MLH |
last post by:
A97 HELP shows the proper syntax for using Nz as
Nz(variant)
I'm wondering what to expect from potential past
misuse I've made. For example, consider the following...
Private Sub Command0_Click()
Dim a As Long, b As String
b = Nz(a, "")
MsgBox b
End Sub
|
by: Jon Davis |
last post by:
Hi guys!
Just wanted to let you all know that I created a Variant structure, inspired by the old VB6 days. This is written in C#, but you can build a CLR/.NET class library assembly and reference it to your liking.
' Here is an example of use:
' start with a string of "1"
Dim da As Variant = new Variant("1")
' add an integer of 2, becomes 3
|
by: .::alex::. |
last post by:
Hello,
Maybe you already guess the problem.
I have a COM with a method in a Interface like that:
HRESULT GetArray(VARIANT *pVal);
so this method will return a VARIANT. This VARIANT contains a SafeArray - 1
dimension.
| |
by: Heike |
last post by:
Hello everybody,
I have a Problem with C Sharp. I have to use external functions in DLLs.
This Functions are written in Visual C++ 6 like this:
int (__stdcall *GetGlobalValue) (VARIANT Appl, VARIANT &vRetVal);
Now for the first time I want to use C Sharp and I find some examples to use
Functions in extarnal DLLs, but I don't know how to cast the
Variant-Paramters in C Sharp.
|
by: MLH |
last post by:
The following procedures found at
http://ffdba.com/downloads/Send_Mail_With_Outlook_Express.htm
are meant to work together in harmony to effect eMail sends via OE.
The last procedure (FN SplitB) fails on its last line which is meant
to assign the value of SplitB (a variant) the value of aSplit (an
array dim'd as variant). That fails due to Type Mismatch. Anyone
know how to get around this?
Private Type MapiRecip
Reserved As Long
|
by: morten |
last post by:
When i compile this code in VC71 or VC80 i get the following errors:
The code is copy/paste from the boost.org tutorial. Please help!
error C2039: 'begin' : is not a member of 'boost::variant<T0_,T1>'
with
Test2.cpp(47): error C2039: 'end' : is not a member of
'boost::variant<T0_,T1>'
with
|
by: captainc |
last post by:
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...
|
by: jainchar |
last post by:
hello
I am creating a VARIANT that stores a integer value of variable but variable is not initialize.In my code the variable are "r" and"c" where r and c are the value of row and column of a table.I am using it in a split function of Cell class of my project.The code for which i create for VARIANT is as follows and syntax of Split function are as follows.Please help me how i use this variant in my code.
The code for variant is
VARIANT v;...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |