473,657 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python on Win32 and MFC

Hi,

I bought and read most of (excellent) Mark Hammond's book, Python
programming on Win32.
I started to make some sophisticated "hello world" app using win32ui (...)
but I need some more information to make the bridge between this book and
the MFC (black hole for me) in depth.

Any advise on good reading, and some python examples ?

Many thanks in advance.

--Gilles

Jul 18 '05 #1
1 3653

"Gilles Lenfant" <gl******@NOSPA M.bigfoot.com> wrote in message
news:bl******** **@biggoron.ner im.net...
Hi,

I bought and read most of (excellent) Mark Hammond's book, Python
programming on Win32.
I started to make some sophisticated "hello world" app using win32ui (...)
but I need some more information to make the bridge between this book and
the MFC (black hole for me) in depth.

Any advise on good reading, and some python examples ?

Many thanks in advance.

--Gilles


here's an example showing how to use the Registry API in
ActivePython.

I have other scripts that enum windows, use Menu objects, and do
IPC using SendMessage.

hth,
Mark Pryor

####### begin script ############
#!/usr/bin/python
'''
author: mark pryor
keywords: registry enum license typelib
description: scriptlet to enum a subkey collection
date: 11/8/02 3:03PM
'''

import os, sys
import win32api as wi
import win32con as wc
import string as st
#exercise to enumerate a subkey collection
# try this for the Licenses key, then the TypeLib key
kName = "Licenses"
kName = "TypeLib"

# get a handle
pyk = wi.RegOpenKey( wc.HKEY_CLASSES _ROOT, kName)

# get key info, num1 has the key count
( num1, vals, works) = wi.RegQueryInfo Key( pyk )
print num1, vals, works
nt = 0
guid = wi.RegEnumKey( pyk, nt )
nt = nt + 1
#
done = 0
for nt in range(num1):
guid = wi.RegEnumKey( pyk, nt)
svers = ''
if kName == "TypeLib":
'''
for TypeLibs we need to step down to the version key and
read the help string (default value)
'''
pyj = wi.RegOpenKey( wc.HKEY_CLASSES _ROOT, os.path.join(kN ame,
guid) )
(num2, val2, work2) = wi.RegQueryInfo Key(pyj)

if num2 > 0:
# we are ingnoring multi versions, like Ado (2.1, 2.5, 2.7, etc)
svers = wi.RegEnumKey( pyj, 0)
valkey = wi.RegQueryValu e( pyj, svers)

else:
valkey = wi.RegQueryValu e( pyk, guid)

print guid, svers, valkey
nt = nt + 1

pyk.Close()
sys.exit()
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2089
by: Phil Schmidt | last post by:
I'm attempting to follow the instructions at http://sebsauvage.net/python/mingw.html, without luck. I have Python 2.3, MinGW 3.2.3, ans SWIG 1.3.19. I get an export error on "initexample" when attempting the example. Do I need some extra switches to get SWIG to create that function? Or is it something else? Here's my example build:
16
1937
by: Pjer Holton | last post by:
If I were to build a Windows application that is a true standard Windows application in every conceivable way and that adheres to the MS Windows standards as much as possible (installation, GUI, printing, registry, RTF etc.), and if portability to other platforms is only a minor concern, ... would Python be a good choice? What packages, libraries and modules would you recommend for GUI, installation, data storage etc.? Thank you very...
3
2743
by: Nicolas Lehuen | last post by:
Hi, Is it me, or does anyone else get significantly better pystone results under Cygwin versus the standard Win32 build ? CYGWIN 1.5.6 + python 2.3.3-1 : $ time python /usr/lib/python2.3/hotshot/stones.py Pystone(1.1) time for 50000 passes = 2.344 This machine benchmarks at 21331.1 pystones/second 850004 function calls in 4.371 CPU seconds
1
2190
by: Brian Beck | last post by:
As far as I can tell, both maintainers of the Windows builds of Python-LDAP haven't updated in about a year. This doesn't exactly make the builds ancient or obsolete, but it would be nice to start fresh with the latest version. I've tried without success in building it myself. The hardest part is simply that Python-LDAP is dependent on at LEAST two other projects -- OpenLDAP and Cyrus SASL. This increases the difficulty three-fold. ...
6
2362
by: Fuzzyman | last post by:
I'll post this to the image-sig as well, but the audience is a bit wider here. I've just upgraded to Python 2.4. I've installed the free microsoft optimising compiler and hacked distutils to use it - following the instructiosn from http://www.vrplumber.com/programming/mstoolkit/ . It works great and I've built a windows installer for PyCrypto 2.0. I'm attempting to compile PIL for python 2.4. The build instructions for windows say :
2
2370
by: Christopher Subich | last post by:
From the documentation, it looks like DParser-python will do what I need, but I'm having trouble getting it installed properly. I'm using a win32 environment, with official 2.4 Python binaries. The official DParser for Python win32 binaries (staff.washington.edu/sabbey/dy_parser) fail, saying that I don't have Python 2.3 installed. :/ Compling the source on cygwin (with -mno-cygwin) succeeds in compilation, but then attempting to...
16
5202
by: PyDenis | last post by:
Today, I found strange error while using py2exe: 1. I wrote simple program and save as 1.py: import win32ui import win32con win32ui.MessageBox('Test messageBox.' , 'Test', win32con.MB_OK | win32con.MB_TOPMOST ) 2. I create 1_setup.py file for py2exe:
1
2142
by: Srijit Kumar Bhadra | last post by:
I have browsed the following links 1) http://peak.telecommunity.com/DevCenter/EasyInstall 2) When Python *Eggs* better than Python *distutils*?? What's Eggs? (http://tinyurl.com/m8dyd) But I am still not clear what to do with an .egg file. For example, if I have a basic Python installation (http://www.python.org/ftp/python/2.4.3/python-2.4.3.msi) what should I do with a typical .egg file (e.g....
15
2163
by: lixinyi.23 | last post by:
Hi! I'm currently working on a scientific computation software built in python. What I want to implement is a Matlab style command window <-> workspace interaction. For example, you type 'a=1' in the command window, and you see a list item named 'a' in the workspace. You double click the icon of the item, and you see its value. You can
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
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...
0
8613
tracyyun
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...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
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
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.