winapi

Getting the right window of "CtrlNotifySink"

Hello everyone, I tried to get a hold on the icons of any folder, by going down this window tree: CabinetWClass ShellTabWindowClass DUIViewWndClassName DirectUIHWND CtrlNotifySink SHELLDLL_DefView DirectUIHWND however, I am stuck in DirectUIHWND, because there are more than one child with the class name "CtrlNotifySink". I need to ge...

sendmessage with shift, control, alt key combinations

I'm trying to send Key combinations like Shift F8, etc to a specific window. I am able to send F8 by itself by posing a WM_KEYDOWN, then a WM_KEYUP and specifing (int)System.Windows.Forms.Keys.F8 as the wParam, but can't figure out how to do it with the shift key. I've tried ORing it with System.Windows.Forms.Keys.SHIFT as well as Syst...

P/invoke function taking pointer to struct

Functions such as CreateProcess have signatures taking several pointers to structs. In common C programming I would likely pass NULL as a pointer for the optional parameters, instead of creating a temporary struct object on the stack and passing a reference. In C#, I have declared it as (p/invoke) [DllImport("kernel32.dll", CharSet = ...

C # Register function using Windows API to call back whenever key is pressed

How can I use Windows API in C# to register a call back function to be called whenever key is pressed? ...

How to make Windows' Memo unfocusable or Label height = size of its content?

Hi! How to make simpe Memo to be unfocusable, so if an user will click on it, focus will not be moved to it? or How to make a Label automaticly word wrap if it's text width > width of a label and make it height = height of text * 'visible' lines count? Thanks! ...

Winapi: how to imitate a right button click on a specific node of a tree view control?

I'm looking for a way to send a "right mouse button pressed" message to a node of a tree view in some window. Sending message is not a problem - the problem is how do i find this control and how do i find the specific node (i know its displayed text)? ...

Changing icons in picture control

What do i need to change icons at runtime every 5 seconds in picture control to give the user a notification that the work is in progress? ...

Where to store 'read-only', 'non-removable' application install date for demo purposes

I have to store a demo install date somewhere on a client PC. The app demo period is calculated on the install date. Obviously it must be impossible for users to edit or delete this value. How can this be done ? We can't use HKLM registry because of Citrix Can't use /Program Files because of Vista Can't use /Documents and settings bec...

CRT types across process boundaries

I'm doing drag/drop out of an activeX control. On drag, I provide a CComQIPtr which has COM methods implemented to pass information to the drop target. On drop, the drop target's process calls my COM methods to get information. Am I not allowed to use CRT types or pointers to CRT types near that interface boundary? I would love for my I...

why is my Win32 gdi+ game unusably slow on Windows 7?

[important new information available below at bottom of this entry] I have what I believe is a very standard game loop using GDI+. It works reasonably well (about 25 fps for a complex game, 40 fps for a simple game) on Vista and XP. When I run it on Windows 7 (with a significantly faster CPU, and more memory), it slows down so much the ...

GetWindowRect too small on Windows 7

The actual problem I'm trying to solve is, I want to automatically find out the size of the margins around windows. If you can find a better way, please by all means answer that instead of this. To do this I decided to take a screenshot of a test window and measure the margins. This is simple enough, as I expect no margins will ever be ...

Does this RegisterDeviceNotification requires GUI

Hi.. Please let me know your answer for my below question Does this win32 api RegisterDeviceNotification Function requires GUI wont it work without GUI thank you ...

Make a win32 console app display a window

I've been developing a win32 console app and now I'd like it to be able to optionally show a non modal status / notification window. Is there any way I can do this from a console app or will I need to rewrite it as a windows app? This is for a kiosk system so I'll need to call SetWindowPos() with the topmost flag on the window handle. ...

How to get job handle if I have HANDLE to one of the windows of the job

My application tried to scrape IE8, here we somehow obtain HANDLE to Internet Explorer Window/UI. Now I want to get the job handle for IE8. One Idea is to - Determine first the process id using the IE Window HANDLE using GetWindowThreadProcessId() but after this I am stuck. There is new implementation in IE8, here every tab opened is a ...

Reading Unicode from redirected STDOUT (C++, Win32 API, Qt)

Hello, I have a C++ application which dynamically loads plug-in DLLs. The DLL sends text output via std::cout and std::wcout. Qt-based UI must grab all text output from DLLs and display it. The approach with stream buffer replacement doesn't fully work since DLLs might have different instances of cout/wcout due to run-time libraries dif...

Windows Hashed Password

Hi, Is there a way to get the hashed value of Windows password for a specific local user? Which Win32 API would that be? I don't want to know what the actual password is, just the hash value of the password. I'd like to be able to tell which workstations/servers don't have the same password for a specific user. Please advise, thanks...

Correct Detecting of the Terminal Services

I've been trying to detect whether or no the Terminal Services are running. I tried to use MSDN Way: OSVERSIONINFOEX osVersionInfo; DWORDLONG dwlConditionMask = 0; memset( &osVersionInfo, 0, sizeof( osVersionInfo ) ); osVersionInfo.dwOSVersionInfoSize = sizeof( osVersionInfo ); osVersionInfo.wSuiteMask = VER_SUITE_TERMINAL; VER_SET_CO...

Set the backcolor of a WinAPI toolbar with Visual Styles?

Is there a way to set the background color. I thought of making a dummy window and then using TBSTATE_TRANSPARENT, but I thought there might be a cleaner solution? Thanks None of these solutions work for a toolbar using visual styles ...

Problem with SetWindowsHookEx Function C#

I am developing an application that needs to handle all messages sent by the OS to any application. The code works fine for WH_KEYBOARD_LL only, but fails with WH_GETMESSAGE or WH_CALLWNDPROC class Program { private const int WH_KEYBOARD_LL = 13; private const int WH_GETMESSAGE = 3; private const int WH_CALLWNDPROC = 4; ...

Simple and effective way to stall a program

I have a program that sets a global keyboard hook and handles key presses. This is my WinMain: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nCmdShow) { MSG msg; logFile = fopen("C:\\keylog.txt", "w"); hKeyHook = SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC)KeyEvent, GetModuleHandle(NULL), 0); ...