|
HI David
thanx for ur comment
but i want to know the utility which can give us the listing of the dlls which are registered with the system and which are not.
if there is any coding related to this please do let me know .
i know u would have the solution for this problem
thanx a lot
|
|
|
|
|
I have made a deque list of my class/structs
and it's working fine, all is fine exept one problem of me that I can not understnd or can not find....
I need to get a reference to an object inside my deque and keep that reference for doing thinks but when I do sort in deque this reference change.
For example.
(MyListToShow is my Deque)
(SendMe is my class to add)
Now I put it on my list
MyListToShow.push_back(SendMe);
Now I find the pointer to my last element on deque and save it eg to pointer [KeepMyRef]
Now I do sort the deque....
and now [KeepMyRef] is point to a diferent element.
How can I get a pointer to the same class - to the memory it self of my data ?
Thank you in advanced
Vini
|
|
|
|
|
Why are you using a deque?
Anyway your object has been moved into its sort position, so you cannot keep a reference to it. You could use a search algorithm to find it afterwards. But any iterator will be invalidated after another insert/delete/sort/etc.
It may be that a set or map is more suitable for your application. With those the iterator you get when you insert is valid until a further insertion/deletion/whatever.
Paul
|
|
|
|
|
Paul thank you for your replay.
I have also use the vector but is not solving my problem.
About [map] I didn't know it and now just read about.
What else do you suggest insted of deque ?
I use deque lists and vectors all the time to store informations data that I don't know from the begining the size.
I need to be sort them also.
Vini
|
|
|
|
|
vector is good to add/delete on the end, bad for the middle or beginning.
deque is good to add/delete on either end, bad for the middle.
map/set are good to add/delete anywhere (but slower than vector/deque) and maintain their contents already sorted so that you don't have to sort manually.
list is good to insert/delete anywhere but very bad to sort.
etc.
You have to make a decision based on your particular application. You might find looking in a good STL reference helps, I recommend the Josuttis book.
Paul
|
|
|
|
|
Paul thank you for the informations.
Vini
|
|
|
|
|
Hi there,
I've used CDHtmlDialog to show HTML documents on my program ...
Well, there is no problem in displaying HTML docs ...
I just have problem in HTML doc alignment in my dialog ...
Actually I want to put the HTML doc on center of my dialog !
I changed the dialog sizes to fullscreen ... Is there any way to refresh or resize html doc in the dialog ?
Plz help me !
Regards,
Hadi
|
|
|
|
|
I have got the following situation (VC6)
i have got two dll's each exporting functions like this
void fun1 (std::vector<int>& vec);
The calling function passes an empty vector.. it is filled in the dll.. and the dll passes the filled vector back.
One dll works perfectly fine. The other dll has got the following problem:
After leaving the function which called the dll - function (when the passed vector leaves the scope)
there is a runtime bug, which says that a debug assertation failed.. and that the following expression failed:
_CrtIsValidHeapPointer(pUserData)
One the one hand i do understand, why this could be (allocating memory in another process and freeing it in the other)..
but WHY does this technique work happily with one dll, and why not with the other dll ?
Any ideas ?
Thanks in advance,
bernhard
"Just looking for loopholes." W. C. Fields American actor, 1880-1946, explaining why he was reading the Bible on his deathbed.
|
|
|
|
|
link against the Multithreaded DLL Runtime Library.
|
|
|
|
|
I suspect that one DLL is linked against the static version of the C run-time library, but the other, and the program, against the DLL version. The version that works is linked against the DLL; the one that doesn't is linked with a static version.
Each time the C run-time is initialised (at program startup and at DLL initialisation, it creates a new operating system heap with HeapCreate . All allocations through the C run-time's allocation functions (malloc , ::operator new , calloc , realloc , etc) ultimately come from this heap using HeapAlloc /HeapRealloc - and all the deallocation functions pass this heap's handle to HeapFree .
Aside: on NT 4 and older, and on Win9x systems, the CRT manages small blocks of memory from a single OS heap allocation because the OS heap wasn't very efficient with small blocks on those operating systems. This was improved with Windows 2000 and the CRT uses the OS heap directly for all allocations on these systems.
If you're using the Debug version of the C run-time, when you free memory (which the destructor of vector does for you, using the allocator type parameter's deallocate function) the run-time checks that you passed a valid pointer using the _CrtIsValidHeapPointer function. It considers it invalid if HeapValidate returns FALSE , which will happen if the pointer came from a different heap.
Since you're passing an empty vector into the function, an allocation happens within the DLL, from the heap used by that DLL. The DLL version of the CRT will set up a single heap shared by all binaries using the DLL version, but each binary linked to the static CRT will have its own heap. The vector (assuming it's a local variable in the calling function) is destroyed at the end of the calling function, so deallocate gets called, which uses ::operator delete against the heap used by the executable. This is the wrong heap, so you get the assertion.
The fix is simple. All DLLs in the same process must link against the same C run-time DLL (a mixed process of some binaries linked with msvcrt.dll from VC 6 and some linked with msvcr70.dll or msvcr71.dll from VS.NET 2002 or 2003 will have similar problems). The alternative is to ensure that all allocations and deallocations happen within a particular DLL, and that objects never cross the boundaries.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
I’m about to store about 10-20.000 elements (MyType) in a collection. I would like to have some kind of order because I have to search for one or more elements quite often.
I’ve thought of a AVLTree which I am comfortable with. The problem is that I would like to enable multiple search and retrieve all successes in a list or something for future manipulations.
Pleased for all suggestions…
...and justice for all
APe
|
|
|
|
|
One way would be to put the items in a CArray object, and then use qsort() to sort them.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I want to attach one of the menu resource to one of my child frame but i am not able to do so. I am putting code below, the following code is written in the App class and will execute on the click of a button:
CQSMChildFrame *pQSMMiniFrame = new CQSMChildFrame ;
if(!pQSMMiniFrame->LoadFrame(IDR_QSM,WS_OVERLAPPEDWINDOW | WS_CHILD, m_pMainWnd))
{
AfxMessageBox("Could not load QSM Frame");
return;
}
HMENU hMenu = NULL;
LPTSTR lpszMenuName = MAKEINTRESOURCE(IDR_QSM1);
if (lpszMenuName != NULL)
{
HINSTANCE hInst = AfxFindResourceHandle(lpszMenuName, RT_MENU);
if ((hMenu = ::LoadMenu(hInst, lpszMenuName)) == NULL)
{
AfxMessageBox("Warning: failed to load menu for CFrameWnd.\n");
return;
}
}
CMenu menu;
menu.Attach(hMenu);
BOOL y = pQSMMiniFrame->SetMenu(&menu);
pQSMMiniFrame->BringWindowToTop();
pQSMMiniFrame->SetOwner(m_pMainWnd);
pQSMMiniFrame->ShowWindow(SW_SHOW);
pQSMMiniFrame->UpdateWindow();
where CQSMChildFrame is derived from CMDIChildWnd and the application is an MDI based application.
When i debug the application, if fails at the SetMenu() line and returning false.
Even i tried loading and setting menu in the OnCreateClient() handler of CQSMChildFrame but not successful there also.
Please help me what i am doing wrong?
Thanks,
Amit
|
|
|
|
|
Hello all,
I have a dialog that has the style - popup and none (for border)
I've created a round edges for the that dialog using the following code:
CRect rc;
GetClientRect(rc);
CRgn rgn;
rgn.CreateRoundRectRgn(rc.left,
rc.top,
rc.right,
rc.bottom,
15,
15);
SetWindowRgn(rgn,TRUE);
now i try to draw a border for this border-free dialog, using the following code:
void CMyDlg::OnPaint()
{
CClientDC dc(this);
CPen pen(PS_SOLID,2,RGB(0,0,0));
CPen* pOldPen = (CPen*)::SelectObject(dc.m_hDC,pen);
CRect rc;
GetClientRect(rc);
dc.MoveTo(1,1);
dc.LineTo(rc.Width()-1,1);
dc.MoveTo(rc.Width()-1,1);
dc.LineTo(rc.Width()-1,rc.Height()-1);
dc.MoveTo(rc.Width()-1,rc.Height()-1);
dc.LineTo(1,rc.Height()-1);
dc.MoveTo(1,rc.Height()-1);
dc.LineTo(1,1);
::SelectObject(pDC->m_hDC,pOldPen);
}
the trouble is , since i've create the round edges, there is no drawing on them, i tried to use the dc.Arc method, but i don't know how to calculate the exact arc....
can any1 show me the proper code, so the dialog rounding would have a drawn border as well?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
<br />
CRect rc;<br />
GetClientRect(rc);<br />
<br />
rc.Deflate(3,3);<br />
<br />
CDC::RoundRect(rc, CPoint(15,15));<br />
Just make sure you have an empty fill-brush and this should do the job more or less.
|
|
|
|
|
many thanks ohad
worked like a charm!
but, if i don't use the deflaterect then the rectangle is not shown pretty good,also if i use 3,3 as you did, i see the edges of my dialog under the rectangle...? how can u fit the round rectangle exactly?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I've used javadoc.exe to generate documentaition for my java-projects.
Any suggestions on a good way to do it in Visual C++?
...and justice for all
APe
|
|
|
|
|
create it in the form of .hlp file and for the VC++ application save this help file in the VC++ Application's help file path. You have to change value of helpfilename variable for your CWinApp derived class.
|
|
|
|
|
How do I create a .hlp file?
How should I comment my sourcecode?
...and justice for all
APe
|
|
|
|
|
|
This links has a lot of c++ documentation tools.
http://www.stack.nl/~dimitri/doxygen/links.html
I recommend Doxigen.
|
|
|
|
|
|
Hey somebody help me!
pl tell how to save a browsed page through VC++
pl help me..
|
|
|
|
|
Hi everybody,
Does anybody know, how I can use a WTL splitter window in an MFC 6.0 project? I want to have a more flexible splitter window in my MFC application. please explain it in detail.
thanks in advance,
Roozbeh.
|
|
|
|