win32gui

WM_GETTEXT returns text separated with nulls

十年热恋 提交于 2019-12-13 07:31:59
问题 import time import win32gui import win32con while True: time.sleep(1) buf = win32gui.PyMakeBuffer(255) window = win32gui.GetForegroundWindow() title = win32gui.GetWindowText(window) control = win32gui.FindWindowEx(window, 0, 'Edit', None) length = win32gui.SendMessage(control, win32con.WM_GETTEXT, 255, buf) result = buf[:length] print('Title: ', win32gui.GetWindowText(window)) print(str(buf[:length*2], "UTF_8") Why it returns string separated with nulls? When I've tried just buff[:length] I

Getting select all(ctrl-a) to work on a CEdit control

ε祈祈猫儿з 提交于 2019-12-13 06:24:38
问题 I am trying to implement select all(via ctrl-a) in a CEdit control. I'm doing this by making a class which inherits CEdit and adding a handler for WM_KEYDOWN like this: void CEditExtended::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ) { if((nChar == 0x41) && (GetKeyState(VK_CONTROL) & 0x8000) != 0)) SetSel(0, -1); CEdit::OnKeyDown(nChar, nRepCnt, nFlags); } Looking around on the web, this should work, but it never registers both ctrl and a at the same time, either one or the other. 回答1:

Gif is flickering

帅比萌擦擦* 提交于 2019-12-11 18:07:18
问题 I'm making a window in c++win32 api. And I'm showing gif using gdi+. And this gif is loaded from resource and making IStream*. But when I used not path to gif, and used IStream for creating GDIPlus::Image, and showed it, the gif started to flick. P.S. The window is SW_SHOWMAXIMIZED I have tried to return 1 in WM_ERASEBKGND message, making NULL WNDCLASSEX.hbrBackGround, use InvalidateRect(hwnd,&rc, FALSE) P.S. rc is RECT rc; GetWindowRect(hwnd,&rc); But it didn't worked; case WM_TIMER: if

How to stop a warning dialog from halting execution of a Python program that's controlling it?

孤人 提交于 2019-12-11 11:58:26
问题 Using Win32GUI and Watsup, I'm writing a bit of Python code to automate a search across a database that is accessed through a program that doesn't come with an interface for it. As such, I can take a string from a list and then input it into the search box and press 'lookup'. However, when the search returns more than 1000 results, the program throws a warning dialog --which is simply a notification of the number of results--which halts the execution of the Python code. I can't get the code

How to change background color of SysDateTimePick32 or CDateTimeCtrl?

感情迁移 提交于 2019-12-11 11:32:57
问题 I seem not to be able to change the background color of a SysDateTimePick32 control (white in this case): in my Win32/MFC application. I first tried overriding OnCtlColor notification message in the parent window, which wasn't even called. I then tried a subclassing approach described here, which was called alright but the control did not change visually. (I did my tests on Windows 8.1 machine.) So does anyone have idea how to do it? PS. I need this to work on Windows XP and up. 回答1: I'm not

Message Box Error : foreign import unsafe

天大地大妈咪最大 提交于 2019-12-10 17:08:33
问题 import Graphics.Win32 import System.Win32.DLL import Control.Exception (bracket) import Foreign import System.Exit main :: IO () main = do mainInstance <- getModuleHandle Nothing hwnd <- createWindow_ 200 200 wndProc mainInstance createButton_ hwnd mainInstance messagePump hwnd wndProc :: HWND -> WindowMessage -> WPARAM -> LPARAM -> IO LRESULT wndProc hwnd wmsg wParam lParam | wmsg == wM_DESTROY = do sendMessage hwnd wM_QUIT 1 0 return 0 | wmsg == wM_COMMAND && wParam == 1 = do messageBox

Win32 GDI Drawing a circle?

允我心安 提交于 2019-12-10 16:07:53
问题 I am trying to draw a circle and I am currently using the Ellipse() function. I have the starting mouse coordinates - x1 and y1 and the ending coordinates x2 and y2. As you can see, I am forcing the y2(temp_shape.bottom) to be = y1+(x2-x1). This doesn't work as intended. I know the calculation is completely wrong but any ideas on what is right? Code Below. case WM_PAINT: { hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rect; GetClientRect(hWnd, &rect); HDC backbuffDC

Create Win32 Window without blocking the current UI

删除回忆录丶 提交于 2019-12-10 12:29:16
问题 I have an WPF application, and I want to create new Win32 window (cause it's window written in C++) on button click. And, I have a problem. If I navigate the cursor to the button, there is the tooltip is shown. And, after clicking on the button, tooltip has no time to dissapear. How can I prevent this situation? Thanks 回答1: In case with tooltips' dissapearing you can override the tooltip's parent resource to disable animation , like this: <Page xmlns="http://schemas.microsoft.com/winfx/2006

How to setup multiple radio button groups for proper tab-order and keyboard interaction (WIN32)?

余生长醉 提交于 2019-12-10 03:54:22
问题 First of all this is not MFC. Here is a cropped version of the GUI I have been working on: As you can see I have (attempted) to create two different groups, Icon and Button, using the code: index->hAddT.hwndIndex[2] = CreateWindowEx(NULL,L"BUTTON",L"Icon",WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 200,135,120,170,WINDOWHANDLE,(HMENU)IDC_RADIOGROUP,(HINSTANCE)GetWindowLong(WINDOWHANDLE,GWL_HINSTANCE),NULL); The issue I have, and what you can probably see, is that there is only one radio button for

What desktop does Metro stuff run in?

家住魔仙堡 提交于 2019-12-09 15:53:55
问题 Just curious, from a standpoint of WinAPI developer, what desktop do Metro apps run in? This stuff: 回答1: I didn't know that it would be such a secret... so I had to do some investigating and here's what I found: First off, to answer my original question -- the Metro (or Modern UI) stuff runs in the exact same desktop as the "desktop" apps (pardon the pun.) It is actually all very simple. The short answer -- all Microsoft approved Metro stuff runs in the Internet Explorer_Server container