I met an problem here.
I could successfully create an dialog and add an button by code below,
because I know the constant "128" is the control "button" by exsiting example
but I do not know which one can be used for "checkbox" or "radiobutton"?
import win32ui
import win32api
import win32con
from pywin.mfc import dialog
# Window frame and title
dlg = [ [title, (0, 0, 300, 392), style, None, (8, "MS Sans Serif")], ]
dlg.append([128, u"Output", IDC_BTN_OUTPUT, (142,56,50,14), win32con.BS_DEFPUSHBUTTON])
According to the source code and the documentation, the dialog template here is a list whose first item is a PyDLGTEMPLATE
instance followed by a series of PyDLGITEMTEMPLATE
instances.
The documentation says this about the first member of the PyDLGITEMTEMPALTE
structure:
[0] string/int : windowClass
The window class. If not a string, it must be in integer defining one of the built-in Windows controls. If a string, it must be a pre-registered windows class name, a built-in class, or the CLSID of an OLE controls. Built-in classes include:
Control Type String Class Name Check Box Button Combo Box ComboBox Command Button Button Header SysHeader32 Label Static List Box ListBox SysListView32 Option Button Button Tab SysTabControl32 Text Box Edit RICHEDIT Tool Bar ToolbarWindow32 Tool Tips tooltips_class32 tooltips_class Tree View SysTreeView32
The built-in windows controls are:
Integer Value Window Type 0x0080 Button 0x0081 Edit 0x0082 Static 0x0083 List box 0x0084 Scroll bar 0x0085 Combo box
So while you could use the integer constant 0x85 (or 133 decimal), I'd strongly recommend you use the string class name 'ComboBox'
instead. These string names are, unsurprisingly, the same as the built-in Windows class names documented on MSDN.