|
Yes - if I get what you mean. You have a value of type RGB and you want to get the reg green and blue values from it?
You have the GetRValue, GetGValue and GetBValue functions that will extract the values from it.
|
|
|
|
|
Sorry, I may have worded the question badly. I am trying to get the RGB values from a pixel on the screen. I'm guessing I need to use the "GetPixel(HDC,int,int);" function. I know that the two int's are x and y. What is HDC? Any help would be appreciated.
-Dev578
|
|
|
|
|
Dev578 wrote:
What is HDC?
The handle of the Device Context your trying to get a value from.
Heard in Bullhead City - "You haven't lost your girl - you've just lost your turn..." [sigh] So true...
|
|
|
|
|
If your not sure what an HDC is then your in for a rough ride in windows programming.
An HDC is a handle to interact with a display surface (e.g. the screen). Every window has an HDC which you can get by using
HDC hdc = ::GetDC(HWND);
... use the hdc
ReleaseDC(HWND, hdc);
HWND, is the handle for the window you want to access the HDC of. In your case, you want to get a pixel colour on the screen. You can pass NULL as the HWND to return the HDC of the entire screem:
HDC hdcScreen = ::GetDC(NULL);
COLORREF = col = ::GetPixel(hdcScreen, x, y);
::ReleaseDC(NULL, hdcScreen);
You can then extract the individual RGB values from the COLORREF returned.
When working with HDCs, make sure you return them in the same state to the OS that you got them in (i.e. use SaveDC()/RestoreDC()), and please make sure that any you Get, you release otherwise as your program runs, it will slowely consume all available drawing resources, until at some point, windows will run out and start giving you very eratic behaviour.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Hi!
You all certainly know the little icon in systray which opens the volume control, where you can enable/disable and set the volume of certain speakers (in my case, "wave", "front", "rear", "subwoofer" and "center").
Are there any API calls to programmatically set the volume of each speaker?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This article[^] may be of some use.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
You want the mixerXXXX functions.
Look up mixerOpen on MDSN and go from there - there is a sample that does it for VB, shouldn't be too hard to convert.
|
|
|
|
|
Thanks!
I heard the mixer classes are a pain in the ass to use, but I'll give them a go.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have some problem in writing An ATL COM Simple Server. When i try to make a new project i notice that some files where the main code must be are not created.
For example i write a project with name FirstCom, and i don't have FirstCom.h, and in FirstCom.cpp i have only this:
And that's why i think i have error, that my servers isn't registred(smth like this). I haveVisual Studio Net 2002 and WTL installed. Can it be the problem??? How to uninstall in that case WTL??? Or What To Do???Thanks.
|
|
|
|
|
That all looks like a standard VS.NET ATL app wizard generated code (using attributes)
You certainly shouldn't have a FirstCom.h, because all the code is added into the stdafx.h for the DLL.
After you've generated the dll framework, you need to add a new ATL Simple Object class. This is the COM object, for which you should have a cpp and h file for.
Have you added a simple object or did you just run the wizard?
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Yes, i'd added the simple object.
By the way, i've seen an example of minimal com server in MSDN and the had the normall code in .h and .cpp files.
So i still don't know what is the problemm.
Thanks
|
|
|
|
|
When you generated your project, you left the wizard attribute option set. This is why you don't see any code. It is all done by the new attribute stuff (which I still don't fully understand myself).
If you want to see the C++ code for your COM server, you will have to regenerate your project and make sure you to turn the Attribute checkbox off.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
I've just tried to write simple ATL server on another computer with Visual Studio Net. And Everithing passed OK.
May be it bacause of my computer??? I have a firewall installed on it... Now i think that problem is not in Visual Studio Net .
Thank you.
|
|
|
|
|
That what i have on my computer:
Error PRJ0019 : A tool returned an error code: "Performing registration".
And this happens nomater if i have chosen "Attributed" or not.
And on another computer i successfully built the project.
What is Wrong with my PC or my "Studio" ???
Thanks
|
|
|
|
|
Rassul Yunussov wrote:
What is Wrong with my PC or my "Studio" ???
Do you have admin privileges on that machine?
Have you tried manually registering the DLL from the command prompt
regsvr32 mydll.dll
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Thank you very much for "regsvr32" but i want to say something about it .
For the first - i couldn't find it on my computer . So i had to copy it from another .
And about visual studio NET - i still don't know why it didn't register itself this dll.
Thanks again.
|
|
|
|
|
hi all
after succeeding in creating tabbed pages in my application. I realised to my greatest dismay that i cant display e combo boxes (Cant display the page after adding >25 combo boxes) I really dn't understand the situation. where did i go wrong?
everything works perfectly fine with <25 boxes......
hope someone can help me here!
|
|
|
|
|
Do you get an error message or an ASSERT?
How are the combo-boxes created? Are they done via the resource editor or via a call to Create?
Your best bet is to step into the page creation code and find out the exact line the problem occurs.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
oh... there's mo error when compiling. Its when i execute the program, the tabbed pages don't display correctly. I really don't know why. I created the combo boxes using the resource editor.
Page creation code? Do you mean the File View?
Thanks =)
|
|
|
|
|
Hi All!
how can I display a bitmap in a control using a button(Not loading it in a WM_PAINT message)?
|
|
|
|
|
|
How i can get the address of HTTP from HTTP Proxy when browse some web site. It's like ZoneAlarm's Web filtering. Can you show me the sample or some infors
Nothing
|
|
|
|
|
I am working on a dialog type project using the base class CFormView and SDI and I am also using another with MDI. Both involve using edit boxes and basic variables such as INT, CString, etc. also will involve simple math, my problem is in the serialization of the data. How do you serialize the data when using CObject as a class, one of my variables is m_sName, is this wrong for serializing or not, yes I am a newbie to C++ and I have lots of books on serializing and they confuse the heck out of me. I have used Cobol and can do this in Cobol but C++ is hard for me to learn, maybe you can suggest some web sites with examples I can learn from. I realize you could write a book explaining serializing but I could use some general guidelines. Thanks for your help and I won't lose any more hair over the frustration.
|
|
|
|
|
Hi There,
I want to know how I can support multiple ‘FormViews’ by having a single ‘Document’ class in my ‘SDI’ Application. The class which ‘MFC Wizard’ makes it for us supports the document. But the additional ‘FormViews’ which I put in doesn’t have access to the ‘Documents’ variables.
The code which I tried my self are as follows:
These are the additional or the ‘Nth’ classes
Class CSection : public CFormView
{
…
};
void CSection:: OnInitUpdate(void)
{
CMyDoc* pDoc = (CMyDoc*) GetDocument();
This code works in an SDI application in which classes are derived from ‘CRecordView’.
}
void CCourse:: OnInitUpdate(void)
{
CMyDoc* pDoc = reinterpret_cast<cmydoc*> (GetDocument());
}
|
|
|
|
|