Click here to Skip to main content
14,599,340 members

Comments by Paul M Watt (Top 12 by date)

Paul M Watt 3-Nov-13 9:23am View
I added the comment that WM_PAINT takes responsibility as information. You dont have to change anything you are doing with how you handle WM_PAINT.

I read through your write-up in greater detail, and it sounds like you have all of the the bases covered, the CS_VREDRAW and CS_HREDRAW flags, CLIPCHILDREN etc.

I thought it would be helpful if I gave you the purpose of a few of the techniques you described so you could decide if you were using them appropriately and make any necessary adjustments or simplify your program if possible.

SS_OWNERDRAW: This is the mechanism that allows the parent window to take responsibility to paint the child window. No subclassing is required with this flag.

CTL_COLORXX: A message is sent to the parent to allow them to configure the HDC for painting a child control, such as the background brush, pen colors and styles etc. No subclassing is required.

As I thought about it, you shouldnt have to use the CTL_COLOR messages on your static controls if you made them ownerdraw. Also, I am not clear on which control you refer to when you say subclass. Did you subclass the child controls you are painting, or are you referring to the parent window of the controls?

Thank you for the compliments on my articles.
Paul M Watt 8-Dec-11 12:47pm View
yeah possibly, but then you don't have to go to the gym, and you'll have extra motivation to keep pedaling otherwise your computer will shut down!
Paul M Watt 6-Dec-11 0:38am View
Thanks for pointing that out.

I only discovered this key when I was trying to kill a virus I had picked up on my machine. It had enabled this policy, then prevented all of the popular Virus Scanners from starting.

As far as the cmd prompt, I wonder if you could block that from starting as well in the group policy?
Paul M Watt 1-Dec-11 2:22am View
void: Correct.

If you had a function with no parameters, it is legal and some developers prefer to write something like this:

void function(void);
Paul M Watt 13-Nov-11 2:16am View
Have you downloaded and installed the Windows Development SDK? The lib file should be in that set of header files and libraries.
If you still have troubles finding that link library, here is the code (I have not compiled or tested, but adapted from another sample I have) to dynamically load and link to the function you are after:

typedef DWORD (WINAPI *FPGetProcessImageFileName)(HANDLE,LPTSTR,DWORD);

FPGetProcessImageFileName fpGetProcessImageFileName = NULL;

// Get a handle to the DLL module.
hinstLib = ::LoadLibrary(TEXT("psapi.dll"));
if (hinstLib != NULL)
fpGetProcessImageFileName = (FPGetProcessImageFileName) ::GetProcAddress(hinstLib, _T("GetProcessImageFileName"));

// If the function address is valid, call the function.
if (NULL != fpGetProcessImageFileName)
// The function loaded successfully.
// You know have a function pointer that points to that function in the loaded DLL.
// You can call it like this:
HANDLE hProcess; // Initialized from the previous calls

TCHAR buffer[_MAX_PATH];

fpGetProcessImageFileName(hProcess, buffer, _MAX_PATH);

// Free the DLL when you are done.
Paul M Watt 13-Nov-11 1:44am View
What compiler are you using?

You will need to search for psapi.lib on your machine, and make sure that directory is included in your compiler linker settings. Then you should just be able to reference the llib file. Linking against the dll will not work.

If you are using a compiler that does not have psapi.lib, you can still dynamically load the psapi.dll, and then user GetProcAddress to load the functions and call them that way. linking is easier if you can find the lib file.
Paul M Watt 13-Nov-11 0:47am View
In that case you will just need to add the .lib file into your linker settings on the properties dialog for your project, linker tab, input settings.
Here are the names listed based on the operating system you are using on the reference page for the API:

Kernel32.lib on Windows 7 and Windows Server 2008 R2;
Psapi.lib if PSAPI_VERSION=1 on Windows 7 and Windows Server 2008 R2;
Psapi.lib on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000

Good Luck
Paul M Watt 6-Nov-11 10:46am View
do you want to map a texture onto this spherical surface, or are you looking to transform a 3d set of objects into a spherical perspective view similar to the perspective transformation that appears on your monitor with 3d graphics?
Paul M Watt 10-Sep-11 3:24am View
Do you mean check single string from a list of ISBN numbers, or test each character in a single ISBN String?

How is your data structured?
Paul M Watt 10-Sep-11 2:36am View
When you write string buffers to the channel are they NULL terminated?
How large of a binary buffer are you sending?
Paul M Watt 10-Sep-11 2:29am View
Great! Good luck.
Paul M Watt 10-Sep-11 2:25am View
Are you saying that you have implemented a function that looks like this in the DLL as well:


DWORD ul_reason_for_call,

LPVOID lpReserved)
switch (ul_reason_for_call)


return TRUE;