winapi

Get bytes/char* from hIcon/hBitmap

▼魔方 西西 提交于 2021-02-08 06:10:24
问题 I'm working on a C/S application, Server in C++ and Client in C#, I need to send some information about current running processes and related icon. I get icon file thanks to EnumWindows with this code inside the callback... // Get the window icon HICON hIcon = (HICON)(::SendMessageW(hWnd, WM_GETICON, ICON_SMALL, 0)); if (hIcon == 0) { // Alternative method. Get from the window class hIcon = reinterpret_cast<HICON>(::GetClassLongPtrW(hWnd, GCLP_HICONSM)); } // Alternative: get the first icon

Get bytes/char* from hIcon/hBitmap

两盒软妹~` 提交于 2021-02-08 06:04:00
问题 I'm working on a C/S application, Server in C++ and Client in C#, I need to send some information about current running processes and related icon. I get icon file thanks to EnumWindows with this code inside the callback... // Get the window icon HICON hIcon = (HICON)(::SendMessageW(hWnd, WM_GETICON, ICON_SMALL, 0)); if (hIcon == 0) { // Alternative method. Get from the window class hIcon = reinterpret_cast<HICON>(::GetClassLongPtrW(hWnd, GCLP_HICONSM)); } // Alternative: get the first icon

Windows XP WinAPI support for CheckBox controls

坚强是说给别人听的谎言 提交于 2021-02-08 05:40:22
问题 I was having a look at the documentation for BM_GETCHECK and it seems that this functionality is only supported on Windows Vista and above. That is, this is not a supported message in Windows XP. A quick search online doesn't immediately yield an alternative way of getting the control state. Several other messages (this for example) that I would also expect to work on Windows XP are reported to not be supported. Does anyone have any insight into this? How does one generally handle Windows XP

python+win32: detect window drag

99封情书 提交于 2021-02-08 05:39:15
问题 Is there a way to detect when a window that doesn't belong to my application is being dragged in windows using python/pywin32? I want to set it up so that when I drag a window whose title matches a pattern near the desktop edge, it snaps to the edge when the mouse is let go. I could write code to snap all windows with that title to the desktop whenever the mouse is released, but I want to only move the particular window that was being dragged. 回答1: So far the only possible solution I see is

How to simulate desktop click at (x,y) position with python?

无人久伴 提交于 2021-02-08 05:23:51
问题 I'm trying to click somewhere on the desktop, I'm using python with win32 api, I'm using python 32 bit but my computer is a 64 bit computer. I believe the lParam variable isn't holding the value I'm expecting, and I'm still a bit confused about this variable itself, lets say I import it from wintypes can anyone tell me how to use it? Why does my function below not work? I have a function as following, this doesn't seem to work: def clickDesktop(x=0, y=0): # Get handle to desktop window

GetWindowText hangs on Windows 10

送分小仙女□ 提交于 2021-02-08 05:16:02
问题 TL;DR: Did GetWindowText win32 api change behavior on windows 10? I have some code that loops through all windows on the desktop to find a window where the title contains some text. When this code hits a window named "" with class "URL Moniker Notification Window" it hangs on GetWindowText. GetWindowText is trying to send a message, my guess is WM_GETTEXT. This window is part of the exe "SearchUI.exe", the process is suspended and can't process messages. When reading: https://blogs.msdn

GetWindowText hangs on Windows 10

喜夏-厌秋 提交于 2021-02-08 05:15:40
问题 TL;DR: Did GetWindowText win32 api change behavior on windows 10? I have some code that loops through all windows on the desktop to find a window where the title contains some text. When this code hits a window named "" with class "URL Moniker Notification Window" it hangs on GetWindowText. GetWindowText is trying to send a message, my guess is WM_GETTEXT. This window is part of the exe "SearchUI.exe", the process is suspended and can't process messages. When reading: https://blogs.msdn

How to play a .wav file from a particular point (e.g. 30 seconds in)

寵の児 提交于 2021-02-08 05:12:42
问题 I want to be able to begin playing a song at a particular time (for example, 30 seconds into the song) in my program which replicates a radio station, where when you change the channel and the song is already playing or almost finished. Currently I use PlaySound and have my 26 songs saved as wav files and as resources within the program. I have seen mciSendString as an option however I do not understand how i could manage to get it to work when coding with Windows API and C++. Here is my

How to play a .wav file from a particular point (e.g. 30 seconds in)

夙愿已清 提交于 2021-02-08 05:09:11
问题 I want to be able to begin playing a song at a particular time (for example, 30 seconds into the song) in my program which replicates a radio station, where when you change the channel and the song is already playing or almost finished. Currently I use PlaySound and have my 26 songs saved as wav files and as resources within the program. I have seen mciSendString as an option however I do not understand how i could manage to get it to work when coding with Windows API and C++. Here is my

How can I get the name of any process having a visible window - WinAPI?

余生颓废 提交于 2021-02-08 04:31:53
问题 I'm trying to get the name of processes which have a visible window. For example, if I have Chrome opened, I would like to get the string "chrome.exe", but I only get the init value "unknown" using the code below. I read around it could be an access rights problem, can you suggest me how to change them in order to get the name of processes? DWORD idProc = 0; //pointer to the process which created the window DWORD idThread = GetWindowThreadProcessId(Wnd->get_handle(), &idProc); Wnd->set_pid