|
I didn't have any memory leak information when I ran your code. However, to find the source of those leaks, you could try using _CrtSetBreakAlloc to get the runtime to break when the relevant memory allocation is performed. Looking at your text, you need to look for allocations 41 and 42 (the numbers inside the curly brackets).
However, I think you'll find those allocations are made by the C runtime library *before* your code is ever called (I compiled a console application with the line int* a = new int; and that was allocation number 88), so they aren't allocations you need to worry about, because the runtime library clears them *after* your code exits.
|
|
|
|
|
my code:
<code>CComQIPtr<IHTMLDOMNode>pRootNode(lpParentDisp);
CComPtr<IDispatch> spChildren;
if(FAILED(pRootNode->get_childNodes(&spChildren)))return;
CComQIPtr<IHTMLDOMChildrenCollection> pChildColl(spChildren);
long lCount = 0;
pChildColl->get_length(&lCount);
for (long l = 0;l<lCount;l++)
{
CComPtr<IDispatch> spChild;
pChildColl->item(l,&spChild);
CComQIPtr<IHTMLDOMNode> pChild(spChild);
CComQIPtr<IHTMLElement> pElement(pChild); // I don't obtain the point
}</code>
please somebody help me ! thanks........
-- modified at 22:14 Thursday 7th December, 2006
I'm a good man!
-- modified at 22:15 Thursday 7th December, 2006
|
|
|
|
|
Hi,
I've created a com object in ATL ( still learning ). However, somethimes you get to see such nice online installers.
Someone goes to a specific page, gets the error that he needs some files installed on his computer. then in iexplore, a nice goldbar kicks in wich automaticly sends you the nessesary files on accept. even better, they totally install and register themselfs. So how can i create this? i'm using apache 2.* on a debian linux server ( sorry, trying to jump to winserv 2003 any time now )
|
|
|
|
|
1 .write a inf file like this sample:
; Sample INF file for AVJumbee.dll
[version]
; version signature (same for both NT and Win95) do not remove
signature="$Chicago$"
AdvancedINF=2.0
[Add.Code]
AsiaViewFTPCtrl.dll=AsiaViewFTPCtrl.dll /// com dll
; needed DLL
[AsiaViewFTPCtrl.dll]
file-win32-x86=thiscab
clsid={42FD5C77-532D-4BB0-A284-F0D8FB124049} // com guid
FileVersion=1,00,0,3
RegisterServer=yes
; end of INF file
2 download CabArc.Exe file
3 run cmd:CABARC -s 6144 n AsiaViewFTPCtrl.CAB AsiaViewFTPCtrl.dll AsiaViewFTPCtrl.INF //make a .CAB file
4 codesign2005 tools
5 put the sign cab file to web
hi
|
|
|
|
|
thanks, gonna test it asap
|
|
|
|
|
I used CWindow::Create() to build a new POPUP window in VC++6.0/WTL. I wanted to
make the window behave like a dialog without using a dialog resource template. By behave like a dialog, I mean the running process suspends until the dialog window returns/closed.
Can you please help me with that? Thanks.
|
|
|
|
|
|
Gurus,
If I have an STL list (doesn't matter what of) and I sort it, how can I add one element to the list, whilst maintaining the sort order?
All I can think of to achieve this is to either: (1) add the new element to one end, and run sort() again, or (2) iterate through the entire list, checking the sort predicate against each element. Neither of these seem particulalrly appealing.
Does anyone know the most processor efficient way of doing this please ?
thanks,
Neil.
cheers,
Neil
|
|
|
|
|
They hide that information in the documentation[^]
Lower_bound is a version of binary search: it attempts to find the element value in an ordered range [first, last) [1]. Specifically, it returns the first position where value could be inserted without violating the ordering.
However that might not be the "most efficient" for your application. There are several things to consider. If you use STL much you should have Scott Meyers book as it discusses efficiency issues.
led mike
|
|
|
|
|
Thanks for that answer,
Neil
cheers,
Neil
|
|
|
|
|
led mike wrote: However that might not be the "most efficient" for your application.
It probably won't be - I don't think the structure of std::list iterators is terribly conducive to binary searches - could be wrong, mind.
|
|
|
|
|
Stuart Dootson wrote: It probably won't be - I don't think the structure of std::list iterators is terribly conducive to binary searches - could be wrong, mind.
std::deque would probably be a better choice in most cases.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
neilsolent wrote: f I have an STL list (doesn't matter what of) and I sort it, how can I add one element to the list, whilst maintaining the sort order?
All I can think of to achieve this is to either: (1) add the new element to one end, and run sort() again, or (2) iterate through the entire list, checking the sort predicate against each element. Neither of these seem particulalrly appealing.
Does anyone know the most processor efficient way of doing this please ?
If you insert only one element (2) is probably faster. You can make it even faster if you know from which end to start.
|
|
|
|
|
Thanks for that answer.
Unfortunately there will be no way of knowing which end to start from.
Neil
cheers,
Neil
|
|
|
|
|
Best bet is to guess by seeing if it's closer in value to front() or back() . That way, the average search distance for random data will be N/2 where N is the list length.
|
|
|
|
|
Stuart Dootson wrote: Best bet is to guess by seeing if it's closer in value to front() or back(). That way, the average search distance for random data will be N/2 where N is the list length.
but only when the values are distributed equally.
|
|
|
|
|
I am instantiating a CoClass present in an MFC Local server. Things would work fine when the server is already running. When the server is not running and I instantiate the CoClass, it starts and does some initialization - starts some other servers etc. So in this scenario, I need to wait for some duration in my code before I invoke any methods. i am wondering how I can know the "wait time for intialization". any ideas?
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
As I see it there are three ways do accomplish this.
1. (Not very good and should be avoided until every other option has been rejected)
Poll some interface method that can inform the caller whether the server is up and running or not. Calls could be invoked by a timer.
2. (Presumably not suitable and requires a re-write of the server)
Have the server blocking while creating other servers so that it doesn't return until it's up and running.
3. (The correct way, if supported by the server)
Implement a callback, or connection point, that gets called when the server is up and running.
Technically there's a fourth way and that would be to cancel execution with ::Sleep(), but that is so very wrong that it doesn't even make the list above.
Don't even consider it!
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Roger,
Thanks for the quick response.
I had thought about the Answer#1 and 3 and I thought 3 would be the best option. Let me check if I can implement #3 in the server - it's not owned by me
I had put the ::Sleep() in my client code and it works fine but as you said its not a good way and thats the reason why I am seeking for some other solution.
If you see any other solutions, do let me know.
Thanks again.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I figured out a simple solution for this. Place the call to
COleTemplateServer::RegisterAll();
after your server intializes and before it shows its window/dialog, if any.
If I am wrong, please correct me.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Ummm, not sure actually...
From MSDN Remarks COleObjectFactory::RegisterAll: Registers all of the application’s object factories with the OLE system DLLs. This function is usually called by CWinApp::InitInstance when the application is launched.
I guess the above would make sense if you've written an EXE-server and the call to RegisterAll was omitted. Then it should definitely be added if I've understood MSDN correctly.
If you haven't made an EXE-server, then I don't know in what way this could be applicable nor how/why it would solve your initial problem.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
I have an EXE server written in MFC!
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Sohail Kadiwala wrote: I have an EXE server written in MFC!
Ok, then it makes sense to add the call to RegisterAll() .
So it's all good then, right?
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
The call to RegisterAll() was present but before the server started other servers, inshort before it completely initialized its state. So I moved the RegisterAll() call after the initialization just before its main window is shown. The call to RegisterAll() informs the OLE System Dll's that the coclasses inside this server are ready to handle calls.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
what is the use/function of manifest file in WTL
|
|
|
|