|
Raphaël Kindt wrote:
But normaly a class define his default copy constructor
Compiler generates default and copy constructor for you, but only if you haven't created *any* constructor in your class. Since CYourException had an c'tor accepting integer, compiler didn't create default/copy constructors.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Tomasz Sowinski wrote:
only if you haven't created *any* constructor
Quoting Mr. Eckel: "...the compiler will automatically synthesize a copy-constructor if you don’t provide one yourself..."
|
|
|
|
|
You're right on this one. Apparently this rule doesn't apply for VC handling of exceptions thrown by value. Have no idea how does it relate to C++ standard.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Change the Warning Level, maybe more messages will help u debug:
To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click General in the Category box.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
try
throw new CMyException(2)
Regards
|
|
|
|
|
How can I use accelerators in my dialog? I added a accelarator table in the resource editor and called it IDR_MAINFRAME. What do I need to make it work? I assigned some keys and IDs, also I have WM_COMMAND handler for those IDs.
Do I need to load the accelerators? What is virtkey?
|
|
|
|
|
In MFC accelerators can only be used in frame windows and their descendants because all accelerator translation happens deep down in the main message loop. Since (modal) dialogs have their own message loop, accelerators defined in the resource file do not apply. Maybe you can use a modeless dialog, but I'm not sure that will work as expected...
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
MFC modal dialogs are actually modeless ones at the API level since MFC 4.0. One of the reasons for this design decision was the ability to hook into message queue with PreTranslateMessage.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
You'd have to load the accelerators with ::LoadAccelerators, store the HACCEL in dialog member variable, override CYourDlg::PreTranslateMessage and call ::TranslateAccelerator in overriden function.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Tomasz Sowinski wrote:
You'd have to load the accelerators with ::LoadAccelerators, store the HACCEL in dialog member variable, override CYourDlg::PreTranslateMessage and call ::TranslateAccelerator in overriden function.
BIG thanks, that's really easy once you have it.
May I ask two more question for understanding:
1. What is the magic on main accelerator table IDR_MAINFRAME? Does it get somewhere autoloaded?
2. What is the function GetAccelTable() as mentioned in MSDN Q117500? I do not have this member function.
|
|
|
|
|
1) CFrameWnd::LoadFrame calls ::LoadAccelerators (indirectly, there's CFrameWnd::LoadAccelTable which basically invokes ::LoadAccelerators with right HINSTANCE). Accelerators are loaded along with other frame resources.
2) It's documented at the bottom of the article. It's a function which returns CFrameWnd::m_hAccelTable. Since m_hAccelTable is public anyway, you can replace GetAccelTable with m_hAccelTable.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Thx for details, Tomasz! I got everything working.
However I have no GetAccelTable(), so I used the public member CFrameWnd::m_hAccelTable and it works fine.
|
|
|
|
|
Hi,
Does anyone know if there exists a list of Win32 API functions that are implemented differently in WinXP than WinNT/Win9x?
I am especially interested in subtle differences in the API functions that deal with windows.
|
|
|
|
|
I don't think you'll find one. The best you can count on are the footnotes in MSDN describing differences in particular APIs on 9x/NT. This also applies to WM_ and other message docs.
Anyway, if you find the list, let us all know
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Hi all,
Does anyone could tell me where I should write 'CLARM /QRxscale' down in eVC++ 4.0.
'Cause I need to write a app. running in WinCE with XScale CPU.
Following SDK reference, I should add this command line to generate code for Intel XScale processor, but I don't know where I should place this line.
Anyone can help me?
Thanks a lot.
|
|
|
|
|
Just try to add the command 'CLARM /QRxscale' in the 'C/C++' or 'Linker' (--> Project Options) tab of the project settings.
--
Nice greets, Daniel.
|
|
|
|
|
I added the command in 'Project Options'(Project->Settings->Link tab) but the complier show a warning message 'unrecognized option'????
Could you please tell me how to declare this command ?
Thank s lot.
|
|
|
|
|
Sorry, I have never tried it... I must take a look...
--
Nice greets, Daniel.
|
|
|
|
|
I want to generate random number between 1- 400,000 which is not the same value.
Example.
If X1 = 254899
X2 not have the same value as X1.
and X3 not have the same value as X1 and X2 .
I want to generate data X1 - X400,000 which not have the same value and each data have value between 1-400,000
If you know how to do that, please tell me. Thank you.
|
|
|
|
|
Create vector of integers containing 400,000 elements and initialize it with ordered values from 1..400,000 range. Call std::random_shuffle. Make some coffee and wait.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
i vote for a Vodka!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
I trying to draw a text on a button. I have code:
-------------------------------------------------------
CRect re = di->rcItem;
CBitmap cbm, *obm;
CDC cdc, mdc;
CFont *cf;
cdc.Attach(di->hDC);
mdc.CreateCompatibleDC(&cdc);
cbm.CreateCompatibleBitmap(&cdc, re.Width(), re.Height());
obm = mdc.SelectObject(&cbm);
mdc.FillSolidRect(re, GetSysColor(COLOR_BTNFACE));
mdc.SetBkMode(TRANSPARENT);
mdc.SetTextColor(m_textcol);
//mdc.SetBkColor(m_bkcol);
cf = mdc.SelectObject(&m_font8);
mdc.DrawText(m_strregion2, re, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
cdc.BitBlt(re.left, re.top, re.Width(), re.Height(), &mdc, 0, 0, SRCCOPY);
mdc.SelectObject(obm);
cdc.Detach();
--------------------------------------------------
It works fine. But my problem is how to adjust the size of the text based on the above code?
Thanks in advance!
chen
|
|
|
|
|
GetTextExtentPoint32 ???
AFAIK this function computes the width and height of the specified string of text.
|
|
|
|
|
Ok Let's say i have two functions contained in a DLL and an .EXE that calls them.
Then I decide to update this DLL, and add another, third function to it.
Is there any way to make the .EXE aware of this new function without replacing the whole .EXE? Can I get a list of functions dynamically from the DLL and use them form the exe?
Any help or pointers would be really appreciated.
Regards,
Venet.
Donec eris felix, multos numerabis amicos.
|
|
|
|