Showing tag results for Code

Aug 3, 2011
Post comments count0
Post likes count0

A shell extension is a guest in someone else's house; don't go changing the code page

Raymond Chen
Raymond Chen

A customer reported a problem with their shell extension: We want to format a floating point number according to the user's default locale. We do this by calling to convert the value from floating point to text with a period (U+002E) as the decimal separator, then using to apply the user's preferred grouping character, decimal separator, etc. W...

Code
Jul 28, 2011
Post comments count0
Post likes count0

Simulating input via WM_CHAR messages may fake out the recipient but it won't fake out the input system

Raymond Chen
Raymond Chen

We saw some time ago that you can't simulate keyboard input with . You may get away with it, depending on how the application you're trying to fake out processes input, but since you're just faking data, the application may discover that it's all a ruse when they try to access information that you didn't fake out, say by calling and discovering t...

Code
Jul 27, 2011
Post comments count0
Post likes count0

You don't need to ask me a question the compiler can answer more accurately

Raymond Chen
Raymond Chen

A customer reported having problems developing the correct p/invoke signature for the structure. "The code works on 32-bit machines, but on 64-bit machines, the call to returns ." The sample code included the lines My response was simply, "I bet you are passing the wrong structure size. Note that on 64-bit Windows, the alignment of the inne...

Code
Jul 22, 2011
Post comments count0
Post likes count0

How do I disable windowless control support in dialog boxes?

Raymond Chen
Raymond Chen

A customer wanted to know how to disable windowless control support in dialog boxes. "The customer has a CommandButton ActiveX control on his dialog box, and using to get the window handle of the command button succeeded with VC 6.0, but when compiled with VC 9.0, it does not create a window. I'm guessing that this is caused by 's suppor...

Code
Jul 20, 2011
Post comments count0
Post likes count0

How do I find the original name of a hard link?

Raymond Chen
Raymond Chen

A customer asked, "Given a hardlink name, is it possible to get the original file name used to create it in the first place?" Recall that hard links create an alternate name for a file. Once that alternate name is created, there is no way to tell which is the original name and which is the new name. The new file does not have a "link back to the...

Code
Jul 8, 2011
Post comments count0
Post likes count0

We've traced the pipe, and it's coming from inside the process!

Raymond Chen
Raymond Chen

We saw last time one of the deadlocks you can run into when playing with pipes. Today we'll look at another one: Our program runs a helper process with stdin/stdout/stderr redirected. The helper process takes input via stdin and prints the result to stdout. Sometimes we find that the from the controlling process into the stdin pipe hangs. Clos...

Code
Jul 6, 2011
Post comments count0
Post likes count1

Looking at the problem at the wrong level: Closing a process's stdin

Raymond Chen
Raymond Chen

A customer was having trouble manipulating the stdin stream that was given to a process. How do you simulate sending Ctrl+Z to a hidden console process programmatically? I am using and want to send the console a Ctrl+Z. I've tried sending ASCII code 26, but that doesn't work. supports Ctrl+C and Ctrl+Break but not Ctrl+Z. Here's what I'm ...

Code