|
hello,
i have a heirarchical set of data which is created from the following simplified class defintion:
class Extent
{
vector<surface*>m_pSurfaces;
vector<extent*>m_pExtents;
};
CMyAppDoc.cpp:
Extent *globalExtent=new Extent();
...
as can be seen: extents can have surfaces, and other extents.
the best way to represent this data is to use a CTreeCtrl class. this appears in a dialog with add surface, add extent, remove item buttons. i have never programmed such a complex data structure with a tree-view before and am having difficulty acquiring pointers to my data objects when they are selected in the tree view. every item in the tree view corresponds to an item in the globalExtent data heirarchy.
one way to get the pointer i thought would be to associate a HTREEITEM to each surface and extent - that way, when a CTreeCtrl item was selected i could use GetSelectedItem to get the selected HTREEITEM and search my globalExtent heirarchy for a match. This would not be a good idea though due to the search required - a large globalExtent heirarchy will require a time-consuming search.
I wondered if anyone had come across a similar situation and if so how they solved the problem, or if anyone had any ideas as to how to go about the probelm.
Thanks,
Paul.
|
|
|
|
|
Keep this association completely out of you data structure.
One way is to use the treeCtrl's SetItemData() / GetItemData()
(cast the pointer to/from LPARAM, that's perfectly ok)
The other way is to use a map <htreeitem, pointer-to-item="">, or even a two-way map
Both have advantages and disadvantages. If the data doesn't change without the tree control knowing, the first is easier.
It's a royal pain to watch a sex drugs and rock'n'roll design decay into an aids crack and techno implementation [sighist] [Agile Programming] [doxygen]
|
|
|
|
|
What about using the the user defined data attribue (lParam ?) in the tree item to point back to the associated item in your globalExtent class.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
hello,
Is there any function is vc++ for getting processor ID , motherboard serial number and BIOS information ?
Thanks in advance
Mahesh
|
|
|
|
|
|
hello Riazi,
Thanks..i downloaded the source. But when i tried to compile it is showing error. Error is " cant open OXVerInfo.h header file "
In the downloaded source there is no file called OXVerInfo.h.
what to do ?????
Mahesh
|
|
|
|
|
Post you question in the article message board.
Perhaps your question is already answered in there?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
As I mentioned in message board of article, this file is part of Dundas Ultimate Toolbox Library. Remove this line and complie project with no errors!
A. Riazi
|
|
|
|
|
Friends,
I do not want title bar or a caption in a window. But the problem is that whenever i remove title bar from a window(or dialog), the taskbar button of the application becomes empty. I want to add some text and icon on the task bar button..can anyone tell me how ??
Thanks in advance for your reply.
|
|
|
|
|
|
Unfortunately, the solution of my problem is not present in the faq. I actually want the taskbar button showing both icon and some text, but at the same time i don't want the title bar (caption) of a window. Is there any API with the help of which we can deal with taskbar button ???
|
|
|
|
|
Ooops!
I think I read your message a little to careless!
Sorry, but then I don't know how to do
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I would look into WM_NCCALCSIZE and WM_NCPAINT. You could effectively remove the visuals of the caption of your window, while it still contains a caption internally.
Then the taskbar will still display the icon and title.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have problem with a so simple thing as adding a damn string to a ListBox in a non-MFC app.
BUT!
When I use the WindowsX.h macro ListBox_AddString(hwndList, "Hello") the item is added but no text is visible!!
I have sure missed something very simple, can you tell me what I've missed!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
If it has the LBS_OWNERDRAWFIXED style, then be sure to add the LBS_HASSTRINGS style as well.
|
|
|
|
|
Arrgh!!
It was not meant to be an ownerdraw ListBox, but in some way I did hit the "Ownerdraw" selection property in VC++ by chance!!!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Hi,
I just made a program to download a file from the web (using URLDownloadToFile). I'm trying to download a html file with the latest news in a particular site, but it always comes unrefreshed... I always get the same file!
How can I do to refresh it before download ?
Or download the refreshed one ?
thanks.
|
|
|
|
|
It sounds like you're fetching via a proxy... -or- you forced to use a proxy (via your ISP for example). have a look on the HTTP headers, if you find a proxy notice.
|
|
|
|
|
I use CInternetSession::OpenURL() and specify INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
i've written a program, using winsock.h
now i want to implement some client server functionality in the program, yet when i try to include CSocket.h and use it as a basis for my own class, the compiler presents me with the following error message: "CSocket base class unknown" or something like that.
has anyone had this problem before, or does anyone have any idea on how to fix this problem.
i would appreciate some help.
thanx in advance,
laue
|
|
|
|
|
laue wrote:
"CSocket base class unknown" or something like that.
CSocket (or CAsyncSocket) are MFC classes, you need to include and link against MFC stuff (if you want to use one of those). You can also use pure Winsock and write your own classes.
Moak
|
|
|
|
|
Moak wrote:
You can also use pure Winsock and write your own classes.
Which is much better than using the MFC classes!
But if you want to use the MFC classes laue, go for it!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
it is easy and most of all fast to implement MFC classes. since i'm doing this project for school and it has to be turned in on monday, i would very much like to use CSocket.
Is there any way of using both winsock an CSocket in the same project? what do i have to link/include for it to work?
thanx,
laue
|
|
|
|
|
laue wrote:
Is there any way of using both winsock an CSocket in the same project?
Why do that!?
CSocket is a wrapper class for the Winsock API, a bad wrapper besides.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
i'll try coding it using winsock, but due to my deadline, if it turns out to be too time consuming, i'm afraid i'll take the easy way out (however non-elegant).
thanx for your reply,
jef
|
|
|
|