winapi

Create window as child in third party application.

I'm trying to get my C# form to be parented correctly in a third party app, I have the handle to the control that I would like my form parented to but just can't seem to get it to work. I would like to create my form so that it is part of the MDIClient, handle 005E0ED6. Just like Window 01D7157D. Is this possible? If so can it be d...

Use system tray & icons in VBA (Access)

I've found a few tutorials that explain how to use the windows API to get a custom icon in the system tray. These are all for Visual Basic, and they don't seem to be scaling to VBA well. I'm following this short tutorial: http://atchoo.org/vb/systray.php Basically, you have to set the hIcon value (a 'long' variable) but it does not wo...

Issue with RegConnectRegistry connecting to 64 bit machines

I'm seeing a weird thing when connecting to the performance registry on 64 bit editions of Windows. The whole program stalls and callstacks becomes unreadable. After a long timeout, the connection attempts aborts and everything goes back to normal. The only solution is to make sure that only one thread at the time queries the remote reg...

Automating an application

I've always wondered the best way to automate use of a GUI in windows. When I was about 15, I wrote a little application that used some simple Windows API functions to automatically click on certain locations on the screen based on a script. This could be used to automate GUI applications, but surely it's not the best way. So, my quest...

Creating a window application that will perform certain action after every 10 minutes

I was wondering would I still need to use a basic game loop for this particular operation? ...

Does SetEvent unblock one or all waiting threads ?

If 2 or more threads are waiting on an event, does SetEvent unblock one or all of them(Or some of them) ? ...

ExpandEnvironmentStrings Not Expanding My Variables

I have a process under the Run key in the registry. It is trying to access an environment variable that I have defined in a previous session. I'm using ExpandEnvironmentStrings to expand the variable within a path. The environment variable is a user profile variable. When I run my process on the command line it does not expand as well. I...

Switch/case without break inside DllMain

I have a Dllmain that allocates Thread local storage when a thread attaches to this DLL. Code as below: BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { LPVOID lpvData; BOOL fIgnore; switch (ul_reason_for_call) { case DLL_PROCESS_A...

WM_POWERBROADCAST handler for CMainDlg in ATL app not invoked

I have an ATL app where I want to handle WM_POWERBROADCAST. I have a CMainDlg (CAxDialogImpl) in whose MSG_MAP I defined the handler. BEGIN_MSG_MAP(CMainDlg) ... MESSAGE_HANDLER(WM_POWERBROADCAST, OnPowerChange) ... END_MSG_MAP() However, the handler isn't invoked when I do things that should invoke it, for instance change...

Dumping mod_perlified variables--what's the local namespace?

I have a mod_perl script: use strict; use warnings FATAL => 'all'; use 5.010001; my $face = 'ugly'; use Data::Dump qq(pp); die pp($ModPerl::ROOT::ModPerl::Registry::C_3a_www_test_2epl::face); It dies undef at C:/www/test.pl line 8. I was expecting "ugly" at C:/www/test.pl line 8. If instead I die pp(%ModPerl::ROOT::ModPerl::Regis...

Constraining window position to desktop working area

I want to allow a user to drag my Win32 window around only inside the working area of the desktop. In other words, they shouldn't be able to have any part of the window extend outside the monitor(s) nor should the window overlap the taskbar. I'd like to do it in a way that does cause any stuttering. Handling WM_MOVE messages and calling...

Make parent control draw over child

Is there a way to make the parent control draw over the children controls when it is invalidated? ...

Multi-Threaded MPI Process Suddenly Terminating

Hey all - I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to spawn two threads per MPI process, and have run into a problem I'm having trouble tracking down. When I run the program with: mpiexec -n 2 program.exe, one of the processes suddenly terminates: job aborted: [ranks] message [0] terminated [1] ...

Is it possible to listen for em_replacesel message to control in another application in C#

This might be a long shot, even not possible. I was wondering if it is possible to listen for the em_replacesel message to a rich text control in another programs window and then call one of the Win32API's to get the text from the window, or even just get the text that was sent via em_replacesel. Is this possible, and possible in C#...

APC locking mechanisme alternative for win32

I want to use APC for php for storing and fetching values (function calls and return values) between a endless running php process and multiple client processes. The endless running process constantly checks for newly stored values. I am running php as a Apache module on WinXP. For each APC function call a apc.lock.* file is placed in th...

First and last window don't show up.

Hi, I'm creating a WinApi application for my programming course. The program is supposed to show an LED clock using a separate window for each 'block'. I have figured most of it out, except for one thing: when creating the two-dimensional array of windows, the first and last window never show up. Here's the piece of code from the InitIns...

Is it a good idea to use the existence of a named mutex as an indicator?

I'm using a named mutex to detect other instances of my application and exit accordingly, and found that there are two ways of doing this: Create the mutex; ignore the indication whether it already existed; try to acquire it; use the fact that acquire succeeded/failed. Create the mutex; use the indication whether it already existed. ...

Empty Win32 Popup Menu

I'm trying to create a dynamic popup menu within my application, the generation code I use is something like that : HMENU menu; POINT pt; menu = CreatePopupMenu(); SetForegroundWindow( receivingWindow ); GetCursorPos( &pt ); int i = 19; AppendMenu( menu, MF_STRING, i++, _TEXT("meh meh") ); AppendMen...

Do CopyFile and CopyFileEx work if the source file is open?

I want to call a copyFile function from within the source file to be copied. The VBA FileCopy function does not allow the source file to be open while it is copied. I am thinking of using CopyFile or CopyFileEx (to show a progress bar) instead. Therefore, do those functions work if the source file is open? ...

Detect insertion of media into a drive using windows messages

I am currently using WM_DEVICECHANGE to be notified when new USB drives are connected to the computer. This works great for devices like thumb-drives where as soon as the device arrives it is ready to have files read from it. For devices like SD card readers it does not because the message is sent out once when the device is connected ...