pywin32

win32: check if window is minimized

邮差的信 提交于 2019-12-10 13:48:58
问题 How can one check whether a window is minimized using the win32 api? 回答1: use the IsIconic function. 回答2: Use the IsIconic Windows API. 回答3: Try GetWindowLong and test for the WS_MINIMIZE style: LONG lStyles = GetWindowLong(GWL_STYLE); if( lStyles & WS_MINIMIZE ) ATLTRACE(_T("minimized")); else ATLTRACE(_T("not minimized")); You can also query for GWL_EXSTYLES 来源: https://stackoverflow.com/questions/4309282/win32-check-if-window-is-minimized

Return a list of all files from the selected Explorer Window with pywin32

会有一股神秘感。 提交于 2019-12-10 12:19:17
问题 I'm currently on Python 3 using the Win32 api. For window inspection, I'm using the Microsoft Inspect Tool. Currently, I have the following code that enumerates through all the windows: def getSelectedFile(): def callback(handle, hwnds): print(str(handle) + " - class name: " + win32gui.GetClassName(handle) + "-- name: " + win32gui.GetWindowText(handle)) return True hwnd = win32gui.GetForegroundWindow() if hwnd: if win32gui.GetClassName(hwnd) == 'CabinetWClass': # this is the main explorer

Python Windows Service - Not responding to start/stop from built exe (but works in python)

╄→гoц情女王★ 提交于 2019-12-10 12:04:38
问题 This is my first time building a windows service, and I thought I had it working. Installing as python aservice.py install works fine, and responds accordingly. However, since the machines that I will need to install this service on, will not have python installed, I wanted to build it into an executable, that can install the service. Although the executable is successful in installing the service, When I try to start it either manually, or through net start or sc start The service does not

Heavily confused by win32api + COM and an answer from SO

本秂侑毒 提交于 2019-12-10 11:26:16
问题 From my other question here on SO, I asked how to retrieve the current playing song from Windows Media Player and Zune, I got an answer from a c++ dev who gave me an explanation of how I would do this for WMP. However, I am no C++ dev, nor am I very experienced with the pywin32 library. And on-top of all that, the documentation on all this (especially concerning WMP) is horrible . Therefor, I need your help understanding how I would do the following in Python. Source I have working code in C+

How can I debug SendKeysCtypes on (win7 64bit, py2.7) further?

南笙酒味 提交于 2019-12-10 11:23:17
问题 Im trying to get SendKeysCtypes working on py2.7 and win7 64bit . Here is src Problem: Run SendKeysCtypes.py and nothing happens. Tests should open notepad and write some text. The problem code is this: def GetInput(self): "Build the INPUT structure for the action" actions = 1 # if both up and down if self.up and self.down: actions = 2 inputs = (INPUT * actions)() vk, scan, flags = self._get_key_info() for inp in inputs: inp.type = INPUT_KEYBOARD inp._.ki.wVk = vk inp._.ki.wScan = scan inp._

Python library to open existing .xlsx workbook with charts [closed]

与世无争的帅哥 提交于 2019-12-10 11:05:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I have to read a certain .xlsx file (file1.xlsx), pull data from another .csv files (file2.csv) and write the processed data into the original file (file1.xlsx) along with some charts. The file has existing charts, I have looked into openpyxl, xlswriter, xlsread, and other python libraries. It seems openpyxl is

PyWin32 (226) and virtual environments

不问归期 提交于 2019-12-10 10:39:49
问题 [PyPI]: pywin32 226 has been released on 20191110 . It works on most of the Python installations ( e.g. works on the official versions downloaded from Python), but not on virtual environments ( e.g. created with VirtualEnv ( v16.7.7 ), and (based on further research) Python 's venv ). I used Python v3.8 .0 and v3.7 .3 as lab rats. Here's the output for the former: [cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q058805040]> "e:\Work\Dev\VEnvs\py_064_03.08.00_test0\Scripts\python.exe" -c "import

Reading Custom Document properties in MS Word File using python

纵然是瞬间 提交于 2019-12-10 09:30:21
问题 How can I get the document properties of a MS-Word 2010 Document using python? with document properties i mean those who can be added or modified under FILE -> Info-> Properties-> Advanced properties (In MS-WORD 2010) I'm using python 2.7 on windows764bit and the corresponding pywin32com version to access the doc-file... I found the CustomProperty -object with the methods value and name witch seem to be the right thing for my purpose (http://msdn.microsoft.com/en-us/library/bb257518%28v

Problem installing pywin32

徘徊边缘 提交于 2019-12-10 03:46:29
问题 I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ? 回答1: From the pywin32 README If the installation process informs you that Python is not found in the registry, it almost certainly means you have downloaded the wrong version - either for the wrong version of

Pywin32 save .docx as pdf

我的未来我决定 提交于 2019-12-10 03:15:01
问题 I'm using Word 2013 to automatically create a report as a docx and then save it as a pdf format. But when I call the function SaveAs2(), the script pop out the "save as" windows and throws this exception : (-2147352567, 'Exception occurred.', (0, u'Microsoft Word', u'Command failed', u'wdmain11.chm', 36966, -2146824090), None) Here is my code to open and to save as a new file: self.path = os.path.abspath(path) self.wordApp = win32.Dispatch('Word.Application') #create a word application object