Click here to Skip to main content
15,881,803 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);

HINSTANCE hinstLib;
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.
::FreeLibrary(hinstLib);