|
Joaquín M López Muñoz wrote:
How have you determined this ratio?
I determined the ratio this way : I have two 'for' loops in the Child threads, doing some stuff. So when I launch the ChildThread from within the Main, it starts and finishes the first loop in the CT, does one instruction in the MT, does the second loop in the CT, and return for one instruction in the MT. Since the 'for' limit is 102 in both 'for' loops, I had my ratio
Joaquín M López Muñoz wrote:
Please note that it is higly unlikely you're calculating any significative figure within a steyp by step debugging process. Also, the number of instructions per second executed by a thread does not only depend on its priority, but also on the frequency of yielding operations it performs (ops for which the system deems it appropriate to pass the control to another thread till they complete, such as IO APIs.)
That´s exactly what i wanted to know when posting my thread. I thank you very much ...
~RaGE();
|
|
|
|
|
Probably a misimpression caused by debugger. How are you measuring this performance difference? Is the problem that the main thread is sitting in single step mode while the child is executing?
Also, be aware, setting priority is not the same as setting speed. It simply means that when given a choice between the 2 threads waiting for the same resource, the higher priority thread will go first (within limits).
|
|
|
|
|
According to the MSDN On-line, the "Programmer's Reference" installs, by default, a command-line utility called Bitmap.exe as part of ICM 2.0; I am in need of that utility. I've been unable to determine from where this program is installed (i.e., Platform SDK, DDK, Etc...) but I do know that I do not have it on my machine and the MSDN On-line does not indicate where this program can be downloaded from.
Any ideas from what CD I can get this?
Here's the link to the MSDN page that references this program
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/icm/icm_16pc.asp
TIA,
D.
|
|
|
|
|
It is included in the Platform SDK.
On my pc it is in the "Platform SDK install Folder\bin" folder...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thanks for the response. Shortly after having posted this message, we discovered it as well on the Platform SDK CD.
Unfortunately, it does not resolve our issue, even if it's a really cool utility.
Thanks again,
D.
|
|
|
|
|
Hi guys, whenever I place the following code into a module within my project, I get a linker error
(error LNK2001: unresolved external symbol _cmc_logon@36)
The offending piece of code is...
::cmc_logon(NULL,NULL,NULL,NULL,0,CMC_VERSION,NULL,&Session,NULL);
where I have set Session as CMC_Session Session.
I've already included xcmc.h into my project, any ideas on why I'm still getting a linker error?
Just another wannabe code junky
|
|
|
|
|
is there any .lib files missed in Linker options?
Renjith-The CPian.
|
|
|
|
|
Renjith - The CP ian wrote:
is there any .lib files missed in Linker options?
Yep...thanks Renjith I'm slightly embarrassed now.
Regards
Senkwe
Just another wannabe code junky
|
|
|
|
|
Hi everybody,
Q1a: Why does a dialog based MFC app take appr. 1200KB of working memory?!
Q1b: I created an exact copy of this MFC dialog app with Delphi with the exact same functionality and it only aquires 150 KB of RAM... How come Delphi (Pascal) outperforms the living sh*t out of a regular C++ app?
Q2: Within my MFC app I wish to allocate an array of let's say 1 000 000 Things where Things defined as
class Things
{
int m_nType;
int m_n123[3];
}
I do it like this
ptr_things = new Things[1000000];
This, as far as I've understood it, allocates memory this way:
1000000 * (4 bytes + (3 * 4 bytes)) having integers with 4 bytes, correct?
Now, I can see in the task manager (w2k) that the memory used by the app increases violently when this line of code is executed.
BUT, when doing exactly the same thing (not quite, i statically declare a 1000000 array) in Delphi the memory increases only by a few hundred kilobytes.
Can anyone explain this to me please? Feels weird to develop with C++ when Delphi seems to rock the world! Is there another way to allocate more efficiently?
Q3: If I have a lengthy process where I do something like this...
int nSomeStuffCounter = 0;
int nNumberOfLoops = 243;
CString str;
for (int a = 0; a < 3; a++)
for (int b = 0; b < 3; b++)
for (int c = 0; c < 3; c++)
for (int d = 0; d < 3; d++)
for (int e = 0; e < 3; e++)
{
DoSomeStuff();
nSomeStuffCounter++;
str.Format("%d%% done", (int)(((double)nSomeCounter/nNumberOfLoops)*100));
wndStatusText.SetWindowText(str);
}
... it takes very (!) long time for the process to finish where as I remove the status reporing it works quickly. Trivial enough... BUT how can I report the progress of a lengthy process without slowing the process itself down too much? And I don't wanna hear progress bars... they kill the performance of any app. Or am I wrong? Can threading help me here...?
Thx for any advice,
/Tommy
|
|
|
|
|
Tommy Svensson wrote:
Q1a: Why does a dialog based MFC app take appr. 1200KB of working memory?!
Q1b: I created an exact copy of this MFC dialog app with Delphi with the exact same functionality and it only aquires 150 KB of RAM... How come Delphi (Pascal) outperforms the living sh*t out of a regular C++ app?
A1a: MFC is a class library which resides in DLLs. Windows will load these DLLs when you run your app.
A1b: I don't know jack about Delphi, but its probably built on top of the WinAPI. MFC apps add a layer in between you and the API. As far as out performing the living sh*t out of a regular c++ app, I would have to see the performance stats to believe it. Try writing a windows app with the API in c++ and see which one wins.
Tommy Svensson wrote:
Q2: Within my MFC app I wish to allocate an array...
BUT, when doing exactly the same thing (not quite, i statically declare a 1000000 array) in Delphi the memory increases only by a few hundred kilobytes.
I don't believe this for a second. Besides, a class is different than an array so I wouldn't expect it to be the same. I just doubt that Delphi only allocates a few hundred kb.
Tommy Svensson wrote:
Feels weird to develop with C++ when Delphi seems to rock the world!
Someone kick this guy in the crotch for me.
Tommy Svensson wrote:
Q3: If I have a lengthy process where I do something like this...
A3: If you want to report the progress, you're going to have to sacrifice a little speed. GDI is not the fastest thing in the world so updating text or a progress bar using GDI is going to suck some speed out. Threading will help, but it will still be slower than having no updates at all.
Tommy Svensson wrote:
Thx for any advice,
This is a c++/mfc forum, I suggest you take the "Delphi kicks MFC a$$" attitude elsewhere.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
Jason Henderson wrote:
Tommy Svensson wrote:
Feels weird to develop with C++ when Delphi seems to rock the world!
Someone kick this guy in the crotch for me.
I'm not saying I favour Delphi; what I AM saying is that Delphi apps at first sight appears to be smaller, at least as efficient as VC++ apps and requires less working memory... that's all. And I was just waiting for a serious answer to prove my discoveries wrong because I know, by rumours and democratic majority, that VC++ should be the thing rocking the world.
Jason Henderson wrote:
This is a c++/mfc forum, I suggest you take the "Delphi kicks MFC a$$" attitude elsewhere.
This is a Visual C++ forum and I do believe my posts regarding VC++ belong here, don't you think?
Be well now,
/T
|
|
|
|
|
Tommy Svensson wrote:
Feels weird to develop with C++ when Delphi seems to rock the world!
Then, why are you trying to develop in C++ ?
Tommy Svensson wrote:
the memory used by the app increases violently when this line of code is executed
Did you really expect a "Hey, you won´t fool me, guy !" dialog to appear on the screen ?
Tommy Svensson wrote:
BUT, when doing exactly the same thing (not quite, i statically declare a 1000000 array) in Delphi the memory increases only by a few hundred kilobytes.
The difference is in the "not quite" and in the "array". You have actually constructed a million objects, and therefore used memory for that. Declaring an array just say the heap not to use a range of addresses which will be used to store data. Try filling your Delphi array with something, and watch how memory app increases ...
Tommy Svensson wrote:
BUT how can I report the progress of a lengthy process without slowing the process itself down too much
Do it in Delphi.
~RaGE();
|
|
|
|
|
Rage wrote:
Then, why are you trying to develop in C++ ?
I only said Delphi seemed to rock the world. I know it shouldn't but all I saw was telling me it was.
So, what I wanted you to tell me [gee, why wasn't I more clear about this], was some facts to show me just how much better VC++ are.
Cheers,
/T
|
|
|
|
|
Q2. Sounds like Delphi is doing a virtual allocation. There is code available at CP here to do the same thing in C++, I just can't find the url.
Q3. Your updating the status bar far too often. Try putting it 3 loops farther out, or an if condition that updates only every 1% increase etc. That will give a much smaller hit on performance.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Tommy,
I have developed in both languages for several years now, Delphi more than C++, so I do have an answer for you:
As you've already read, MFC applications load the MFC DLL into memory when an application starts up, verse a Delphi application that's linked to the VCL statically (which only includes the code needed to run the application). If you build your Delphi application so you have to dist the packages, you'll see the same kind of result as an MFC application. If you really want to compare "apples to apples" you need to code a WTL Dialog application and then run them side-by-side.
In terms of "speed of execution" I am afraid you are incorrect. The last time I checked performance of a MFC Application verse a Delphi application, C++ ran 50 million lines of code per second verse Delphi's 20 million per second. When Borland, now Inprise, introduced that C++ Builder / Delphi IDE integration, they screwed the execution speed some how and Delphi actually became slower ( I believe Delphi originally executed at like 30 million lines/sec). This is code execution time, not compile time; Delphi's compiler smokes the daylights out of the C++ Compiler even with Precompiled Headers, I'll give Borland that much.
Regardless of that, speed of execution is why people like John Carmack develop in C++ and not Delphi, and why I've started to develop in VC++ myself. Well, that and the fact that I can hook directly into ANY new SDK MS releases without waiting for a "port" like Delphi developers do.
It's good see that you're "trying" to develop in VC++, keep at it; I too used to have similar questions when I made made the jump from Delphi, but once you've started to really dig into C++ you'll understand why "the dark side is more powerful".
Join us Tommy ... you don't know the power of the dark side. Let go of your feelings for Delphi, give in to your hatred for Microsoft. Join us.
<insert evil="" laughter="" here="">
( I know, I need a great deal of help )
D.
|
|
|
|
|
Thx for a serious reply!
My feelings for Delphi are long gone, but an old program I hade written using Delphi needed to be re-written using VC++. It was then that I discovered the differences that appeared to be favourable on behalf of Delphi.
Cheers,
/T
|
|
|
|
|
Tommy Svensson wrote:
Q1a: Why does a dialog based MFC app take appr. 1200KB of working memory?!
Because it loads the MFC dll, so there is a big price for entry into an MFC app. A Win32 app will be leaner, but more complex to code.
Tommy Svensson wrote:
Q1b: I created an exact copy of this MFC dialog app with Delphi with the exact same functionality and it only aquires 150 KB of RAM... How come Delphi (Pascal) outperforms the living sh*t out of a regular C++ app?
It doesn't. You're just not aware of where the 1200kb came from. A 'regular' C++ app and an MFC app are two different things. Try it using WTL or Win32 and you'll see differently.
Tommy Svensson wrote:
Feels weird to develop with C++ when Delphi seems to rock the world!
HAHAHAHAHAHAHAHAHAHAHAHAA !!!!! Go develop in Delphi then.
Tommy Svensson wrote:
Can threading help me here...?
No, not really. I would be reporting outside of that inner loop - no-one needs status reports THAT quickly. I'd report at about the 'c' loop.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Hello every one !
I'd like to use a CListCtrl in my application, but the way it is displayed is not useful for me because it should be blue instead of gray.
I looked in previous posts but I haven't found what I'm looking for : getting the scrollbars from the CListCtrl with the function GetScrollBarCtrl(...) is almost impossible, according to me...
If someone has tried to do something approaching, please answer me because I don't know where I should look...
Thank you in advance
Joe
|
|
|
|
|
you can try reading this
http://msdn.microsoft.com/msdnmag/issues/01/11/c/c0111.asp
|
|
|
|
|
Thank you for your answer.
I read that and if I understand well, I shall begin a CScrollBar child class from scratch...
I think I will handle it in another way....
I actually began in this way :
A <--- This a button to scroll up
| <--- This a background bmp
|
[] <--- This a button (the box showing the current position in every scrollbar)
| <--- This the same background bmp
V <--- This another button to scroll down
It's a bit messy but I've already done that for a slider, and that works well, so why not ?...
My only problem is to get rid of those f*#@^" srollbars inside the CListCtrl
(disabling them by checking the 'No scroll' check box won't help : I won't be able to send some WM_VSCROLL to the CListCtrl...)
If anyone has any idea...
|
|
|
|
|
In my MDI application, I have a need to send a message from one open document to another (also open, but of a different class). I believe the way to do this is to get the parent frame (pointer) and then use EnumChildWindows() to get handles to all the child windows (presumably from ALL open documents) and use the callback function to analyse the titles of each window to find the correct one. My code is as follows:-
void CIRCDoc::OnTapeMove()
{
// TODO: Add your command handler code here
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
HWND hWndParent = pFrame->GetSafeHwnd();
//pFrame->SetWindowText("Hello Mum !!"); // DOES set mainframe title
BOOL bResult = FALSE;
LPARAM lParam = (LPARAM)(&bResult);
BOOL rc = EnumChildWindows(hWndParent, EnumChildProc, lParam);
}
BOOL CALLBACK CIRCDoc::EnumChildProc(HWND hwnd, LPARAM lparam)
{
TCHAR* pSaveText = new TCHAR[20+1];
BOOL rc = GetWindowText(hwnd,pSaveText,20);
DWORD wErrorResult = 0;
if(!rc)
wErrorResult = GetLastError();
delete pSaveText;
return TRUE; // keeps enumeration going
//SendMessage(hwnd,WM_SETTEXT,0,(LPARAM)"Test");
}
Although I get non-zero values for hwnd returned, the call to GetWindowText always fails and GetLastError() gives me ERROR_INVALID_PARAMETER. The other thing that I don't understand is that I get 10 calls to EnumChildProc even though there are only 2 documents open within the MDIFrame window. I'll almost certainly kick myself afterwards, but can anybody show me where I've gone wrong ?? What's wrong with my code ??
Doug
|
|
|
|
|
Use this other HWND as the root for EnumChildWindows :
void CIRCDoc::OnTapeMove()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
HWND hWndParent = pFrame->m_hWndMDIClient;
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried the suggestion of using m_hwndMDIClient as the argument for EnumChildWindows(), but I still get the same failure on GetWindowText() contained within the EnumChildProc(). (For reference, the failure return by GetLastError() is ERROR_INVALID_PARAMETER).
I've checked that the GetWindowText() works O.K. on pFrame, so the error MUST be on the hwnd parameter of EnumChildWindows(). However, using m_hwndMDIClient, I now only get 4 calls to EnumChildProc() rather than the previous 10, but the value of hwnd is the same on all 4 !! What IS going wrong with the enumeration ???? (Apologies if this seems trivial, but I've never enumerated windows before !)
My updated code is as follows :-
void CIRCDoc::OnTapeMove()
{
// TODO: Add your command handler code here
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
//pFrame->SetWindowText("Hello Mum !!"); // DOES set mainframe title
BOOL bResult = FALSE;
LPARAM lParam = (LPARAM)(&bResult);
// BOOL rc = EnumChildWindows(hWndParent, EnumChildProc, lParam);
rc = EnumChildWindows(pFrame->m_hWndMDIClient, EnumChildProc, lParam);
}
BOOL CALLBACK CIRCDoc::EnumChildProc(HWND hwnd, LPARAM lparam)
{ TCHAR* pSaveText = new TCHAR[20+1];
BOOL rc = GetWindowText(hwnd,pSaveText,20);
DWORD wErrorResult = 0;
if(!rc)
wErrorResult = GetLastError();
delete pSaveText;
return TRUE; // keeps enumeration going
//SendMessage(hwnd,WM_SETTEXT,0,(LPARAM)"Test");
}
Doug
|
|
|
|
|
How I add button(text) on toolbar(IE) more than one ?
Please give me some example that using TB_ADDSTRING, TB_INSERTBUTTON.
Thanks a lot for your kindness
|
|
|
|
|
hi .. can any one tell me how to use splash screens in my programme
ive tried using class ceditview.. but to no avail.
telll me how to manage this.. and if some one could give ma the code ... dat will be great then
looking forward from all the gurus of code
|
|
|
|
|