473,396 Members | 1,940 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,396 software developers and data experts.

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 3650

"Gilles Lenfant" <gl******@NOSPAM.bigfoot.com> wrote in message
news:bl**********@biggoron.nerim.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.RegQueryInfoKey( 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(kName,
guid) )
(num2, val2, work2) = wi.RegQueryInfoKey(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.RegQueryValue( pyj, svers)

else:
valkey = wi.RegQueryValue( 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
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...
16
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,...
3
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...
1
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...
6
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...
2
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. ...
16
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 |...
1
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...
15
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
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,...

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.