winapi

using FindWindow with multiple root windows

So I'm building an app that uses win32's SendMessage as IPC. I'm using FindWindow to get the hWnd based on className and windowName. This has all being going fine and dandy until I want to talk to a root (as in child of the desktop) Window that has the same name / class name as other root Windows. Is there an alternative to FindWindow ...

ShellExecute equivalent in .NET

I'm looking for the .NET-preferred way of performing the same type of thing that ShellExecute does in Win32 (opening, printing, etc. for arbitrary file types). I've been programming Windows for over 20 years, but I'm a complete newbie at .NET, so maybe I'm just looking in the wrong places. I'm currently using .NET 2.0 (VS C# 2005), but ...

How do I process the microphone input in real-time?

I'm starting to create a proof of concept for an idea I have, and at this point, I need some guidance as to how I should begin. I need to sample the microphone input, and process that signal in real-time (think Auto-Tune, but working live), as opposed to "recording" for a while. What I'm doing is "kind of" a "mic input to MIDI converte...

How can I get a list of all open named pipes in Windows?

Is there an easy way to test whether your named pipe is working correctly? I want to make sure that the data I'm sending from my app is actually being sent. Is there a quick and easy way to get a list of all the named pipes? ...

Hosting the .NET runtime in a Delphi Program

I was looking into using some .NET code from within a Delphi program, I will need to make my program extensible using .net assemblies and predefined functions (I already support regular DLLs). After a lot of searching online, I found Managed-VCL, but I'm not ready to pay $250 for what I need, I also found some newsgroups with code that...

How do I copy a file or folder that is locked under windows programmatically?

What are the API calls to copy a file that is currently locked. I'm hoping to be able to use .Net, but Win32 calls would be fine as well. Please feel free to chime in about the same functionality on Unix, or any other OS. ...

How do you draw a Taskbar button using visual styles?

I've created a DeskBand toolbar and I want to display a button on the toolbar that has the style visual style as a taskbar button. In .NET you can use the VisualStyleRenderer to render the Taskbar BACKGROUND, but there's way to render a button. Are there any Win32 API's I can use to draw the button using Visual Styles rather than emula...

Remove the dotted line on a Win32 common control without owner-draw

Is there any way to remove the dotted line rectangle, which indicates the keyboard focus, on a Win32 common control, without owner draw or subclass them? It seems that under WPF one can control the visual style of the focus rectangle, but I failed to find corresponding API on a Win32 common control. ...

Win32: Calculate Thread CPU Utilization in a Multi-Core / Multi-Processor System

I am currently working on an MFC application that needs to be CPU-utilization aware. It may have multiple threads at different points in time, but the bulk of the work is accomplished by the main thread. I am trying to find a way to calculate how much percentage of the CPU this main thread utilizes. However, I am running into some prob...

In .Net, what's the better choice to code key presses in keyboard, key-up or keydown?

Are the two events the same or are there differences that we should take note when coding the keyboard presses? ...

Using SendMessage or PostMessage for control-to-host-app communication in C#?

Found this article and a similar question was aked on stackoverflow.com as well http://www.codeproject.com/KB/miscctrl/AppControl.aspx I figured a way to communicate between the control and the exe that it is hosting would be to use the link below http://boycook.wordpress.com/2008/07/29/c-win32-messaging-with-sendmessage-and-wm_copyda...

Native GTK# on Windows?

How would I compile the latest version of GTK# for Windows without using cygwin? Any and All help would be appreciated. ...

Change Keyboard Layout for Other Process

I'm writing a program in C# that runs in the background and allows users to use a htokey to switch keyboard layouts in the active window. (Windows only supports CTRL+SHIFT & ALT+SHIFT) I'm using RegisterHotKey to catch the hotkey, & it's working fine. The problem is that I can't find any API to change the keyboard layout for the focus...

Creating a python win32 service

I am currently trying to create a win32 service using pywin32. My main point of reference has been this tutorial: http://code.activestate.com/recipes/551780/ What i don't understand is the initialization process, since the Daemon is never initialized directly by Daemon(), instead from my understanding its initialized by the following: ...

Detecting SqlServr.exe WriteFile Operation Within C#

Hello everyone, There's a requirement that we will need to support querying a local SQL Server database for new data when the database is updated. Since these are external SQL Server databases, we may not be able to use SQL Server Notification Services nor can we make any changes to the database. My basic idea is to watch for data ...

Determine window visibility in Vista

I want to determine if a certain window is visible to the user or hidden/occluded. In Windows XP I would use the GetClipBox() function and check for a NULLREGION or empty RECT return value. This worked perfectly fine, but on Windows Vista it does not work if another window is occluding the window. In this case, GetClipBox() is returning ...

Is there a way to the hide win32 launch console from a Java program (if possible without JNI)

You launch a java program from a console (maybe using a .bat script). I don't want the console to remain visible, I want to hide it. Is there a simple way to do this ? Without JNI ? Thanks. ...

Is SetEvent atomic?

Is it safe to have 2 or more threads call the Win32 API's SetEvent on the same event handler not being protected by a critical section? ...

Paths and CreateProcess

Hello Folks, I have a question regarding a symptom of my misuse of CreateProcess. I'm using the lpcommandline parameter to feed the path to my executable and parameters. My misuse is that I have not surrounded the path to the exe with quotes. My question is, why does the CreateProcess work just fine on most computers and not others?...

How do I cast a bool to a BOOL ?

Am I safe in casting a C++ bool to a Windows API BOOL via this construct bool mybool = true; BOOL apiboolean = mybool ? TRUE : FALSE; I'd assume this is a yes because I don't see any obvious problems but I wanted to take a moment to ask only because this may be more subtle than it appears. Thanks to Dima for (gently) pointing out my...