winapi

how to convert .png to .bmp using winapi?

Using C language ...

Intercept mouse input

I was wondering if there is a way to intercept and modify mouse input before it gets to windows? What I'm wanting to do is intercept mouse motion events, apply some custom scaling and acceleration to the values, and then continue passing them along. I'd need something that can do this before the inputs get to the raw input API or Direct...

How to send keystrokes to windows from a ruby app?

Hello, I´ve been trying to interact with another app on windows, which doesn´t have any data exchange protocol implemented. So i figured the best way to do this is by fetching data from an app and send it to the other one by sending keystrokes, simulating human interaction. But i am having such a hard time trying to implement this kind...

convert char to LPCWSTR

char lpszUsername[255]; DWORD dUsername = sizeof(lpszUsername); GetUserNameA(lpszUsername, &dUsername); ret_status = NetUserGetInfo(pc_name, lpszUsername, 1, (LPBYTE*)&ui); So I need char for GetUserNameA, but for NetUserGetInfo - LPCWSTR. WTF? How do I can convert char to this? error C2664: 'NetUserGetInfo' : cannot convert parameter...

Any reason to prefer memset/ZeroMemory to value initialization for WinAPI structs?

In Win32 programming a handful of POD structs is used. Those structs often need to be zeroed out before usage. This can be done by calling memset()/ZeroMemory() STRUCT theStruct; ZeroMemory( &theStruct, sizeof( theStruct ) ); or by value initialization: STRUCT theStruct = {}; Although the two variants above are not equivalent in g...

Get proccess ID with python

Could someone tell/show how to get the current proccess id with python on windows there are this function os.geteuid() but its only works with linux/unix could someone tell what it the pythonic way to get the current proccess id on windows. ...

Win32_WindowsProductActivation SetProductKey with python

I am trying to use the SetProductKey method of Win32_WindowsProductActivation to set the windows xp key for a custom need of mine as per the second Microsoft vbs script here :http://support.microsoft.com/kb/328874. No matter what method i use i always get shut down. I have tried wmi: import wmi c = wmi.WMI() c.Win32_WindowsProductActiva...

How to use EM_CHARFROMPOS with RichTextBox in C#

I am trying to use following code to retrieve character index by position in a RichTextBox. I know I can use GetCharIndexFromPosition method provided by RichTextBox Class, but I want to know what is wrong with following code: SendMessage import is this: [DllImport("User32.dll", EntryPoint = "SendMessage", CharSet= CharSet.Auto)] public...

Caching strategies for Windows end-user applications?

I'm working on what is essentially the runtime for a large administrative application. The actual logic that is being executed, as well as the screens being shown and the data operated upon is stored in a central database. In order to improve performance, the runtime keeps data queried from the database in various caches. However, it is...

Turning off process feedback cursor in windows

Is it possible to disable the mouse feedback cursor when a process begins from within the process? I know you can use the STARTF_FORCEOFFFEEDBACK flag when creating the process, and that the feedback cursor will turn off when the process displays a window. However, I do not have control over the code that creates my process and my proce...

pywin32: how do I get a pyDEVMODE object?

How can I create a PyDEVMODE object without just having it as a return from a function call like win32api.EnumDisplaySettingsEx(name, 0)? ...

pywin32+VirtualBox: guest VM crashes when trying to disable second monitor

I wrote the following code to disable the a guest os's virtual monitor programatically: def disableSecondMonitor(): import win32api import win32con as C name = win32api.EnumDisplayDevices(None, 1).DeviceName devmode = win32api.EnumDisplaySettingsEx(name, 0) devmode.Clear() devmode.Fields = C.DM_PELSWIDTH | C.DM_...

How can a child window respond to a change in its parent

In a Win32 app is there a Windows message or some other notification that will get sent to a child window when it is placed into a different parent ...

How can I force display detection in Windows?

I often boot my Windows 7 PC with the attached KVM switch focused on another computer. When I switch to the booted PC, the display resolution is wrong (and the second attached monitor is not detected). I can correct this by right-clicking the desktop, choosing Screen Resolution and clicking Detect. This makes Windows detect attached dis...

Get console handle

Hi, How do I get the console handle of an external application? I have a program running as a console. I have a 2nd program that will call GetConsoleScreenBufferInfo, but for that I need the console handle of the first program. Is it possible that given the HWND of the 1st program I can get its console handle? ...

Custom icon not displayed in upper left corner or on task bar

I have created a basic application with with windows api. It just displays a small window. I am starting from main function, getting the instance, created my windows class, etc. Everything works out fine. The problem I have however is that my custom icon will not display in the top left corner of the window or on the task bar, it just...

Themed progressbar for EasyDialogs or Python Win32's progressbar.py examples?

Looking for a way to have the native Windows progressbar implemented via EasyDialogs or Python Win32's progressbar.py example use the operating systems theme support so that the progressbar shows a modern user interface vs. something that's a throwback to Windows 95. I've tried compiling both these techniques as py2exe executables with ...

Create a tooltip in C# based on Win32 window handle

I'm writing a dll for an aging software framework. The framework was created in 2002, so most of its thinking and dll templates are for C++/Win32. However, it does come with a working dll template in C#, which is what I'm working with. The dll creates a window and I'm trying to add a tooltip to that window. Using the C++/Win32 dll templa...

Rename function vs undef : conflicts with Windows API

This has actually occurred twice now. I'm writing a cross-platform application, and some of my function names conflict with the Windows API. What I did (for example with LoadObject) was... #undef GetObject Is this an okay approach, or should I rename my functions? ...

Internet Explorer Address Space

Though i'm currently interested in internet explorer address space i wouldn't mind a general answer. The question is how can i calculate the address space ( and by address space a mean the minimum and maximum address in memory -correct me if i'm wrong- ) of a windows process. Actually is this space fixed or varied ? Also do i get to kno...