winapi

Gradient Brush in Native C++?

In c#, you can use drawing2d.lineargradientbrush, but in c++ right now I only found the CreateSolidBrush function. Is there a function in the native gdi dll to create a gradient brush? I couldn't find anything like this at msdn. Thanks ...

Code to walk a MSAA tree for a given window (Microsoft Active Accessibility)? In C/C++

Any links to code to get the control tree? Thanks. ...

How to prevent Flikkering on picturebox of windows mobile

Hi.. I have a transparent rectangle on a picture box,if i click next,the next image comes and transparent rectangle is drawn.The problem is flickering,while moving from one image to another image,the transparent rectangle flickers.please help me how to get rid of this problem.i want to eliminate flicker,please help. Thanks ...

Win32: How do I make an HWND transparent to clicks?

I want an HWND that is transparent to clicks (i.e. passes them through to windows underneath). At first I tried WS_EX_TRANSPARENT but that has all sorts of redraw problems. Windows underneath end up drawing over my HWND. I did some searching and found a suggestion to respond to WM_NCHITTEST by returning HTTRANSPARENT. This seemed to wo...

Problem starting a process with CreateProcess()

The question is given like this: Using the CreateProcess () in the Win32 API. In this instance, you will need to specify a separate program to be invoked from CreateProcess(). It is this separate program that will run as a child process outputting the Fibonacci sequence. Perform necessary error checking to ensure that a non-negative ...

"Per Application" Audio Mixer in Windows XP

I need to mute and unmute sounds from other processes in Windows XP. I am looking for the best strategy. It is possible to write a Kernel Mode mixer that will filter the inputs to the output device? My other approach would be set Hooks for the various API's to intercept their Win32 calls. I would strongly prefer the less invasive approa...

How do I write to shared memory in C++?

I'd like to write to shared memory and then dump the contents to a file in the win32 api. Currently I have this code: HANDLE hFile, hMapFile; LPVOID lpMapAddress; hFile = CreateFile("input.map", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); hMapFile = CreateFileMapping(hFile, N...

Writing to shared memory

How can I write from a file to shared memory using the Win32 API? I have this code: hFile = CreateFile("input.map", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); hMapFile = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, TEXT("SharedObject")); lpMapAddre...

Active Accessibility (COM) calls return differently depending if caller is a thread vs. a process. What?!

I have code that uses Microsoft Active Accessbility to get information about the active window. Strangely, I can only enumerate all the controls in a window (in this case Internet Explorer) if I use a process. If I spawn a thread and call the EXACT same code, MSAA will return only a subset of controls. Usually just the menu bar and toolb...

C++ Timer not working?

I'm trying to make a timer in c++. I'm new to c++. I found this code snippet UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc); I put it in my global variables and it tells me Error 1 error C2373: 'SetTimer' : redefinition; different type modifiers I'm not sure what this means. Is there a more p...

Win32 file permission sharing violation while deleting a temporary file

I have an application where I am trying to implement a "safe file overwrite" by: Creating a file (A) Filling A with data Copying A to its final destination (B) via SHFileOperation Deleting A using DeleteFile However in step 4 DeleteFile always returns ERROR_SHARING_VIOLATION. The entire process takes milliseconds, so I can't imagine...

Lost Focus and GotFocus in c++

How do you add code to these events for native c++. I couldnt find a WM_LOSTFOCUS OR WM_GOTFOCUS; I only found WM_SETFOCUS. I need code to happen when my window loses focus, and regains it. Thanks ...

ListView Movement Problem

Hi, I am using Listview,the View selected is largeicon mode. The problem i am facing is selection.using the arrow-keys i am able to navigate only in the first row(suppose i have 3 images in a row,if i press right arrow key,it will move till the end of row and again it will comeback to the first image of the same row)But the expected beh...

How can my ActiveX control take over Print, Save As, Find, etc. within Internet Explorer?

I have an ActiveX control that displays documents of a given file format within IE, much like Adobe have an ActiveX control that displays PDFs. My control is a full-page control, just like the PDF viewer - it takes over the whole client area of IE, using IE's own EnableFullPage mechanism. I'd like to take control of the various menu an...

Customizing Win32's Save File Dialog

I am trying to save a file using GetSaveFileName and want to have a couple extra popups at the bottom of my save file dialog to allow the user to specify further options. I am trying to follow the MSDN documentation (specifically the Explorer-style customization) on the subject but can't seem to get my custom item to appear. I believe I ...

Why does .NET not clear errors internally?

I am running the following scenerio: SafeFileHandle handle = Win32API.CreateFile((deviceName + "\\" + pipeName), DesiredAccess.GENERIC_WRITE | DesiredAccess.GENERIC_READ, ShareMode.FILE_SHARE_WRITE | ShareMode.FILE_SHARE_READ, IntPtr.Zero, ...

Using GetExtendedTcpTable in Python

I am trying to use GetExtendedTcpTable via a Python program. Basically I am trying to convert "ActiveState Code Recipe 392572: Using the Win32 IPHelper API" to "Getting the active TCP/UDP connections using the GetExtendedTcpTable function". My problem is that I cannot seem to get the Python script to recognize TCP_TABLE_CLASS.TCP_TAB...

Change speed of keystroke C++

Basically, when one types, a keydown event happens. If the key is held for more than a certain time (~1 sec) then the key is repeatedly pressed until keyup hapens. I would like to change the time it takes for the key to be automatically repressed in my c++ application. How can this be done? Thanks ...

Custom UserControls in C++

In Native C++, how do you add a usercontrol like in vb .net where you do form.controls.add(controls) Because for instance, what if I wanted to make a usercontrol class that inherits from panel? How is this done in c++ Thanks ...

Raw PDO to send IOCTL to upper filter driver (kbfiltr/moufiltr) to enable/disable device

I am quite new to driver development and trying to write a simple filter driver that will enable or disable a keyboard or mouse device. If I can make it work, I want to use it to disable the touchpad on my laptop when a mouse is plugged in. I realize there is probably software out there that does this already, but I am really interested ...