|
PJ Arends wrote: it should return a reference to the current object.
Could you explain why ?
thank you in advance.
|
|
|
|
|
A good C++ book will explain it better, but the main reason is so that you can chain the operators. ie. one can do
MyObject1 = MyObject2 = Generate_temp_MyObject(); If MyObject::operator =() returned void then MyObject1 would not get assigned the value returned by Generate_temp_MyObject() .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
|
There are some good example in VB to get the
window title .
But u need constantly check for all windows
title or anyhow get the handle of the window
of ur game .
In VB ur work will be fast , never seen such
code in VC but its possible in VC
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
First of all Merry Christmas!
I noticed something weird in Visual Studio 2005. I haven't test my code in previous versions so I cannot confirm whether its merrit of VS2005 or else.
Ok, I have a dialog box application with 2 modeless dialog boxes which are created before the main dialog box in the application. I noticed there are 2 extra threads in the application with names "ThreadStartRoutine" and CRpcThreadCache::RpcWorkerThreadEntry" both at location _KiFastSystemCallRet@0 as shown in debug mode.
These 2 threads are created during the creation of the main dialog box in DoModal() function. I traced the exact creation point to Line 306 at dlgcore.cpp:
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
Which is inside this function:
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
My question is what are these 2 threads for? and why are they created?
Any insight appreciated!!
Rob
|
|
|
|
|
My guess would be that the CRpc* stuff is related to Remote Procedure Call support in the MFC libraries. I'm pretty sure I've seen this before with MFC 7.1 apps. The other function, I have no idea.
Software Zen: delete this; // <a href="http://www.codeproject.com/script/profile/whos_who.asp?msg=1307432&id=10338#xx1307432xx" rel="nofollow">Fold With Us!</a>[<a href="http://www.codeproject.com/script/profile/whos_who.asp?msg=1307432&id=10338#xx1307432xx" target="_blank" rel="nofollow" title="New Window">^</a>]
|
|
|
|
|
Why is it of concern to you? let the library do anything as long as it accomplishes the things you want.
Vipin - MVP
|
|
|
|
|
Hello,
I need to make a *.bmp file out of my CBitmap file. I do not know about bitmaps so much and i cannot make conversions between different types. Can someone help me?
Thanks in advance
|
|
|
|
|
You can't save the CBitmap as it is into a file. You will have to convert the CBitmap which is a DDB into a DIB. The bytes for the pixels in the CBitmap are device dependent, only the graphics driver knows how to interpret the pixel values(RGB) corresponding to what a byte or triplet denote. So the first step would be to convert to a DIB. To do that, you will have to use the GetBitmap(...) method on the CBitmap and then get the DDB bitmap's dimensions. You should then create a DIB, this is normally done using CreateDIBSection(...), you should fill in the BITMAPINFOHEADER and then be done with creating the BMP with the right color depth. I would then BitBlt between a device context having a DDB into another memory device context having the DIB and the underlying graphics driver or DI would convert the DDB(your CBitmap)to DIB. You can now save the DIB to a file.
Well the above are the fundamental set of operations to do it. There are already built-up classes here in codeproject. Have a look at this article "CDibData", linking to which you can get what you want.
http://www.codeproject.com/bitmap/jscdibdata.asp[^]
Microsoft - MVP
|
|
|
|
|
Articles at CP (Bitmaps & Palettes): CxImage, CDibData, "Saving a Drawing to a Bitmap File". There are probably others.
INTP
Every thing is relative...
|
|
|
|
|
Hi everybody
In the SetSite method, of one tool band implementation, how i can get a pointer of IConnectionPointContainer.
|
|
|
|
|
QueryInterface
the site should support IWebBrowser2 and IConnectionPointContainer
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
I cannot figure out the syntax of passing CArray pointer to a function.
Can anybody point me to a source of info?
Thanks
Vaclav
|
|
|
|
|
The * goes after the type name (doesn't matter if it's a template class or not, the rule is the same):
CArray<double,double*>*
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Shots do not hurt other players... yet
|
|
|
|
|
Thanks, I'll give a try.
Vaclav
|
|
|
|
|
Hello,
In addition to what Micheal Dunn said, typedefs make your life more easy when you use templates extensively:
typedef CArray<double, double> CArrayDouble;
CArrayDouble* pArrayDouble = new CArrayDouble();
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hey Friend
I have a dialog based MFC application with a Edit box. User can input TCL scripts into this Edit box. I want to add a feature in this, by which if a User types in a TCL script line starting with "#", then the entire line should change its color to Green. Because a "#" symbol in TCL is a comment symbol. I used OnChar() function to get the User input character, and i can recieve each character from key board.
The block for me in now is how to change the color of a character and then display it in Edit box. Can anyone please help me?
Don
|
|
|
|
|
This is the kind of stuff rich edit controls can do. See CRichEditCtrl::SetSelectionCharFormat() and the like.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I have already added the Edit box in my app, and added many functionalitites. If i remove the Edit box now and replace it by RichEdit, will it cause any problems?
Is there any simple sample application which shows how this can be done in RichEdit?
|
|
|
|
|
dipuks wrote: If i remove the Edit box now and replace it by RichEdit, will it cause any problems?
It should not cause any problems. You just have to make sure you set up the rich edit control properly. Call AfxInitRichEdit2() in your app's InitInstance(), and then call CRichEditCtrl::SetEventMask() so the control sends the messages you want to handle.
dipuks wrote: Is there any simple sample application which shows how this can be done in RichEdit?
You could look here[^] for examples, there may even be one that does exactly what you need.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I would suggest you to use control subclassing , just derive new CEditEx class from CEdit , and add SetTextColor method to it.
[CEditEx.cpp]
...
ON_WM_CTLCOLOR_REFLECT()
...
HBRUSH CEditEx::CtlColor(CDC* pDC, UINT nCtlColor)
{
HBRUSH hbr;
hbr = (HBRUSH)m_brBrush;
pDC->SetTextColor(m_clrTextColor);
return hbr;
}
...
void CEditEx::SetTextColor(COLORREF clrTextColor)
{
m_clrTextColor = clrTextColor;
Invalidate();
}
then simply override the WM_CHAR message handler of your Dialog
and use the m_editEx.SetTextColor(RGB(0,128,0)) method where needed.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Thanks for you reply.
I tried the way you have sugested. But SetTextColor will set the GREEN color to entire text in Edit box. Rather than doing to one single line.
Any other way of setting to single lines?
|
|
|
|
|
dipuks wrote: Thanks for you reply.
You are welcome
dipuks wrote: Any other way of setting to single lines?
In that case you'll need what PJ Arends suggested to you , look here[^] and here[^] they seem to be useful to you.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Hi!
After reinstalling my PC I downloaded the latest SDK (I used the "August 2002"-SDK before), installed it and set the directories to the SDK. When I try to compile my applications I get several errors, e.g. CWnd::KillTimer() does not exist. Has anybody the same problems? Or do you have any source for the "August 2002"-SDK (which worked quite well for me).
Ciao,
Alex
|
|
|
|