|
|
I have an array of property pages and I change their caption/title dynamically...
This works in the commented way, but when I try to do it using the non commented way, it crashes... (I'd like to know why)...
PREMISSES:
THE CASE THAT WORKS:
I have an array of property pages.
I have an array of titles.
Those two are members of the property sheet class.
THE CASE THAT DON'T WORKS:
I have an array of property pages.
I have one CString var declared inside the cosntructor of the property sheet class that will be used to store all the titles in the property pages...
THE CODE
{
...
this->m_ArrPPDlgParametritzacions[iNumPPags].m_psp.dwFlags |= PSP_USETITLE; <code>
this->m_ArrPPDlgParametritzacions[iNumPPags].m_psp.dwFlags &= ~PSP_HASHELP; <code>
csTitolPPag = ((char *)pxmlNode->attributes->getNamedItem("EtiquetaDescriptiva")->Gettext()); <code>
this->m_ArrPPDlgParametritzacions[iNumPPags].m_psp.pszTitle = csTitolPPag;
this->AddPage(&m_ArrPPDlgParametritzacions[iNumPPags]); <code>
iNumPPags++; <code>
} Any idea?
It's not a vital thing, I can live having an array of CStrings using memory, but it would be better to be able to do it without the array...
thank you in advance...
|
|
|
|
|
I would imagine that csTitolPPag is just a local string variable. The problem you are having is that
this->m_ArrPPDlgParametritzacions[iNumPPags].m_psp.pszTitle
is nothing more than a pointer to a character string. So when csTitolPPag goes out of scope, the string is deleted and thus pszTitle now points to trash.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
This is what I think, but is there any way to do it assigning the content, and not the direction?
Thank you in advance...
|
|
|
|
|
You would have to find the length of the string you are copying, then allocate a character array on the heap with length + 1 size, do a memset to set this new memory to 0, do a memcpy from the CString's psz pointer to this new memory, then set the array psz to be the new pointer. That way the memory will always be there in the array psz. Just be sure to do a delete [] on this array psz when this array is no longer needed, or will get a memory leak. (The memset to 0 may not be needed, it may be done automatically when call new.)
David Spain
|
|
|
|
|
Hi
How to load a resource on his name (for example IDB_BITMAP1), but it is not known ID. And whether it is possible?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
IDB_WHATEVER is a mnemonic for a numerical ID, not a name. The mnemonic is #define'ed in a header file named resource.h by default.
Maybe you have just forgotten to #include resource.h?
Bernd
|
|
|
|
|
Do you mean load it as a string name? If you are asking that exclude the MAKEINTRESOURCE parameter, I don't really understand the question though...
|
|
|
|
|
|
|
Cool. Thanks.
|
|
|
|
|
Hi Everyone,
I have an application that has a thread within a thread. When I delete the parent it is suppose to delete the child thread within the destructor. Unforetunately I am running into problems where the memory has already been freed (at least that is what I think has happened) and trying to free the resources are used by the threads.
When I run the application through boundschecker I don't see this problem at all so I think it has to do with some race condition. Is there some documentation on how to properly and effectively control the destruction of threads?
Cheers,
Clint
|
|
|
|
|
What do you mean by "delete" the thread? The parent thread should ask the child thread to end, and then it should end. Using CEvent is a good way to do this.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Post an example of how you terminate the child thread.
Kuphryn
|
|
|
|
|
I was using an user interface thread to do the trick. I changed over to a worker thread and now everything seems to be better. I think the problem had to do with the self deleting nature of user threads. Now I explicitly control who deletes and when.
Sincerly,
Clint
|
|
|
|
|
How do I implement the CompareItem for a combobox inside a dialog control. So I can create my own sort routine.
Thanks
|
|
|
|
|
override OnCompareItem for the combo, then use the COMPAREITEMSTRUCTs that you will receive in that function to determine which two items are being compared. return -1,0,1 as appropriate.
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
I used dependency walker to check the dependencies of my static mfc application, and got a list of core and other dependencies. I'm leary about including too many of these in my installation utility, so I was wondering if there is a list of dll's by OS (Win2000, Win95...) that are guaranteed to be present?
Any other comments/cautions regarding distributing dll's with an application would be welcome!
Thanks.
|
|
|
|
|
It's safest to include them anyway because the DLLs you require might not be the same version as in the OS. The installer will do a version check and only if the version is newer will it overwirte it.
Regards,
Nish
p.s. One brute force technique I've used is to run my application on a fresh install of each OS
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Yup, check out Microsoft's DLL Help Database". (If the link doesn't work, do a search for "DLL Help Database" on http://msdn.microsoft.com ) You can enter in a DLL name, and it will tell you every product and OS that it is included in.
You should also use Windows Installer and merge modules to deploy MFC runtimes, instead of just doing a file copy.
Hope this helps!
Jerry Dennany
|
|
|
|
|
Great! I think that's what I'm looking for.
The link worked, I'll take a look at it now.
Thanks
|
|
|
|
|
Oh... I am using InstallShield, and only replacing shared files if the files I'm replacing are older than the one's I'm installing.
|
|
|
|
|
I don't know where to find a list, but the ones that you typically have to ship usually start with m, like msvcrt.dll and mfc42.dll. My recommendation is to install these in the same folder as the application. This will ensure that your app runs with the proper DLLs and that you don't possibly break other apps by overwriting DLLs in the system32 folder.
Regards,
Alvaro
That which does not kill me postpones the inevitable. -- despair.com
|
|
|
|
|
I've seen other applications install the mfc dll's in their folders, but that seems risky to me. Here's my thinking... You may have a down rev version of a particular dll. If you install it in your own directory, and your app happens to be the first one to use it, the OS will load it up. The next app that needs the dll (maybe the more current one that's in the system folder) will get the down rev one, and poof... Could be a problem.
Does that seem reasonable?
If so, then you should install the dll in the windows "system" directory, and only install if your dll is a more recent version.
|
|
|
|
|
I'm in the process of re-working some old batch files which automates our build process, and nowhere in MSDN could I found the errorlevels for MSDEV.EXE (VC 6.0), does anybody know where I can find these?
Evaulated VisualBuild, looks great.. Probably our next purchase
Thx.
Mike.
|
|
|
|