|
I got a failure notice on the email.
1. I would agree with this. But to be perfectly honest, when I goof up my printfs, it is usually quick to fix. But I would attribute that more to experience. That old CString in a printf bug can sink someone who has never see it for a LONG LONG time.
2. I was actually very very very shocked and a little suspect of the endl performance (or lack there of). There might be something else going on that isn't the fault of STL. Just as an FYI, I opened "NUL:" as my output file. I had to add ::app as an open flag with the output stream to get it to open. If it wasn't for that one small problem, it is a slam dunk that iostreams is faster. As is, iostreams are faster as long as you are careful.
One day people will learn to never mention that X is faster than Y around me. Because I will test it. I don't care who turns out to be wrong or right, I want solid figures.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
One day people will learn to never mention that X is faster than Y around me
And what do you think about this interesting article?
I vote pro drink
|
|
|
|
|
Without reading it, my first thought is that without some hard numbers, it is really hard to say what performs well and what doesn't. When I have a chance I will read it.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Oh dear god, I just read some of the code and the guy has made some huge mistakes already (i.e. since when does a constructor allocate memory for itself).
I just read more. It makes me wonder what sucky ass compiler he is using. A lot of the stuff he talks about doesn't even apply to VC. For example, VC uses ECX to pass around the this pointer. Thus, as long as you are calling methods within the same class instance, you get a performance boost since you aren't having to push 'this' around. However, if register allocation gets a little tight, you might see this stuck in ESI, EDI, or event on the stack as a local variable (probably any register will be used, I just see ESI and EDI used a lot).
Another example is his v-table. VC uses thunking to get around the multiple inheritence problem. So, when you don't have multiple inheritence, there isn't any performance hit over and above the fetching of the routine address from the v-table. Also, there isn't a performance hit if you are invoking a method for the first base class in the list. All the thunk code it a test for this == NULL, if not, then it is adjust by an offset and then a simple JMP to the real routine.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
it´s my recording session again : I need the accelerator character of a toolbar button.
Does anyone know how to retrieve the character if you only have the button id?
Regards,
Amar Bouchibane
|
|
|
|
|
If in a doc/view app, GetParentFrame()->m_hAccelTable is a HACEL handle to the current accelerator table. Use <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/winui/keybacel_5r39.asp">CopyAcceleratorTable</a> to dump this table into an array of ACCEL s structures and look for the accelerator you're after.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, Joaquín!
But when I try this...
CFrameWnd* pFrWnd = pToolbar->GetParentFrame();
HACCEL hAccl = pFrWnd->m_hAccelTable;
...
pFrWnd is null. What I´m doing wrong?
(pToolbar is a pointer to a CToolBarCtrl)
|
|
|
|
|
Ummm... Please try AfxGetMainWnd instead.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
AfxGetMainWnd() returns always NULL.
Does only the frame window holds the pointer to the active accelerator table?
Or is there any other place where I can find the HACCEL handle?
For you to remind... I have to program a windows recorder, that is I need information about all the accelerator hotkeys of the foreground window where my recorder´s embedded in.
Best regards,
Amar
|
|
|
|
|
I have a number of MFC applications that use form views to enter data into a database. These all use static lib MFC.
I have a number of forms that are needed in more than one application. What is the best way of sharing resources and their associated CFormView derived classes across projects.
In the past I've used MFC Extension DLLs but keeping the resource id's in different ranges became a pain.
Would one resource DLL for all the applications be a good idea (The apps are all part of one product)?
Suggestions?
Michael
|
|
|
|
|
There's an additional option that (IMHO) simplifies things further. Why not have resources and its additional CDlg -derived classes inside a regular MFC DLL and export a high-level C API along this line:
int PersonalDataDialog(PERSONA_DATA_STRUCT *pPersonalData); If you can follow this scheme, I'd say it is the most easily maintainable approach.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Michael P Butler wrote:
In the past I've used MFC Extension DLLs but keeping the resource id's in different ranges became a pain.
There's a tool created by Andy Metcalfe called Resource Organizer.
Michael P Butler wrote:
Would one resource DLL for all the applications be a good idea (The apps are all part of one product)?
This has the advantage when you plan to have multiple language versions of your product.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I do that when work with diferent languages.
I put the resource into dlls, and share it from the dll....
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I'm sure this is a basic interface mistake, but if anyone could shed some light on it I'd be very grateful.
I've got an existing dialog with 5 radio buttons on it, I need to put on a sixth radio button, but when I do I can have the new one selected with one of the others selected (instead of only one as intended). Can anyone let me know how to get this new radio button to be part of the group that the others are in?
TIA
Dylan Kenneally
London,UK
|
|
|
|
|
You need to go into the .rc file and make sure this radio button is defined in the same group as the others, i.e. move it's defintion before any other controls that have also been added since the radio buttons where added.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
You don't have to edit .rc file manually - just use Ctrl+D to change the tab order.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Does that work ? Changing the tab order will move the radio buttons into a group ? Does changing the tab order change the rc file ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Yes, it works. Radio buttons have to be in one group. First of them must have WS_GROUP bit set. One group ends where another begins, so first control *after* radio buttons must also have WS_GROUP set.
If you add new radio button and set its tab order, everything will work OK.
Christian Graus wrote:
Does changing the tab order change the rc file ?
Absolutely - 'tab order' is actually the order of control statements in .rc.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi there. How i can do this ? My app call another app by ShellExecute. I'm need inform user by msg window if external app end work
|
|
|
|
|
1) Use ShellExecuteEx to get the process handle
2) start the worker thread in your process. The thread will immediately call WaitForSingleObject passing the process handle received from ShellExecuteEx
3) when thread exits from WaitForSingleObject, the external app finished work. PostMessage to the main thread and exit from worker.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hey it's a great idea to start WaitForSingleObject() in a different thread.
But how do I send a PostMessage() to the main thread and which parameters do I need to send?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
#define WM_EXTERNAL_PROCESS_FINISHED (WM_USER + 1)
pMainWnd->PostMessage(WM_EXTERNAL_PROCESS_FINISHED);
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks, you helped me once more
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Read this article. It gives a sample code snippet on what you want to do.
http://www.codeproject.com/useritems/newbiespawn.asp
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Use ShellExecuteEx() instead.
SHELLEXECUTEINFO sei = {0};
sei.cbSize = sizeof(sei);
sei.lpVerb = "open";
sei.lpFile = "yourapp.exe";
sei.nShow = SW_SHOWNORMAL;
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
ShellExecuteEx(&sei);
WaitForSingleObject(sei.hProcess,INFINITE);
WaitForSingleObject will return when the other app has quit
regards
modified 12-Sep-18 21:01pm.
|
|
|
|