winapi

Windows: Overwrite File In Use

I am trying to write a utility that will allow moving files in Windows, and when it finds a file in use, will set that file to be moved on reboot. It seems that MoveFileEx (http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx) is the right call for this, however I cannot figure out what error code I'm looking for from GetLastErr...

Question regarding guidInstance in DirectInput library; also deals with enumeration of devices.

Regarding guidInstance in DIDEVICEINSTANCE Microsoft says: Unique identifier for the instance of the device. An application can save the instance globally unique identifier (GUID) into a configuration file and use it at a later time. Instance GUIDs are specific to a particular computer. An instance GUID obtained from one computer is...

Can APC interrupt WSAWaitForMultipleEvents?

Can APC (Asynchronous Procedure Calls) interrupt WSAWaitForMultipleEvents()? (C++) MSDN does not list this WSAWaitForMultipleEvents() on the APC page ( http://msdn.microsoft.com/en-us/library/ms681951.aspx ). I do not have visual studio in front of me right now to try it. Can somebody please let me know? Thanks ...

Turn on/off monitor

Is it programmatically possible to turn a monitor on/off through code (C#)? ...

PostMessage and CALLWNDHOOK, missing registered messages?

Here's the situation. I've got a two different window hooks, one's a global hook of the WH_SHELL variety that watches for new top-level windows, the second's a thread hook of the WH_CALLWNDPROC which is set on some of the top-level windows discovered by the first hook. The two hooks are implemented in different DLLs. As far as I can t...

C Registry Functions In Windows API

RegOpenKeyEx() I want to printf("Success") or printf("Failure") depending on if the function fails or succeeds How would I do such a conditional while keeping it neat and legible? I am wanting to stay away from this : if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,"HUGE LONG KYEY STRUCTURE HERE",0,KEY_SET_VALUE) != 0 ) { //CODE } ...

Switch statement use

Should i use this form of switch statement: switch(msg) { case WM_LBUTTONDOWN: { char szFileName[MAX_PATH]; HINSTANCE hInstance = GetModuleHandle(NULL); GetModuleFileName(hInstance, (LPWCH)szFileName, MAX_PATH); MessageBox(hwnd, (LPCWSTR)szFileName, L"This program is:", MB_OK | MB_...

Adding external library into Qt Creator project

How can I add external library into a project built by Qt Creator RC1 (version 0.9.2)? For example, the win32 function EnumProcesses() requires Psapi.lib to be added in the project to build. Thanks in advance. ...

Where can I find a list of windows API constants

Every time I interact with dll's like the user32.dll I need constants like MF_REMOVE. Is there a overview for all that constants or a c# library that constants all these constants? ...

Win32 named pipes and remote clients

Can I access a named pipe on computer A from computer B given computer A's IP address? If so, what do I need to do to make this happen? ...

Last printer used when printing with Fast Report (in Delphi)

How to retrieve last user selected printer when printing from a preview window in Fast Report (Basic Edition ver. 4.7.1)? I tried frxReport.PrintOptions.Printer in OnAfterPrintReport event but it only returns the system default printer. After the user prints the report, the program prints a few Word documents and I need to know whic...

(Windows) Monitoring API calls in C

Is there anyway to monitor API calls on your system in C? ...

Kickstart win32 development

Guys, I'm mostly a Java dev, with a good background in C/C++ for *nixes. Now I need to write a small utility for Win32 which can be considered a system tool: it should be able to access windows processes, handles, etc. In addition, it needs a simple GUI (but not command line). What's the best way for me to start? Any good proven onlin...

Determine if a given window is currently being moved.

Basically, I'm looking for a IsWindowMoving(HWND) Win32 API call. I need to know if the user is currently moving a window. The window doesn't belong to me, so listening for WM_SYSCOMMAND / SC_MOVE or WM_MOVING isn't possible (I don't want to subclass or hook due to 32/64 interop). ...

How to create transparent SYSLINK win32 control?

I tried creating with LWS_TRANSPARENT flag and WS_EX_TRANSPARENT ex flag (those are CreateWindowEx()) arguments, but that doesn't work. MSDN doesn't say much about syslink controls. ...

Do I need to use reference parameters for returning values?

If a HANDLE is an output parameter, is it necessary to use a reference to the HANDLE or use HANDLE directly? bool fn(HANDLE h_result); or bool fn(HANDLE& h_result); ...

Initialize Critical Section only once for a process

In a multi threaded application, is there a way to ensure that a Critical Section is initialized only once except for putting the code in DLL main() ?? ...

Can't use TileWindows function properly

I want to tile C# winforms but it seems that the .Net framework does not support this. So I used the Win32 function TileWindows. Here's the code: GCHandle gcHandle = GCHandle.Alloc(handles, GCHandleType.Pinned); IntPtr arrayHandle = gcHandle.AddrOfPinnedObject(); TileWindows(IntPtr.Zero, ...

Application Icon

I have 3 icons. When I compile application I use first Icon - main app icon. And I have 2 other icons in resources. When I show MessageBox.Show(...) the first app icon appear in task bar. I want to have an ability to change the main icon at runtime at some reason. ...

How to implement a code coverage tool using Win32 Debugging API

I am trying to understand how to implement a Code Coverage tool using the Win32 Debugging API. My thinking has been to utilize the Win32 Debugging API to launch a process in debug mode - and track what CPU instructions has been executed. After having tracked all CPU instructions I would then use the map file to map it to what source cod...