|
Thanks for replying.
What you suggested, was one of several things I had tried prior to posting the question, and was one of the many results that produced a compile error (of one kind or another). (Take my word for it, I tried many different things, including the use of numbers to depict the size of the array.)
Lets give the size of the array (for simplicity sake) a size of 5. The compile error would then read, "cannot convert parameter 1 from 'short [5][5]' to 'short ** '." (That's the error received from trying your suggestion, which I myself had tried long before.)
With regards to your reason why the compiler would never do what I'm trying to accomplish, I have narrowed it down to one of three reasons. But before I get to what they are, allow me to point you to Lippman's "C++ Primer: 3rd Ed." page 348, first line (second sentence) where he states, "When the parameter is a reference to an array type, the array size becomes part of the parameter and argument types, and the compiler checks that the size of the array argument matches the one specified in the function parameter type." He then proceeds to give two examples: one correct and the other, incorrect (for the reader to understand what he's talking about).
Notice also, the compiler did not complain about the way I was passing that kind of parameter and argument. It complained about the way it was being accessed in the "called" function, which brings me around to one of my three reasons why I believe I'm not getting a clean compile.
1. I cannot pass multi-dimensional arrays (of ANY size) this way.
2. The compiler I'm using is out of compliance with the Standard.
3. Lippman is wrong.
Because I've had problems before with this compiler (MS VC6) being out of compliance with the Standard, that suspicion is very plausible. However, in this instance, I more tend to believe it's reason #1.
Bottom line: What you suggested did not work either.
Thanks anyway. I appreciate the suggestion.
William
Fortes in fide et opere!
|
|
|
|
|
Is there a way to get the red,green,blue of a specified pixel in MFC? I have been trying to figure this out for awile, so I'm guessing its not easy? Any help is appreciated.
-Dev578
|
|
|
|
|
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.
|
|
|
|