Questions tagged [win32con]

This is a certain module of Python that contains constants related to Win32 programming. It is not part of the Python 2.6 release, but should be part of the download of the pywin32 project, that gives access to most of Microsoft Windows Win32 API. This gives a developer the ability to create and use COM objects, and the Pythonwin environment, in Python programming.

The guide to variables provided in win2com module can be found here: https://www.programcreek.com/python/index/475/win32con

26 questions
2
votes
0 answers

How to hide a program with the ability to open it again?

I have a console application written in python using pyinstaller. I need the program window to be hidden (if the user specified it), but at the same time it continued to work in the background, and when you click on the icon again, the previously…
Ne1zvestnyj
  • 1,391
  • 1
  • 7
  • 25
2
votes
1 answer

How to add "Microsoft Excel Object" VBA code to Excel file using Python

I have a long script written in VBA, in Excel. I'm using Python to create another Excel file, and I want to embed the script in that file. I have been able to add a macro as "Module1" in Excel, but not as a "Microsoft Excel Object" associated with a…
SuperScienceGrl
  • 593
  • 4
  • 19
2
votes
1 answer

How to change cursor image in Python

I want to change my cursor image (everywhere on screen) when my program is running. I try to load image with win32gui and then use win32api to change cursor image, but something is wrong and my cursor doesn't show up My cursor image is…
ostry0728
  • 111
  • 2
  • 8
1
vote
1 answer

winxpgui.SetLayeredWindowAttributes throwing error pywintypes.error: (87, 'SetLayeredWindowAttributes', 'The parameter is incorrect.')

While I am trying to make a window's background transparent using win32gui, I am using following code. hwnd = win32gui.FindWindow(None, "My App Name") win32gui.SetWindowLong (hwnd, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (hwnd,…
KOUSIK MANDAL
  • 2,002
  • 1
  • 21
  • 46
1
vote
0 answers

The pywin32 libraries (win32gui, win32ui, win32con) show "unresolved-import"

I have downloaded Python 3.7 and 3.9 (both 64 bit) as well as VS Code to replicate the following code: https://www.youtube.com/watch?v=WymCpVUPWQ4&t=1291s However, when installing "pywin32" and then importing the packages to the code, I get…
Ignacio
  • 11
  • 1
1
vote
0 answers

how to verify if the group is sucessfully added for a folder in python

I am using below to add a group name in security tab for a folder through and its getting added. However in python how I can verify if the group is added successfully. dacl.AddAccessAllowedAce(win32security.ACL_REVISION,win32con.GENERIC_WRITE,…
goe
  • 337
  • 2
  • 14
1
vote
0 answers

How do I change the cursor size using python?

How do you change the size of the cursor using python? I spent a while trying to find how you could do it in Python, and I heard about win32. I tried to code a script that would only change the cursor .cur file, not resize it, but it didn't change…
1
vote
0 answers

why i got an error when i import winshell module?

here is my code: import os try: import winshell except: os.system('python -m pip install --upgrade pip') os.system('pip install pywin32') os.system('pip install winshell') import winshell print('hello world') i want to import…
0
votes
1 answer

sending a keyboard input to a game running in the background

I want to send keyboard input to a game running in the background (game: Knight Online) but the win32api.SendMessage, PostMessage methods are not working. how can I do that I tried the code in this link code: from time import sleep import…
Emre Oz
  • 45
  • 5
0
votes
1 answer

how can I install win32con?

I'm trying to use winshell to generate a url shortcut file, so I did: pip installed winshell However on line 30 of the winshell.py file it requires the module win32con : my understanding is that win32con is apart of pywin32, which is already…
0
votes
1 answer

How to change the mouse movement speed with win32api (mouseeventf_move)

So I basically have a python script set up that moves the mouse in a game to specific x and y coordinates, my question now is how can I make it so the mouse is moving slower, yet still smooth from point a to point b? I tried the sleep command but…
JorgTV
  • 39
  • 9
0
votes
0 answers

send mouse and keyboard events into active window

I have the code below, which allows me to send keyboard and mouse events and it works for me with any game or app. I can send a keypress and the game will accept it not like other libraries (pyautogui, keyboard, pyinpuy, etc., for some reason not…
Akali DZ
  • 47
  • 6
0
votes
0 answers

Unable to send keys to inactive window using win32api.PostMessage

I am using the below code to send keys to an inactive window using python on windows: import win32gui import win32con import win32api import time import win32com.client def send_key(hwnd, key): win32api.PostMessage(hwnd, win32con.WM_KEYDOWN,…
0
votes
1 answer

What is the purpose of 'win32con.SRCCOPY'?

In the code of answer of this question, there is a line cDC.BitBlt((0,0),(w, h) , dcObj, (0,0), win32con.SRCCOPY). Here what is the purpose of win32con.SRCCOPY? I have looked for documentation everywhere, but I can't find anything. From here I take…
user541396
  • 163
  • 1
  • 9
0
votes
1 answer

Python wheel mouse with win32con

Please tell me how to solve my little problem. I am writing automation for the android emulator, where I use the win32api libraries to emulate actions in an inactive program window. And at some point I need to send the mouse scroll to the emulator.…
1
2