winapi

IME - How to handle key press

In my game code, I process key input by handling WM-KEYDOWN message. wParam gives me the keycode i need. The problem is with IME, especially KoreanIME. I get WM-IME-COMPOSITION and then WM-KEYUP, but never the WM-KEYDOWN. So, the bottom line is.. I need to get keycode when i receive WM-IME-COMPOSITION. Is there a way to do so? Any hel...

How to get the name of an Event from a handle

I have an array of Win32 event handles that I'm waiting on using WaitForMultipleObjects(). This returns the index in the array of events that triggered but what I need to know is the name of the event. I've been looking through MSDN and can't see anything to do this. Basically I have a class that monitors the registry through events u...

WNetAddConnection2 in Windows 7 with Impersonation and no Error Code

I'm doing some crazy impersonation stuff to get around UAC dialogs in Windows 7 so the user does not have to interact with the UI (I have the admin creds of course). I have a process running as the Administrator and elevated past UAC. The issue that I'm facing is that when I make a call to WNetAddConnection2, within this process, I am ...

Using Win32 Crypto API

I can't find any help to implement PROV_RSA_AES CSP in c++. is there any article or book to help me out with it? ...

Unbuffered CreateNamedPipe for use as stdout for CreateProcess

I would like to execute arbitrary command-line application and read its standard output as it gets produced. I use CreateNamedPipe to create a pipe and then supply other end (open used CreateFile) to CreateProcess. Provided the target process doesn't explicitly manipulates with standard output bufferring is there a way to make sure that ...

Where does the Perl Package Manager get its 'areas' data from on Win32?

I guess I didn't upgrade the right way, but for a while I was running two versions of Perl concurrently. Now I just have one, but every time I start PPM it recreates the Perl folder of one of the old locations. I've set the active one to be the current Perl folder, but because the old one is still present on the list (displayed when I ...

Calling methods in a win32 service with elevated privileges from an application

I have developed a Win32 C/C++ application that creates dynamic WFP IP filters, however it must be run as admin to do so (due to the Windows security policy). I want to place the code that requires admin privileges in a service running with admin privileges and then call it from the application running as a normal user. First is this th...

Is it possible to hijack standard out

I am trying to redirect the stdout of an already running process on Windows XP using C#. I am aware that I can do this if I spawn the process myself, but for this application I would prefer a "listener" i could just attach to another process. Is this possible in pure .Net and if not is it even possible with Win32? Thanks UPDATE: There...

Win32 status bar with XP style

I try to create a window with a status bar: #include <commctrl.h> InitCommonControls(); hStatus = CreateWindowEx( 0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, hWnd, (HMENU)IDC_MAIN_STATUS, GetModuleHandle(NULL), NULL); int statwidths[] = {100, -1}; SendMessage(hStatus, SB_SETPARTS, sizeof(statwidth...

Delphi - get what files are opened by an application

How can I get the list of opened files by an application, using Delphi? For example what files are opened by winword.exe ...

Can CreateFile() Open one file at the same time in two different thread

Can CreateFile() Open one file at the same time in two different thread void new_function(void * what) { HANDLE h = CreateFile("c:\\tmp", GENERIC_ALL,FILE_SHARE_WRITE | FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) { DWORD d = GetLastError(); return ; }...

detect File 'COPY' operation in Windows

Say I want to be informed whenever a file copy is launched on my system and get the file name, the destination where it is being copied or moved and the time of copy. is this possible ? how would you go about it ? should you hook CopyFile API function ? Is there any software that already accomplishes this ? thanks. ...

Do I need to trap errors in my calls to Win32::OLE->LastError?

[EDIT] - with the benefit of hindsight, this question was misdirected. I have not deleted it because it is a good example of the incorrect use of eval and correct criticism by Perl::Critic. Perl Critic raises the following criticism for the code below: Return value of eval not tested. You can't depend upon the value of $@/$EVAL_ERR...

LsaEnumerateAccountRights always returns "File not found"

I'm calling the Advapi32.dll LsaEnumerateAccountRights function having a policy handle from LsaOpenPolicy and an account SID from LookupAccountName. However, try as I might, I'm always getting back 0xC0000034 which after translation by LsaNtStatusToWinError gives me "The file referenced cannot be found." Which isn't a whole lot of good...

Win32 Mutex not waiting.

I am creating an application that implements inter process communication. For this purpose I have set up a shared buffer, which seems to work fine. Now, I need a way for the data generating application (written in c++) to tell the data receiving application (written in freepascal/lazarus) when it should read the data. I was trying to...

How can I find out if there are windows above a control?

If I have a Winforms control, is it possible to tell if there are windows (from any application) above it? Basically, I need to know what parts of my control are actually visible on screen. ...

IME - DBCS to virtual key code??

For each key input, WndProc usually receives WM-KEY-DOWN and WM-KEY-UP. However, when IME is in conversion status for Asian languages, WndProc receive WM-IME-COMPOSITION and WM-KEY-UP. no WM-KEY-DOWN.. According to msdn([http://msdn.microsoft.com/en-us/library/dd374133%28VS.85%29.aspx%5D%5B1%5D), WM-IME-COMPOSITION message's wParam is.....

Why does SetThreadExecutionState(ES_SYSTEM_REQUIRED) prevent display power-off?

I'm attempting to keep the system on while allowing the display to power off, to allow a download to finish while the system is unattended. To achieve this I call: SetThreadExecutionState(ES_SYSTEM_REQUIRED); whenever I get data from the download. However, this seems to prevent display power down as well (the display dims per its conf...

Operations and functions that increase Virtual Bytes

Having some out-of-memory problems with a 32-bit process in Windows I begun using Performance Monitor to log certain counters for that process. Though it is normal that Virtual Bytes is higher than both Private Bytes and Working Set, I found that in my case there was a substantial difference, Virtual Bytes was much higher than both Priv...

How to pop-up the Windows context menu for a given file using Delphi?

Hi, I want to write the following procedure / function: procedure ShowSysPopup(aFile: string; x, y: integer); Which will build and show (at the coordinates x and y) the right-click shell menu which one sees in the Windows Explorer for the given file. I'm not so interested in the 'showing' part but more in how one can build such a men...