|
:-DQuestion one:
What is the meaning when window is actived?
What is the difference between actived and setfocus?
What operation will make a object of CWnd class responds the OnActivate message?
Questiong two:
There is a class named CBMWin which derived from CWnd.I generate its objects by dynamic, and display them in the View of a MDI application as the view's subwindows.Now, I need to chage those subwindows' style by those subwindows's state. For example, when I select a subwindow, the style of the subwindow should add a WS_SIZEBOX style and previous subwindow I selected should remove the WS_SIZEBOX style.If I hit the client area which does not occupied by those subwindows, all of those subwindows have not a WS_SIZEBOX style .In a word,the selected subwindow havs a WS_SIZEBOX style and other have not.
Which message of the CBMWin class Should I deal with?
Looking forward to your help!
andy
|
|
|
|
|
Question three:
How will you learn anything if you get someone else to do your homework?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I think if you can tell me the answer, I will learn how to resolve the similar problem.Thank you all the same,ravi.
andy
|
|
|
|
|
Hi all,
I am learning how to develop adding for devstudio.
have developed one with two buttons.
I want to change the name of toolbar when addin is loaded.
When i load addin .. by customize, going to that path and toolbar comes up.
The default name of toolbar that is coming is "toolbar1".
How I can change this name to (say "My1stAddinTB") programmatically?
I know i can rename toolbar1 from customize option in context menu.
i have looked some samples from CP but all those addin has same characteristic... giving toolbar1,2 and so on
Is it possible to give some useful name to toolbar from addin. Like the one already in VC IDE... (e.g. "Wizard","Debug" )
Thanks in advance
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Hi. I got an animation on an MDI app and i want to insert sound with it. I looked on the web and the only thing i found is the FMOD library but when i inserted it into my application, it doesn't work. Does any one knows how to do it without/with FMOD or can i get an appropriate source code which uses sound with an MDI?
Get busy living or get busy dying!
|
|
|
|
|
Are you referring to the sndPlaySound() or PlaySound() functions? There's also a suite of MCI (multimedia) functions.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i am into making a dialog based application.....i have defined static controlz(i have given it propertiez by subclassing....hence modifing it)....what i need to know is that.....i would want to be able to recieve a message in the control when a left button of the mouse goes up OUTSIDE THE CONTROL.....i have used OnNcLButtonUp()....but that doesnt help....can u tell me why???.....doesnt OnNcLButtonUp mean to sense left button up outside the client area????.....
if it is not iz there any other way whereby which i could sense thiz??...
i am sure thiz OnNcLButtonUp message doesnt go to the control since i verified it(by putting in a message box command to pop up ,if thiz function getz triggered!!!)....
sob!!!!!.....any ideaz.....?????
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
I think you'll have to capture the mouse in the control when you receive a WM_LBUTTONDOWN, then I'm pretty sure you'll get the WM_LBUTTONUP message regardless of where the mouse cursor is when the button is released. But I've never used mouse capture myself, so I can't really give any good advice. Look into SetCapture in MSDN.
WM_NCLBUTTONUP is send when the mouse button is released in the windows' non-client area, i.e. title bar, menu bar, border etc. A static control has no non-client area (the client area completely fills the window area) so you won't receive any WM_NC* messages. I think you misunderstood the concept of non-client area, it's the part of the window area (for the control/window) that's not client area.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
thanx for the reply!!!!!.....hmmmm...yez u r right!!!!!....i got the WM_NCLBUTTONUP all mixed up!!!!!
by the way.....i do have a WM_LBUTTONDOWN in the static control but the prob iz that i dont think the WM_LBUTTONUP can be sensed if it outside the control,can it?????.....i think it looses the focus and therefore the message(WM_LBUTTONUP)cannot be got.....
if u do know please do enlighten me......i could be wrong again!!!!!....i dont seem to have any luck though in getting the WM_LBUTTONUP message till now.....
thanx for the reply and if u do know a solution or any idea.....pleeeeeaaase do reply!!!!!
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
That's why you have to use mouse capture, so you'll get the WM_LBUTTONUP even though the mouse is outside your client area when the button is released. As I said, I'm no expert, so please look SetCapture up in MSDN.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
thaaaaaaaaaaaaaaaaaaaaanx!!!!!....u r a life saver.....i fixed the prob!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!hehehhehehee.....
i owe u!!!!!
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
i'm facing a problem with polymorphism currently and need help.
i've 1 base class, let's call it Base, and 2 Derived class, Derive1 and Derive2. Base is NOT an abstract class.
on top of these 2, i've a container class Container that contains a vector of Base pointers. (i.e. vector < Base* > pointer)
now in Container, there's a function called init() that will initialize the vector of pointers and according to the type of class it belongs to.
e.g.
pointer[0] = *(new Base);
pointer[1] = *(new Derive1);
pointer[2] = *(new Derive2); and so on...
the type of classes are created correctly when the constructors are called. however, when i tried to access the pointers again later in my program, the program only treats each pointer as Base and no longer as any derived classes. thus polymorphism cannot work at all... this is crucial to me as i have several classes that's supposed to belong to the vector of pointers. if i use a simple array polymorphism works. but i need the vector....
please help!!
|
|
|
|
|
ng kok chuan wrote:
vector < Base* > pointer
ng kok chuan wrote:
pointer[0] = *(new Base);
Are you sure this actually compiles? Shouldn't the second line actually be
pointer[0] = new Base;
etc... There's no reason why a vector can't be used here.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
i was trying to simplify the problem here, which is why i used *(new Base);
what i really have is a while loop:
while (!odyn.IsEOF())
{
node.push_back(*(new MazeNode));
node[node.size()-1].init((string)eqpid, (string)eqptyp, 1);
odyn.MoveNext();
}
and node.push_back() takes a reference, which is why i need to dereference the memory allocated.
the code compiles with no problem, and works without error too. however polymorphism does not work at all. i've tested using a Base array in main() and polymorphism works.
|
|
|
|
|
ng kok chuan wrote:
and node.push_back() takes a reference
If it does, then your vector is not a vector of pointers, and that is the prolem. If you want polymorphism to work, your vector will have to store pointers, not objects.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
ok i've got the problem solved. silly me.
as you said, i required a vector of node pointers, but when i first started off, i only used a vector of nodes. it worked perfectly fine till i tried to use polymorphism, and this problem arised.
now i've made all the necessary changes and it's ok now. thanks for the reply
|
|
|
|
|
ng kok chuan wrote:
was trying to simplify the problem here, which is why i used *(new Base);
When posting, always copy/paste your code verbatim. Re-typing (or simplifying when it is not obvious you are doing so) into the forum will, more often than not, lead to erroneous assumptions and misguided answers.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi, anyone please help?? i really need to be able to do both polymorphism and use vectors.
|
|
|
|
|
There is no problem using polymorphism in a vector. You are probably doing something wrong elsewhere.
Try to post the code of the declaration of the vector, the piece of code in which you add new elements to it and the piece of code where you make use of these elements (and where it seems polymorphism doesn't work).
This will help us to help you
|
|
|
|
|
Your methods have to be virtual for polymorphism to work. If you need member data access to be polymorphic, either use access methods or cast your pointer from the array to the correct type using some kind of type information extracted from the pointed-to object using virtual methods.
Did that make any sense? If not, here's an example (lot of stuff leaved out, don't expect it to compile)
<br />
<br />
class Base<br />
{<br />
public:<br />
int m_iInt;<br />
<br />
public:<br />
int virtual GetInt() {return m_iInt);<br />
CString virtual GetClassInfo() {return CString("Base")};<br />
int NonVirtualGetInt(){return m_iInt);<br />
}<br />
<br />
class Derive1 : Base<br />
{<br />
public: <br />
int m_iAnotherInt;<br />
<br />
public:<br />
int virtual GetInt() {return m_iAnotherInt);<br />
CString virtual GetClassInfo() {return CString("Derive1")};<br />
int NonVirtualGetInt(){return m_iAnotherInt);<br />
}<br />
<br />
class Derive2 : Base<br />
{<br />
<br />
public:<br />
int virtual GetInt() {return 2 * m_iInt);<br />
CString virtual GetClassInfo() {return CString("Derive1")};<br />
int NonVirtualGetInt(){return 2 * m_iInt);<br />
}<br />
<br />
int main()<br />
{<br />
Base *pointer[3];<br />
<br />
pointer[0] = new Base;<br />
pointer[1] = new Derive1;<br />
pointer[2] = new Derive2;<br />
<br />
pointer[0]->m_iInt = 1
pointer[1]->m_iInt = 10
(CDerive1*)pointer[1]->m_iAnotherInt = 15
(CDerive2*)pointer[2]->m_iInt = 100<br />
(CDerive2*)pointer[2]->m_iAnotherInt = 150
<br />
for (i=0; i<3; i++) <br />
cout << pointer[i]->GetInt()
<br />
for (i=0; i<3; i++)<br />
cout << pointer[i]->m_iInt
<br />
for (i=0; i<3; i++)<br />
cout << pointer[i]->m_iAnotherInt
<br />
for (i=0; i<3; i++)<br />
cout << pointer[i]->NonVirtualGetInt()
<br />
for (i=0; i<3; i++) {<br />
CString cs=pointer[i]->GetClassInfo()<br />
if (cs == "Base") pointer[i]->NonVirtualGetInt()
if (cs == "Derive1") (Derive1*)pointer[i]->NonVirtualGetInt()
if (cs == "Derive2") (Derive2*)pointer[i]->NonVirtualGetInt()
}<br />
I'm sure you get the general idea. One thing that helps me in these cases is to always keep in mind that the compiler can only act on what it knows - so if it thinks an object is of type Base it will call Base-methods, unless the methods are virtual
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
ng kok chuan wrote:
pointer[0] = *(new Base);<br />
pointer[1] = *(new Derive1);<br />
pointer[2] = *(new Derive2); and so on...
This what is known a late binding
ng kok chuan wrote:
the type of classes are created correctly when the constructors are called. however, when i tried to access the pointers again later in my program, the program only treats each pointer as Base and no longer as any derived classes. thus polymorphism cannot work at all... this is crucial to me as i have several classes that's supposed to belong to the vector of pointers. if i use a simple array polymorphism works. but i need the vector.
How about putting the virtual before the name of the function (in the base class)
ng kok chuan wrote:
vector < Base* > pointer)<br />
pointer[0] = *(new Base);
doesn't make sense
Surely, it shold be
pointer[0] = new Base;
Anyway, I got a sample app to give you an idea. If you e-mail I'll gladly send it to you.
Happy programming
Alton
|
|
|
|
|
I am writing C++ wrapper for libCURL to send https requests to the webserver.
Currently i am finding some help on client cert authentication using the same. Please let me know if anybody has done in this.
|
|
|
|
|
I need to compress an avi file using a video codec in my application
how can I do this
|
|
|
|
|
I'm a relatively new programmer and I was wondering if there was an easy way to read a text file of numbers seperated by spaces into a matrix. Here's what I got:
int i, j;<br />
short ImageArray[IMAGE_SIZE_X][IMAGE_SIZE_Y];<br />
<br />
char *FileName = C:\Image.asc;<br />
<br />
ifstream ImageFile;<br />
ImageFile.open(FileName);<br />
<br />
for(i=0; i<IMAGE_SIZE_Y; ++i)<br />
{<br />
for(j=0; j<IMAGE_SIZE_X; j++)<br />
ImageFile >> ImageArray[i][j];<br />
}<br />
ImageFile.close();
I know I'm reading it wrong but I don't know the correct way to do it. Any help would be greatly appreciated.
|
|
|
|
|
I've seen a few programs out there that are very small in size and actually do something (ex.: .kkreiger)... When I look at their import functions list I see only LoadLibrary and GetProcAddress. The question is: How do you remove all those additional dependencies from your programs (C++)?
|
|
|
|