|
Time Nish?
hehehe
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
LOL
Sorry Tim.
I am a bad typist!
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
If you are just going to ignore people's sugestions without even looking at them, then why come here and ask.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Hello,
Trying to bridge the gap between what I was taught in school and MFC.
In school we created Btree file structures. It occurred to me that there is probably already made classes that are more sophisticated than the ones I created in school.
Could someone point me in the right direction? Do I need to learn STL, for example?
Say, for example, I wanted to write an MFC address book. I can do that but how do I write the data to a file and then retrieve when the program is run again?
I mean, I cant see busting out my project and throwing into MFC. Seems like MFC would have a way to do such a common task. Do I need to look at CObject and serialization?
Thanks in advance.
harry
|
|
|
|
|
There is no Btree in STL or MFC (or any other library that I know of). However, I'm pretty sure that some B-tree implementations can be found on the Web
I vote pro drink
|
|
|
|
|
CObject and serialization would be a place to start. Depending on your requirements and/or ambition you may want to look at a database of some kind, Access, MSDE, etc. Otherwise simply writing and reading from a flat file or XML document may be sufficient.
|
|
|
|
|
The point of using STL or MFC containers is that you don't need to know the low-level implementation of the data structure (B-tree, AVL tree, hash table or whatever). MFC CMap class is probably what you should use for your application.
|
|
|
|
|
I want to make a combination with Alt + F12... How to make it with hooks?
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
What means "Make a combination"? If you want to handle Alt+F12 in the program, use WM_SYSKEYDOWN message handler. If you want to generate keyboard event, use keybd_event (Alt down, F12 down, F12 up, Alt up). If you want to handle Alt+F12 in keyboard hook procedure, all required information is in wParam and lParam.
|
|
|
|
|
I am trying to learn C++ and have the XP home edition on my computer. Does this mean I will not be able to create programs that have #include <iostream> in the include section of the code?
|
|
|
|
|
What have you read when you think something like that is impossible!
Well, #include is something that you write to include a file like windows.h to use functions and constants from that file... it works to use #include on any computer you want!
You are a very very very very very... beginner on C++, aren't you!?
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Well, the reason I asked is because I know XP hasn't got DOS and the book I just got has examples of code in it that have the include <iostream> in the begining. This is something I thought meant that the program is going to be a DOS type program. If it IS a DOS type program then I wont be able to see if it works on my machine. Right? I am really new to programming in hopes of someday being able to answer questions for people. If I CAN run these examples I'll have an easier time learning I think, right?
|
|
|
|
|
Garry,
The #include command simply includes a file into the current file and has nothing to do with the operating system. Also, you should be able to run DOS-like programs in a command window in XP.
You should check your compiler's instructions for building and running console applications.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Thanks a lot, I appreciate your help!!
|
|
|
|
|
Also, XP has DOS, it's just hiding the ability to boot to a comand line from you. You can still get to a command prompt from programs/accesories. This is the sort of window your console programs will bring up ( and I recommend writing some straight C++ to the console before playing with any windows stuff, which you appear to be doing ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Some of the confusion about DOS comes from MS marketing. In theory, NT hasn't ever had DOS. It always has DOS emulation.
What has confused people is MS marketing saying that XP is the death of DOS. Meaning XP wasn't built on top of a DOS kernel like 95/98/ME. I guess they didn't want to confuse anybody by reminding them that NT/W2K/XP never had a DOS.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
No. Why would that be the case?
|
|
|
|
|
I guess if he knew, he wouldn't be asking.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Well, I've never worked with XP so I thought maybe he had some inside scoop we've all missed somehow . Just giving him the benefit of the doubt and hoping he would explain how he came to such a doubt.
Regards,
Alvaro
|
|
|
|
|
Hello,
I was just wondering whether I should order Visual Studio.NET Beta 2 or Release Candidate. Is Beta 2 better than Release Candidate, or is it buggy since it is a beta?
Do any of them have any time periods like 30 days or so?
Thanks,
vinuk.
|
|
|
|
|
The RC is time and feature limited. I'd expect they would take steps to make sure the betas are useful enough to try and not finished enough to be viable once the proper release arrives.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I have used this code to create a CStringList linked list, once a pointer to a string in the list is found, it is changed into 4- 8bit characters, then back again... however this results in a lack of accuracy. Please help (if u run the code as it is ur likelly to get a first chance exception).
POSITION pos,poss;
char letter;
UINT a,b,c,d;
UINT p;
CStringList strl; /// create CStringlist
strl.AddTail("Line One"); /// Add a few lines
strl.AddTail("Beer Number 2 please");
pos=strl.GetHeadPosition(); /// get pointer to head position of list
p=(UINT)pos;
printf ("%s\n",strl.GetAt(pos)); /// get pointer to position of line one
/// get position pointer as a UINT
printf("p= %d\n",p); /// output position as UINT
a=p>>24; // get last 8 bits
printf("a=%d",a);
letter=(static_cast<unsigned int>(a)); /// convert to 8bit char
a=(static_cast<char>(letter)); /// convert back to UINT
printf(" %d\n",a);
a=a<<24;
b=p<<8;
b=b>>24; // get 2nd to last set of 8 bits
printf("b=%d",b);
letter=(static_cast<unsigned int>(b)); /// convert to 8bit char
b=(static_cast<char>(letter)); /// convert back to UINT
printf(" %d\n",b);
b=b<<16;
c=p<<16;
c=c>>24; // get 3rd to last set of 8 bits
printf("c=%d",c);
letter=(static_cast<unsigned int>(c)); /// convert to 8bit char
c=(static_cast<char>(letter)); /// convert back to UINT
printf(" %d\n",c);
c=c<<8;
d=p<<24;
d=p>>24; // get first set of 8 bits
printf("d=%d ",d);
letter=(static_cast<unsigned int>(d)); /// convert to 8bit char
d=(static_cast<char>(letter)); /// convert back to UINT
printf("%d\n",d);
p=(UINT)a|b|c|d; // use or to add the sets of 8 bits together
printf("p with or =%d\n",p); // display p using or (these values should be the same as
printf("p with + =%d\n",a+b+c+d); // display p using + the intitial p)
poss=(POSITION)p;
getch();
printf ("%s",strl.GetAt(poss));
getch();
}
|
|
|
|
|
I still don't get what you're trying to do. Your casts are wrong, and you're assuming a POSITION is a pointer to one of the list elements. Don't make any assumptions about opaque data types like that (or HWNDs or any handles for that matter).
Oh wait, you just want to pick out the individual bytes of the pointer address? Use the bitwise operators, that's what they're there for:
BYTE a,b,c,d;
void* p = 0x1234abcd;
a = ( p & 0xFF000000 ) >> 24;
b = ( p & 0xFF0000 ) >> 16;
c = ( p & 0xFF00 ) >> 8;
d = ( p & 0xFF ); And just FYI, if you want the value of a pointer, just do this:
printf ( "%p", p );
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
thanks thats very helpfull Happy New Year
|
|
|
|
|
You have GOT to learn how to use the debugger.
Here is the output I got prior to the crash:
Line One
p= 3089908
a=0 0
b=47 47
c=37 37
d=0 0
p with or =3089664
p with + =3089664
Press any key to continue
Now, the first thing you should have done it verify that the values of a, b, c, and d are as expected. It turns out that the hexadecimal value of p is 0x2f25f4. Now, how can d be 0 when the low byte of p is f4?
d=p<<24;
d=p>>24;
printf("d=%d ",d);
letter=(static_cast(d)); d=(static_cast(letter));
If you look at that code, there are only two lines of code prior to the display of the value of d. The first line "d=p<<24" although odd, just shifts the low 8 bits into the high 8 bits. The bits we are after are still there, just in a strange place. The second line "d=p>>24" shifts the high 8 bits down into the low 8 bits. Hmm, well since that will cause us to lose the bits we are interested in, then that line of code must be wrong. I would imagine that you ment to type "d=d>>24".
Once that error is fixed, it would be functional.
Lets clean up the code some.
First, I don't understand why you are so hell bent on casting to and from a charater. There really is little point.
a = p & 0xFF000000;
printf("a=%d",a >> 24);
b = p & 0x00FF0000;
printf("b=%d",b >> 16);
c = p & 0x0000FF00;
printf("c=%d",c >> 8);
d = p & 0x000000FF;
printf("d=%d",d);
That code isolates each byte of the address just fine without all that extra conversion. The right shifts just aren't needed at all.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|