|
Did you search on the codeproject it has good articles.
|
|
|
|
|
yes i searched through and got one MDI application who does exactly what i wanted but he paints customised title bar on exhisting default bar by using subclass technique by Paul DiLascia(MS journal).
my client doesnt allow me to add custom class for this kind of need.
|
|
|
|
|
SDI, can't CMyApp::OnFileNew handle the the click message by the button?
int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
...
m_btnNew.Create(NULL,style,rcDummy,this,ID_FILE_NEW);
m_btnNew.LoadBitmaps(IDB_NEW,IDB_NEW_DOWN);
}
|
|
|
|
|
Hi,
have you mapped the WM_COMMAND to CWinApp::OnFileNew.?
thanks
Nitheesh
|
|
|
|
|
No, I just created a button using ID_FILE_NEW.
|
|
|
|
|
hi,
then u have to map the WM_COMMAND for the Button Id in following way. ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew)
thanks
Nitheesh
|
|
|
|
|
It's there in CMyWinApp as part o fthe framework.
I don't why the message is not pumped there.
|
|
|
|
|
Hi,
this is because the BN_CLICKED message is posted into the Parent Windows message queue. that is why the message is not getting into CWinApp.
thanks
Nitheesh.
|
|
|
|
|
But CWinApp::OnFileNew is a protected member function, so I couldn't add the following line to CMyView :
ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew);
any quick way?
|
|
|
|
|
I found the problem,
If a view receives a message it will go through the view's and doc's msg maps, the app's msg map will not be searched.
|
|
|
|
|
<br />
vector<int> myIntVector;<br />
vector<int>::iterator myIntVectorIterator;<br />
<br />
myIntVector.push_back(1);<br />
myIntVector.push_back(4);<br />
myIntVector.push_back(8);<br />
<br />
for(myIntVectorIterator = myIntVector.begin(); <br />
myIntVectorIterator <= myIntVector.end();<br />
++myIntVectorIterator)<br />
{<br />
cout<<*myIntVectorIterator<<" ";<br />
}<br />
|
|
|
|
|
This code crashes on windows.
while on gcc 2.95.3 on unix
I get an output like
1 4 8 0
|
|
|
|
|
vikrams wrote: while on gcc 2.95.3 on unix
I get an output like
1 4 8 0
That's wrong. The code should throw an exception because you try to access the contents of an iterator outside the bounds of your vector.
|
|
|
|
|
Cedric Moonen wrote: That's wrong. The code should throw an exception because you try to access the contents of an iterator outside the bounds of your vector.
The C++ standard does not require an exception to be thrown in this case. The behaviour is undefined.
Steve
|
|
|
|
|
vikrams wrote: while on gcc 2.95.3 on unix
I get an output like
1 4 8 0
I think your gcc 2.95.3 sucks and you should stop using it right now.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
What's the problem ?
Anyway, AFAIK, you can only check for equality on iterators (don't know if that is the case also on vector iterator). This your end loop condition should be:
myIntVectorIterator != myIntVector.end();
EDIT: I tested and you can do that with vector iterators (for list iterators, you can't). Anyway the problem is that you have to stop incrementing your iterator before the end of your vector. So replace <= by < . Otherwise, if you are at the end of your vector (not a valid element), you will still try to access the contents of the iterator (which is invalid).
|
|
|
|
|
You are going past the end of the iterator, change the code to something like this:
vector<int> myIntVector;
myIntVector.push_back(1);
myIntVector.push_back(4);
myIntVector.push_back(8);
vector<int>::iterator iStart = myIntVector.begin();
vector<int>::iterator iEnd = myIntVector.end();
while(iStart != iEnd)
{
cout << *myIntVectorIterator << " ";
++iStart;
}</int></int></int>
|
|
|
|
|
Thanks for your suggestions guys !
|
|
|
|
|
HI all,
i want to call a dialog box when i pressed a button which is at bottom side,the dialog box should be positioned on exact upper part of the button
how could i do dis?
plzzzzz help me
Pankaj
modified on Friday, April 11, 2008 6:36 AM
|
|
|
|
|
You can use of DoModal or ShowWindow after you clicked button and then use of MoveWindow.
|
|
|
|
|
Hello everyone,
Here is the comments from the book ATL Internals about in-process server considerations,
--------------------
Any thread that calls CoGetClassObject or CoCreateInstance must already have joined an apartment, or the call will fail immediately. So, does that mean all objects exposed from in-process servers must be equally at home in single-threaded and multithreaded apartments so that random clients isn't cause harm? Fortunately, no.
--------------------
Does it mean COM client (thread) and COM server no need to be the same type of thread model (e.g. STA, MTA, etc.)?
thanks in advance,
George
|
|
|
|
|
George_George wrote: Does it mean COM client (thread) and COM server no need to be the same type of thread model (e.g. STA, MTA, etc.)?
No. If the threading models are compatible direct communication occurs. If the threading models are incompatible the object is created in an apartment it can "live in" and the interface pointer is marshaled back to the caller -- communication occurs via a proxy and stub. This is one of COM’s key features.
Steve
|
|
|
|
|
Thanks Steve,
How do you understand the quoted statements from my original question?
regards,
George
|
|
|
|
|
I'm just going off my knowledge of COM.
Steve
|
|
|
|
|
Are you kidding, Steve? You are COM expert, I know. How do you understand the statement in the book?
regards,
George
|
|
|
|