The Old New Thing

Having an owner window from another process is tricky, but it's sometimes the right thing to do

A customer had a main program (let's call it A) and a helper program (let's call it B), and the customer wanted and wanted B to act like a modal dialog relative to A. When B is launched, we disable A's window and then call SetForegroundWindow(hwndB) to simulate a modal dialog. How do we make sure that focus goes to B's window and ...
Comments are closed.0 0
Code

How do I get the title of a dialog from a dialog resource?

A customer submitted the following question: We are developing automated tests for our application. Among other things, our application uses property sheets, which means that the name of the tab is stored as the title of the dialog template resource. Since we want our automated tests to run on all language versions of our application, we don'...
Comments are closed.0 0
Code

Although the default icon for a shortcut is the icon of the target, you can override that

A customer reported that a shortcut they deployed to their employees' desktops was triggering unwanted server traffic. My customer deploys a shortcut on %ALLUSERSPROFILE%\Desktop, and this shortcut points to an EXE file on a remote server. Once a local user logs on, the computer will try logging onto the remote computer to query information ...

Why did Win32 define BOOL as a signed int instead of an unsigned int?

Igor Levicki wants somebody from Microsoft to explain why BOOL was defined as a signed int instead of an unsigned int. You don't need to work for Microsoft to figure this out. All the information you need is publically available. Quoting from K&R Classic, which was the operative C standards document at the time Windows was being ...
Comments are closed.0 0
Code

Paul Cézanne and Camille Saint-Saëns may have similar-sounding last names, but they are not the same person

Next week, the Seattle Symphony Orchestra performs the Saint-Saëns Organ Symphony, but the people responsible for the symphony's radio advertisements don't realize that. As the strains of the symphony resound in the background, the announcer proudly announces that tickets are still available for "Cézanne's Organ Symphony." The ...

How do I monitor, or even control, the lifetime of an Explorer window?

A customer wanted help with monitoring the lifetime of an Explorer window. We want to launch a copy of Explorer to open a specific folder, then wait until the user closes the folder before continuing. We tried launching a copy of Explorer with the folder on the command line, then doing a Wait­For­Single­Object on the process ...
Comments are closed.0 0
Code

How can I generate a consistent but unique value that can coexist with GUIDs?

A customer needed to generate a GUID for each instance of a hardware device they encounter: The serial number for each device is 20 bits long (four and a half bytes). We need to generate a GUID based on each device, subject to the constraints that when a device is reinserted, we generate the same GUID for it, that no two devices generate the ...

Why is there the message '!Do not use this registry key' in the registry?

Under Software\Microsoft\Windows\Current­Version\Explorer\Shell Folders, there is a message to registry snoopers: The first value is called "!Do not use this registry key" and the associated data is the message "Use the SH­Get­Folder­Path or SH­Get­Known­Folder­Path function instead." I added that message. ...

Feedback usabilla icon