Python win32api.GetWindowLong() Examples

The following are 9 code examples of win32api.GetWindowLong(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module win32api , or try the search function .
Example #1
Source File: hierlist.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def SetStyle(self, newStyle):
		hwnd = self.listControl.GetSafeHwnd()
		style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE);
		win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style | newStyle) ) 
Example #2
Source File: regedit.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OnInitialUpdate(self):
		hwnd = self._obj_.GetSafeHwnd()
		style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE);
		win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style & ~commctrl.LVS_TYPEMASK) | commctrl.LVS_REPORT); 

		itemDetails = (commctrl.LVCFMT_LEFT, 100, "Name", 0)
		self.InsertColumn(0, itemDetails)
		itemDetails = (commctrl.LVCFMT_LEFT, 500, "Data", 0)
		self.InsertColumn(1, itemDetails) 
Example #3
Source File: regedit.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def EditValue(self, item):
		# Edit the current value
		class EditDialog(dialog.Dialog):
			def __init__(self, item):
				self.item = item
				dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT)
			def OnInitDialog(self):
				self.SetWindowText("Enter new value")
				self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW)
				self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
				# Modify the edit windows style
				style = win32api.GetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE)
				style = style & (~win32con.ES_WANTRETURN)
				win32api.SetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style)
				self.edit.SetWindowText(str(self.item))
				self.edit.SetSel(-1)
				return dialog.Dialog.OnInitDialog(self)
			def OnDestroy(self,msg):
				self.newvalue = self.edit.GetWindowText()
		
		try:
			index = self.GetNextItem(-1, commctrl.LVNI_SELECTED)
		except win32ui.error:
			return # No item selected.

		if index==0:
			keyVal = ""
		else:
			keyVal = self.GetItemText(index,0)
		# Query for a new value.
		try:
			newVal = self.GetItemsCurrentValue(item, keyVal)
		except TypeError, details:
			win32ui.MessageBox(details)
			return 
Example #4
Source File: winguiauto.py    From pyautotrade_tdx with GNU General Public License v2.0 5 votes vote down vote up
def _sendNotifyMessage(hwnd, nofifyMessage):
    '''Send a notify message to a control.'''
    win32gui.SendMessage(win32gui.GetParent(hwnd),
                         win32con.WM_COMMAND,
                         _buildWinLong(nofifyMessage,
                                       win32api.GetWindowLong(hwnd,
                                                              win32con.GWL_ID)),
                         hwnd) 
Example #5
Source File: winguiauto.py    From PyAutoTrading with GNU General Public License v2.0 5 votes vote down vote up
def _sendNotifyMessage(hwnd, nofifyMessage):
    '''Send a notify message to a control.'''
    win32gui.SendMessage(win32gui.GetParent(hwnd),
                         win32con.WM_COMMAND,
                         _buildWinLong(nofifyMessage,
                                       win32api.GetWindowLong(hwnd,
                                                              win32con.GWL_ID)),
                         hwnd) 
Example #6
Source File: Demo_Save_Windows_As_Images.py    From PySimpleGUI with GNU Lesser General Public License v3.0 5 votes vote down vote up
def get_window_list():
    titles = []
    t = []
    pidList = [(p.pid, p.name()) for p in psutil.process_iter()]

    def enumWindowsProc(hwnd, lParam):
        """ append window titles which match a pid """
        if (lParam is None) or ((lParam is not None) and (win32process.GetWindowThreadProcessId(hwnd)[1] == lParam)):
            text = win32gui.GetWindowText(hwnd)
            if text:
                wStyle = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE)
                if wStyle & win32con.WS_VISIBLE:
                    t.append("%s" % (text))
                    return

    def enumProcWnds(pid=None):
        win32gui.EnumWindows(enumWindowsProc, pid)

    for pid, pName in pidList:
        enumProcWnds(pid)
        if t:
            for title in t:
                titles.append("('{0}', '{1}')".format(pName, title))
            t = []
    titles = sorted(titles, key=lambda x: x[0].lower())
    return titles 
Example #7
Source File: winguiauto.py    From pyautotrade_tdx with GNU General Public License v2.0 5 votes vote down vote up
def _sendNotifyMessage(hwnd, nofifyMessage):
    '''Send a notify message to a control.'''
    win32gui.SendMessage(win32gui.GetParent(hwnd),
                         win32con.WM_COMMAND,
                         _buildWinLong(nofifyMessage,
                                       win32api.GetWindowLong(hwnd,
                                                              win32con.GWL_ID)),
                         hwnd) 
Example #8
Source File: winguiauto.py    From pyAutoTrading with GNU General Public License v2.0 5 votes vote down vote up
def _sendNotifyMessage(hwnd, nofifyMessage):
    """Send a notify message to a control."""
    win32gui.SendMessage(win32gui.GetParent(hwnd),
                         win32con.WM_COMMAND,
                         _buildWinLong(nofifyMessage,
                                       win32api.GetWindowLong(hwnd,
                                                              win32con.GWL_ID)),
                         hwnd) 
Example #9
Source File: win32_helper.py    From pySPM with Apache License 2.0 5 votes vote down vote up
def _sendNotifyMessage(hwnd, nofifyMessage):
    '''Send a notify message to a control.'''
    win32gui.SendMessage(win32gui.GetParent(hwnd),
                         win32con.WM_COMMAND,
                         _buildWinLong(nofifyMessage,
                                       win32api.GetWindowLong(hwnd,
                                                              win32con.GWL_ID)),
                         hwnd)