winapi

ImpersonateLoggedOnUser and starting a new process that uses ocx fails.

I write a c++ windows application (A), that uses LogonUser, LoadUserProfile and ImpersonateLoggedOnUser to gain the rights of another user (Y). Meaning the A starts using the user that is logged on on the workstation (X). If the user wants to elevate his rights he can just press a button and logon as another user without having to log hi...

How to translate hardware ascii to hardware scan code in win32

Is there a way to translate a character to its corresponding hardware scan code (not the virtual key code)? I need that to communicate with ancient hardware device. ...

How to Invoke Shortcuts Keys in the UI Automation? / .NET

I'm writing program to automate win32 form. I'm using Microsoft UI Automation library. I don't know how I can get and invoke predifined shortcuts key on that form. Now I simply get AutomationElement of the MenuItem and invoke click on that elemnt. Any solutions? Does anybody do this? ...

How to write test automation tools like QTP and winrunner using .net?

I would like to know how test automation tools like winrunner, QTP etc work. Whether these tool use any test API provided by windows or they depened on IPC and events. I could not figure out how they work. For me QTP record and play feature seems to be a magic.Any guidance will be highly appreciated? ...

Accessing WINAPI methods within C

Hi I would like to access the DeleteFile WINAPI system call within my C Code. When checking the Windows File Management functions it outlines me just the C++ Syntax: C++ BOOL WINAPI DeleteFile( __in LPCTSTR lpFileName ); What I would like to know is how I can use this function within pure C code? I have never done anything with ...

Respond to only the first WM_KEYDOWN notification?

How can a Win32 application respond to only the first WM_KEYDOWN notification? The MSDN docs claim bit 30 "Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up." but bit 30 is always 0 in my WndProc. case WM_KEYDOWN: // ToDo - stop multiple notifications for ...

How can I get the child windows of a window given its HWND?

I have the handle for a given window. How can I enumerate its child windows? ...

Determine control type

I'm trying to make some static controls transparent on a windows dialog, but I'm having difficulty with one windows message. Windows happily sends me a WM_CTLCOLORSTATIC message when drawing static controls, but this message is also sent to readonly and disabled edit controls. So - given just a hwnd to the control, how can I tell what k...

How can I tell when a managed thread has changed user contexts using impersonation?

Is there a way to find out when a managed thread has changed user contexts due to impersonation? I'd like to be able to do this from unmanaged code that is observing the managed code using Microsoft's .NET Profiling APIs. For example some managed code may be running in user context A, and then impersonate user B. The impersonation may h...

GetIfTable and loopback on Windows Vista

I am using the GetIfTable windows call in C++ with Visual Studio 2005 SP1 on Windows Vista SP2 x86. For a unit test, I am trying to track the bytes sent and bytes received (dwOctets*) on the loopback adapter (loopback software interface 1 or something or other), but those values are always 0. Has anyone successfully used the loopback a...

Allowing pipe to read fragmented messages

How can I protect against fragmented messages being sent through a named pipe. Is it as simple as a while loop checking for an error or disconnect.... or is there more to it? (using winapi, named pipes in C) Thanks. ...

Why/How does a application keep mutex references created by another process?

I have this somewhat unusual process structure: Launch4J starts my Java application. It creates a mutex to provide single-instance functionality. The Java application starts a VB6 application. When the Java application terminates, the VB6 application is still running. (Desired behaviour) The problem is: The mutex created by Launch4J ...

How can my application read windows messages (WM_SETTEXT) from another application?

Is there a way to intercept window messages from another app other than a global message hook? Platform: Windows XP. ...

How can I handle Ctrl+C in a Windows CE console application?

I need to make some clean up before closing my application, but SetConsoleCtrlHandler doesn't seem to be available for Windows CE console applications. Is there any alternative method for handling Ctrl+C in Windows CE 6? ...

Change monitor/screen position

Is there a way I can programatically move my screens in relation to each other? I want to put the 2nd display to the left instead of right. I know this can be done by right-clicking the desktop, choosing properties and then drag-drop there, but I want to do this using the Windows API. ...

How can I check if a Win32 Window pointer is a valid .Net Control?

How can I check if a Win32 Window pointer is a valid .Net Control? ...

How can I get the accessible name using win32 from c#?

How can I get the accessible name using win32 from c#? (the accessible name was set using the standard win form designer) ...

What's the cost (in cycles) to switch between Windows Kernel and User mode?

I'm curious what the cost is on modern CPUs in terms of cycles to perform a switch from Kernel and User mode? ...

How to show WIndows Start Menu

I need to activate Windows start menu on mouse location. I know I can send CTRL + ESC or Win keys to the specific window, and move the window afterwards, but it still shows menu on original location for a short period of time (unless I install hook, and that is overkill for the task). I recall there is some way to do this, using some d...

Restart explorer without executing start up items.

This is the small AutoHotKey script I use to restart explorer: WinGet, h, ID, ahk_class Progman PostMessage, WM_QUIT, 0, 0, , ahk_id %h% Run, explorer.exe The problem is that it runs Start up items. I see that this dude had the same problem. Anybody knows a way to fix it ? ...