|
I am using a treeview control in an application I am writing and I am trying to come up with an efficient way to store the hierarchial data in it. I considered creating a vector of all the items which included an id of the parent item, but reconstructing the treeview when it is large would be quite inefficient this way. I haven't seen any premade classes to store treeview data, but I was hoping someone could point me to one, or give me some ideas on a good way to store this type of data.
Thanks.
|
|
|
|
|
|
You could always create a simple hierarchial recursive class to store the data... something like this (not complete):
class TreeNode : public CObject
{
protected:
CString m_cDisplayText;
int m_iIconIndex;
void *m_vpUserData;
CObList m_oChildNodes; // list of TreeNode elements
public:
TreeNode() { m_iIconIndex = 0; m_vpUserData = NULL}
TreeNode(LPCSTR cpDisplayText, int iIconIndex = 0, void *vpUserData = NULL)
{ m_cDisplayText = cpDisplayText;
m_iIconIndex = iIconIndex;
m_vpUserData = vpUserData;
}
~TreeNode()
{ TreeNode *pNode;
POSITION pPos = m_oChildNodes.GetHeadPosition();
while (pPos)
{
pNode = (TreeNode *)m_oChildNodes.GetNext(pPos);
if (pNode)
delete pNode;
}
}
// std accessors....
LPCSTR GetDisplayText()
{ return (LPCSTR)m_cDisplayText; }
void SetDisplayText(LPCSTR cpDisplayText)
{ m_cDisplayText = cpDisplayText; }
void *GetUserDataPtr() { return m_vpUserData; }
void SetUserDataPtr(void *vpUserData)
{ m_vpUserData = vpUserData; }
CObList *GetChildNodes() { return &m_oChildNodes; }
virtual void Serialize(CArchive &ar)
{
if (ar.IsStoring())
{
ar << m_cDisplayText << (DWORD)m_iIconIndex;
}
else
{
ar >> m_cDisplayText >> (DWORD&)m_iIconIndex;
}
m_oChildNodes.Serialize(ar);
}
};
|
|
|
|
|
As I want to display a JPEG file like the one using PictureBox class, is there any class has the same use in Visual C++ ?
thx
|
|
|
|
|
|
I have seen this before, but I'm using dialog base and as a beginner of VC++, I don't know how to change the idea from DOC base to Dialog base.
pls help
|
|
|
|
|
I'm creating a ocx in VC which is used for a custom protocol. The main handshaking and connecting to remote host etc., will be handled by a VB app.
I only have to read the COM port through my local buffer variable which is set by VB app in OnComm event.
If my input buffer is empty, I need to wait till I get something in my buffer? Can someone pls. help me how I can do that wihtout jamming the application.
Thanks in advance,
|
|
|
|
|
Simple example is using thread function which wait to fill the buffer and after it send some flag to your application (Get/Set or Fire - are your choice).
|
|
|
|
|
Or, you could use overlapped I/O on the read, triggering a callback function when the read actually occurs (or posting to an I/O Completion Port).
|
|
|
|
|
Hi,
I tried that with WaitForSingleObject(), but it hangs up the whole thread for certain time and gives timeout messages.
As far as I know, Visual Basic run all components in single thread, correct me if I'm wrong.
I can't use callback functions, as this code model doesn't integrate with the existing system, which uses some other protocols. For your clarification - I'm working on ZModem, developing VC++ OCX which will be used in VB and Powerbuilder applications.
|
|
|
|
|
Hi,
I my application(MFC dialog based),initially i have to put the focus on specified button control.
i.e.Suppose my dialog having Three buttons 1.OK,2,Cancel,3.Button1.Initially i have to put focus on Button1, if user clicked Enter key the Button1 message handler will call.
for this i tried like this.
1.CMyTestDlg::OnInitDialog()
{
GetDlgItem(IDC_BUTTON1)->SetFocus();
return FALSE;//Instead of TRUE
}
It showing correctly focus on Button1,But if i pressed enter key OnOK() is calling.
Please help me inthis context.
regards
anju
anju
|
|
|
|
|
Hi,
You don't have to setfocus() on OnInitDialog(), Try this one --
In design mode , go to Layout, choose Tab order,
Click on the buttons that you want the tab order sequence.
Run the application,
-- Press Enter when the dialog shows up
hope this might help you out
|
|
|
|
|
Hi SNathani,
Thank you for your suggestion.
Suppose, if my button is OwnerDrawn, what can i do?
regards
anju
|
|
|
|
|
It does not make any difference if the button is OwnerDrawn. You main problem will probably be that the OK button is set as the default button in the resource editor, you may need to clear this flag to get RETURN to act correctly on BUTTON1.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Hi Roger Allen,
Thanks for your reply.
Already I cleared Ok button "default button" property.
can you guess other thing.
regards,
anju
|
|
|
|
|
Rather than calling SetFocus(), you should call the following:
GotoDlgCtrl(GetDlgItem(IDC_BUTTON1));
|
|
|
|
|
HOW TO TURN $6 INTO $6,000!!!!!!
READING THIS COULD CHANGE YOUR LIFE!
I found this on a bulletin board and decided to try it. A
little
while back, I was browsing through newsgroups, just like you
are now,
and came across an article similar to this that said you
could make
thousands of dollars within weeks with only an initial
investment of
$6.00! So I thought, Yeah right, this must be a scam,but
like most of us, I was curious, so I kept reading. Anyway, it
said
that you send $1.00 to each of the 6 names and address stated
in the
article. You then place your own name and address in the
bottom of
the list at #6, and post the article in at least 200
newsgroups.
(There are thousands) No catch, that was it. So after
thinking it
over, and talking to a few people first, I thought about
trying it. I
figured: what have I got to lose except 6 stamps and $6.00,
right? Then I invested the measly $6.00. Well GUESS WHAT!!...
within 7 days, I started getting money in the mail! I was
shocked! I
figured it would end soon, but the money just kept coming in.
In my
first week, I made about $25.00. By the end of the second
week I had
made a total of over $1,000.00! In the third week I had over
$10,000.00 and it's still growing. This is now my fourth week
and I
have made a total of just over $42,000.00 and it's still
coming in
rapidly. It's certainly worth $6.00, and 6 stamps, I have
spent more
than that on the lottery!! Let me tell you how this works and
most
importantly, why it works....Also, make sure you print a copy
of this
article NOW, so you can get the information off of it as you
need it.
I promise you that if you follow the directions exactly, that
you
will start making more money than you thought possible by
doing
something so easy!
Suggestion: Read this entire message carefully! (print it out
or
download it.) Follow the simple directions and watch the
money come in!
It's easy. It's legal. And, your investment is only $6.00
(Plus postage)
IMPORTANT: This is not a rip-off; it is not indecent; it is
not
illegal; and it is virtually no risk - it really works!!!!
If all of the following instructions are adhered to, you will
receive
extraordinary dividends.
PLEASE NOTE:
Please follow these directions EXACTLY, and $50,000 or more
can be
yours in 20 to 60 days. This program remains successful
because of
the honesty and integrity of the participants. Please
continue its
success by carefully adhering to the instructions.
You will now become part of the Mail Order business. In this
business
your product is not solid and tangible, it's a service. You
are in
the business of developing Mailing Lists. Many large
corporations are
happy to pay big bucks for quality lists. However, the money
made
from the mailing lists is secondary to the income which is
made from
people like you and me asking to be included in that list.
Here are the 4 easy steps to success:
STEP 1: Get 6 separate pieces of paper and write the
following on
each piece of paper;PLEASE PUT ME ON YOUR MAILING LIST. Now
get 6 US $1.00 bills and place ONE inside EACH of the 6
pieces of
paper so the bill will not be seen through the envelope (to
prevent
thievery). Next, place one paper in each of the 6 envelopes
and seal
them. You should now have 6 sealed envelopes, each with a
piece of
paper stating the above phrase, your name and address, and a
$1.00
bill. What you are doing is creating a service. THIS IS
ABSOLUTELY
LEGAL! You are requesting a legitimate service and you are
paying for
it! Like most of us I was a little skeptical and a little
worried
about the legal aspects of it all. So I checked it out with
the U.S.
Post Office (1-800-725-2161) and they confirmed that it is
indeed
legal! Mail the 6 envelopes to the following addresses:
1. Richard Horman- 1731 Frost Ave. Maplewood, MN 55109
2. Carlos De La Torre- 1969 West Dr. Vista, CA 92083
3. W. Green- P.O. Box 239 Apopka, FL 32704
4. B. Ledford- 3011 Boulevard PL Indianapolis, IN 46208
5. Ky Campbell- 5807 Shetland Way Waterford MI 48327
6. Kelly Foster- 2814 Pine St. Bethel Park, PA 15102
STEP 2: Now take the #1 name off the list that you see above,
move
the other names up (6 becomes 5, 5 becomes 4, etc...) and add
YOUR
Name as number 6 on the list.
STEP 3: Change anything you need to, but try to keep this
article as
close to original as possible. Now, post your amended article
to at
least 200 newsgroups. (I think there are close to 24,000
groups) All
you need is 200, but remember, the more you post, the more
money you make!
This is perfectly legal! If you have any doubts, refer to
Title 18
Sec. 1302 & 1341 of the Postal lottery laws.
Keep a copy of these steps for yourself and, whenever you
need money,
you can use it again, and again.
PLEASE REMEMBER that this program remains successful because
of the
honesty and integrity of the participants and by their
carefully
adhering to the directions. Look at it this way. If you are of
integrity, the program will continue and the money that so
many
others have received will come your way.
NOTE: You may want to retain every name and address sent to
you,
either on a computer or hard copy and keep the notes people
send you.
This VERIFIES that you are truly providing a service. (Also,
it might
be a good idea to wrap the $1 bill in dark paper to reduce
the risk of mail theft.)
So, as each post is downloaded and the directions carefully
followed,
six members will be reimbursed for their participation as a
List
Developer with one dollar each. Your name will move up the
list
geometrically so that when your name reaches the #1 position
you will
be receiving thousands of dollars in CASH!!! What an
opportunity for
only $6.00 ($1.00 for each of the first six people listed
above) Send
it now, add your own name to the list and you're in business!
---DIRECTIONS ----- FOR HOW TO POST TO NEWSGROUPS------------
Step 1) You do not need to re-type this entire letter to do
your own
posting. Simply put your cursor at the beginning of this
letter and
drag your cursor to the bottom of this doent, and
select 'copy'
from the edit menu. This will copy the entire letter into the
computer's memory.
Step 2) Open a blank 'notepad' file and place your cursor at
the top
of the blank page. From the 'edit' menu select 'paste'. This
will
paste a copy of the letter into notepad so that you can add
your name
to the list.
Step 3) Save your new notepad file as a .txt file. If
you want to do your postings in different settings, you'll
always
have this file to go back to.
Step 4) Use Netscape or Internet explorer and try searching
for
various newsgroups (on-line forums, message boards, chat
sites,
discussions.)
Step 5) Visit these message boards and post this article as a
new
message by highlighting the text of this letter and selecting
paste
from the edit menu. Fill in the Subject, this will be the
header that
everyone sees as they scroll through the list of postings in a
particular group, click the post message button. You're done
with
your first one! Congratulations...THAT'S IT! All you have to
do is
jump to different newsgroups and post away, after you get the
hang of
it, it will take about 30 seconds for each newsgroup!
**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY
YOU WILL MAKE!! BUT YOU HAVE TO POST A
MINIMUM OF 200**
That's it! You will begin receiving money from around the
world within days! You may eventually want to rent a P.O.Box
due to the large amount of mail you
will receive. If
you wish to stay anonymous, you can invent a name to use, as
long as
the postman will deliver it.
**JUST MAKE SURE ALL THE ADDRESSES ARE CORRECT.**
Now the WHY part:
Out of 200 postings, say I receive only 5 replies (a very low
example). So then I made $5.00 with my name at #6 on the
letter. Now, each of the 5 persons
who just sent me $1.00 make the MINIMUM 200
postings, each with my name at #5 and only 5 persons respond
to each
of the original 5, that is another $25.00 for me, now those
25 each
make 200 MINIMUM posts with my name at #4 and only 5 replies
each, I
will bring in an additional $125.00! Now, those 125 persons
turn
around and post the MINIMUM 200 with my name at #3 and only
receive 5
replies each, I will make an additional $626.00! OK, now here
is the
fun part, each of those 625 persons post a MINIMUM 200
letters with
my name at #2 and they each only receive 5 replies, that just
made me
$3,125.00!!! Those 3,125 persons will all deliver this
message to 200
newsgroups with my name at #1 and if still 5 persons per 200
newsgroups react I will receive $15,625,00! With an original
investment of only $6.00! AMAZING! When your name is no
longer on the
list, you just take the latest posting in the newsgroups, and
send
out another $6.00 to names on the list, putting your name at
number 6
again. And start posting again. The thing to remember is: do
you
realize that thousands of people all over the world are
joining the
internet and reading these articles everyday?, JUST LIKE YOU
are
now!! So, can you afford $6.00 and see if it really works?? I
think
so... People have said, "e;what if the plan is played out and
no
one sends you the money? So what! What are the chances of that
happening when there are tons of new honest users and new
honest
people who are joining the internet and newsgroups everyday
and are
willing to give it a try? Estimates are at 20,000 to 50,000
new
users, every day, with thousands of those joining the actual
internet.
Remember: play FAIRLY and HONESTLY and this will really
work.
|
|
|
|
|
If I understand you want to share processor's time with the Flash Program. If you call/switch some programs from main program without using tasks then the main program will wait realization calling program. You can use thread functions to share procesor's time for more applications. Also, you can use windows timer function.
|
|
|
|
|
i want to get cpu clock speed use by wmi on win9x platform.
so i have found that need installation of wmi9x.exe(m.s wmi 9X tool) for using wmi on 9x.
but "MVSOFT PCINFO FOR WINDOWS" program can get correct cpu clock speed without installation of wmi9x.exe
on 9x.
is really possible it.?
i'd like do it.
plz help me.
a
|
|
|
|
|
You can read the speed from the key HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0 DWORD value ~MHz (the number is the approximate speed in MHz)
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Hi,
I have a application which calls a method of a pre-compiled library (which exists already). Now I want to step into the method of pre-compiled library. How do I do this? I have all the source code with me.
Somebody told me that I need to attach .pdb file, lib file etc. but the system never asked to attach these files. If I press F-11, it simply comes out without entering the required method.
Pls help me..
Prashant
|
|
|
|
|
If I understand that you must put a path where are source files of this library and normaly the library already consist debuging informations.
|
|
|
|
|
also, you must link with the debug version of the library.
|
|
|
|
|
Hi,
In a dialog, how can I move the focus with the ENTER key ?
Thanks,
Claude
|
|
|
|
|
It's not standard, then you shouldn't, but you can trap the enter key and then SetFocus() manually...
Take a look at the PreTranslateMessage() function in your dialog...
NOTE:
I've not tried it, but you could even try to read the enter key in the pretranslatemessage and then process the TAB key there...
Hope this helps.
|
|
|
|
|