i've got a pretty simple question about comboboxes. i want to make the combobox 'read only' so that my code can still add items to it, but the user can't add his/her own things to it. does anyone know how i can do this?
I have a dialog/tree based application (VC++ 6.0 MFC) and have implemented a System Tray icon with a context menu. The main application gets all the correct notifications and does all the right things.
Now I want to change the context menu depending what the user does within the main dialog application e.g. when they select an entry from the tree displayed in the dialog, I want to add details of that entry to a popup menu off of the system tray context menu.
e.g. if the system tray menu looks something like:
I can use flags "TPM_LEFTBUTTON | TPM_RIGHTBUTTON" in the call to TrackPopupMenu so that both left and right mouse clicks are accepted and I have used Spy++ to prove that the Windows message for WM_LBUTTONUP and WM_RBUTTONUP are generated - but I need to get the information on which button has been pressed on the menu item to the routine in my dialog application that is notified of a click on that menu item via the:
"ON_COMMAND( id, memberFxn )" and "afx_msg void memberFxn( );" statements.
Hello. I was just wondering if anyone knew a simple way to find the colour of a specific pixel displayed on the screen by ANY program.
I used this program called "Macro Scheduler" which had a very simple GPC (Get Pixel Colour) command to use which returned the colour in a number of a specific pixel displayed on screen regardless of which program displayed it. Is their something similar in C++?
I'm very new to C++ but if I could get around this problem I could start on my project and learn along the way.
I also don't really care about the specific colour, like if 256 colours or whatever, I just need to find a value to distinguish between pixels displayed on MY screen.
Any help is greatly appeciated.
Take a look at the GetWindowDC[^] API, if you pass NULL as it's window handle it will return a device context back for the current desktop. After that you can use GetPixel[^] to retrieve the color for any pixel. You'll need something like:
COLORREF GetDesktopPixel( int x, int y )
COLORREF cl = 0;
HDC hDC = NULL;
hDC = GetWindowDC( NULL ); // Get DC for Desktop
cl = GetPixel( hDC, x, y );
DeleteDC( hDC ); // Close the DCreturn cl;