|
Thanks for sparing some time.... But isn't this approach similar to previous approach??? Still I have to code a lot at caller side as in last solution... Is there no way to reduce coding at caller side??
|
|
|
|
|
NeoAks007 wrote: Is there no way to reduce coding at caller side??
Not really - you have different return types for the different implementations of func1 - you have to handle those differently. If you want to handle them n the same way, then why not make them the same?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: If you want to handle them n the same way, then why not make them the same?
It cannot be made same because their functionalities are different in different classes... I understand that this is holiday but still if anyone reading this thread comes up with an idea, do post a solution please... I need it seriously..... I am still listening.....
modified on Sunday, March 15, 2009 1:36 PM
|
|
|
|
|
I think you're making this way too complicated. If you change the return type, the code handling that will have to change as well.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
In the End, I had to restructure all my class hierarchies and make the return type same for all functions. So, the problem is now solved!!
|
|
|
|
|
MFC, STUDIO 2008
How to convert CString to int, for example:
CString m_s;
m_s = “1949”;
in i;
i = itoa(m_s); - uncorrectly
char m[5];
strcpy(m,m_s); - uncorrectly
|
|
|
|
|
It's atoi [^]:
CString m_s = _T("1949");
int i = _tstoi(m_s);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
You are welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all
I have to develop windows device driver for PCI card.Can anybody suggests a starting point for doing it.
Any examples or link
I am having experience in developing a printer driver.
Thanks in advance.
With regards
Deepu
|
|
|
|
|
How to place a Bitmap in the center of a Cdocument document on startup? If tried to find it in codeproject and MSDN but neither shows what I want. I want to place the Bitmap in the center of the document when the program loads(opens). could someone show me code for doing this in MFC? Please.
Thanks in advance. The ID of the Bitmap is IDB_FRACTK.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Look around for a "splash screen" (here or using google...), is that what you mean?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
No this is NOT what I'm looking for. I once saw an article that displayed a Bitmap in the CDocument/View interface, but I've lost it somehow. I'll keep hoping someone has one and meanwhile I'll keep looking.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I'm still not sure what you mean but...did you try overwriting the OnPaint method of your view class (or OnDraw maybe?) and do something like this:
CBitmap bitmap;
bitmap.LoadBitmap(IDB_WHATEVER);
CDC MemDC;
MemDC.CreateCompatibleDC(&dc_of_view);
CBitmap *originalBitmap = MemDC.SelectObject(&bitmap);
BITMAP bitmapInfo;
bitmap.GetBitmap(&bitmapInfo);
CRect Rect;
GetClientRect(&Rect)
dc.BitBlt(Rect.CenterPoint().x - bitmapInfo.bmWidth / 2,
Rect.CenterPoint().y - bitmapInfo.bmHeight / 2,
bitmapInfo.bmWidth,
bitmapInfo.bmHeight,
&MemDC,
0,
0,
SRCCOPY);
MemDC.SelectObject(originalBitmap);
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes, that's exactly what I was looking for. Question?: everytime the bitmap gets covered what command do I use to redraw it? (UpdateWindow??)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Once again i am not sure what exactly do you mean but to trigger redrawing of your view you can either use RedrawWindow[^] or InvalidateRect[^] (maybe in conjunction with UpdateWindow right after).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks again.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Windows has triggered a breakpoint in Gobang.exe.
This may be due to a corruption of the heap, which indicates a bug in Gobang.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while Gobang.exe has focus.
The output window may have more diagnostic information.
The text above is the message That show me when i debug my project.
Do any body ever run across problem like this,help me.thanks in advance.
|
|
|
|
|
Hi all,
I want to use SendMessage(). Through CMainFram class object it works fine but using CWinApp class as base class, it doesn't work. It is not giving any error, but SendMessage() is not called.
I use the following code.
CSampleCMSApp * poApp = (CSampleCMSApp*)AfxGetApp();
SendMessage((HWND)poApp,WM_DISP,0,(long)recv_data);
If i use poApp->SendMessage((HWND)poApp,WM_DISP,0,(long)recv_data);, it give error as
error C2039: 'SendMessageW' : is not a member of 'CSampleCMSApp'.
Can i use SendMessge for the class which is derived from base class as CWinApp?.
If yes, how can i do this.
If no, why i can't?
Please reply.
Thanks,
Abhijit
|
|
|
|
|
There are two versions of SendMessage .
One that is global and one that is a member of the CWnd class.
You are getting the error because CWinApp does not directly or indirectly inherit from CWnd , whereas CFrameWnd does inherit from CWnd .
You can use the CWnd member like so
AfxGetMainWnd()->SendMessage(WM_DISP, 0, (LPARAM)recv_data);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
If possible please let me know where can i download book for
MFC written by petzold....i have googled but i didn"t find it...
|
|
|
|
|
You BUY it from a bookshop.
Or maybe the equivalent of amazon.
If you want to steal other people's idea, this is the wrong forum for you.
If you want to buy a downloadable version, I'd encourage you to edit your original question too.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
here u can: www.cpallini.illegal.copiez.of.copyrighted.bookz.com
BTW: you're entitled to use the above site only if your request is urgentz.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I heared your site has everything I need an elephant can I buy it of your site(of course its urgentz PLZ)?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
You know it is www.cpallini.free.elephantz.com, so, why paying for it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|