|
Thanks alot! .. It worked
|
|
|
|
|
Helloooooo,
Ok sorry to be such a retarded newbie, but I used to be the bomb programmer on the Commodore 64 (ahaha - used to release tron-light cycle and tank games for the modem)..
I am very very very new to C++, and have only 2 books on the subject so far, so please forgive the next question -------- Is Visual C++ different from C++?? I only have a simple compiler so far - DevCpp+ or whatever.
So far I've only been able to make a DOS game where a little packman guy runs through a bunch of periods (aha) through a complete reprinting of its map every time a user types in a direction to run. As far as I know, I can't trap actual keystrokes from the keyboard with the regular cin lahdeedaa. Am I correct in assuming that 'libraries' and 'headers' are merely pre-done algorithms so I don't have to write them myself, and that I need to find a library or header file that will let me catch keystrokes (without waiting for enter) with a simple command? Also, once I find such a (insert definition here), how do I know how to interface/interact with it? Its clear that <iostream> requires me to use cout to put out text, and cin to get it in, but thats only because it was written in a book I read, and its a standard header file. I tried a few libraries/headers already that supposedly made graphics for me, or caught keyboard strokes, but came with almost no documentation so I am left helpless. What am I doing wrong? Is there a website that will explain all these sh*tty details? Another good book? Any collection of source code that will do more explaining than
// Yeah that was a function
?? Help help (cry cry).
Any advice will be greatly appreciated, as I am very excited about learning C++. You can contact me at ontheritz@yahoo.com
Thanks!!!!!
Mike
|
|
|
|
|
|
How to do it by using MFC message map ?
Please suggest me,thanks you.
|
|
|
|
|
|
COleDateTime::GetCurrentTime ()
time(NULL)
GetSystemTime(...)
|
|
|
|
|
Can you detail this code more ?
I dont understand it.
|
|
|
|
|
// example for COleDateTime::GetCurrentTime
COleDateTime dateTest;
// dateTest value = midnight 30 December 1899
dateTest = COleDateTime::GetCurrentTime();
// dateTest value = current date and time
// a second example for COleDateTime::GetCurrentTime
// Since GetCurrentTime() is a static member, you can use it in
// a constructor:
COleDateTime t1 = COleDateTime::GetCurrentTime();
COleDateTime t2(COleDateTime::GetCurrentTime());
// Or in a normal assignment operator
COleDateTime t3;
t3 = COleDateTime::GetCurrentTime();
// or even in an expression
if (COleDateTime::GetCurrentTime().GetDayOfWeek() == 6)
_tprintf(_T("Thank Goodness it is Friday!\n\n"));
Taken direct from the MSDN - if you don't have it you should check it out online - msdn.microsoft.com
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
I have gotten much further in my quest to print from a Dialog based app. The following code enables me to determine the height of the font I have selected. When I print text then move down by the height of the font the second line prints over the top of the lower part of lowercase charactersie. the dangly bit of the g.
LOGFONT* pLogFont = new LOGFONT;
pLogFont->lfHeight = -MulDiv (lfFontSize, dc.GetDeviceCaps (LOGPIXELSY), 72);
How can I determine the height including dangly bits of a given font.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Use positive lfHeight. This will instruct font mapper to interpret this value as 'cell height'. Cell height should include 'dangling bits' (called external leading in fontalese).
You'll find more details in Platform SDK LOGFONT docs.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz to the rescue yet again.
I actually tried this this afternoon as I couldn't see a good reason to have pFontLog->lfHeight as a negative value. As you mentioned the whole character was displayed but at a reduced size.
I printed some text out in Verdana 16 Bold and Verdana 10 Normal. When pFontLog->lfHeight was negative the printed size was the same as from Word 2000. When it was positive the size was considerably smaller.
Is this how it should be? Will I find the answers when I look into the LOGFONT documentation more fully. (I have look fairly extensively at this doco and it hasn't clicked yet).
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Michael,
The code sample I sent before prints out multiple lines without overlapping of ascenders or descenders. Let me have a look at your code and I'll see what I can do to help.
Derek - Salamander Software Ltd.
|
|
|
|
|
When it was positive the size was considerably smaller. Is this how it should be?
Yes. Assume that you pass +20 as height, device and logical units are identical for simplicity. This will be the height of the character cell - actual letters have to be smaller to fit into 20 pixels.
Pass -20. Font mapper uses absolute value (20) as character height. Character height is only part of the character cell, so actual character cell is higher than 20 pix, say 24. Letters are larger when displayed/printed.
Word and other apps use MulDiv trick to get 'point size'. To make lines spaced correctly, you should call GetTextMetrics after selecting the font. Add tmHeight and tmExternalLeading to get the vertical space for single line of text.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
Is there any macro or some thing to avoid memory leak.I am finding problems with linked lists.
I have 10-12 lists and these are causing(actually my code )during relase.
It not only crashes the program but also the OS.
How to check where exactly is the problem without crashing the program and eventually windows itself.
thanks
|
|
|
|
|
Try using debugger walking your code step by step.
You could also try using BoundsChecker program to catch memory leaks.
Miroslav Rajcic
|
|
|
|
|
Use _CrtDumpMemoryLeaks().
These leaks can be seen in after using the debugger and exiting the
program(Your exit, not stopping the dbgr).
Then follow the addresses.
#include <crtdbg.h>
Joy...
--Bar Cochva--
|
|
|
|
|
Hello there,
Someone please tell me which are the minimal places in the registry where I should add an ODBC entry.
It would help if someone tells the minimal entries too.
Thanx
|
|
|
|
|
use SQLConfigureDataSource(...)
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
can someone please help me with this piece of code. i was at work and bored so i started writing this. It should generate 9999 random numbers and count how many times it was 5 (according to me anyways). i'm really confused because i've programmed some heavy stuff already in MFC and i just dont get this. The problem is that v turns out to be 75536 every time i run it...
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
int main(int argc, char *argv[])
{
srand((unsigned)time(NULL));
int i;
int v;
for (i=0;i<=9999;i++)
{
int a = rand()%(9-0);
cout << a;
if(a=5)
{
v = v+1;
}
}
cout << "\n";
cout << "\n";
cout << "The number of times 5 was generated:";
cout << v;
cout << " / 9999\n";
getch();
return 0;
}
Thankya
Kuni
|
|
|
|
|
ok the includes are:
stdio.h
iostream.h
conio.h
stdlib.h
time.h
(yes there was one include too many :p)
kuni
|
|
|
|
|
ok the includes are:
stdio.h
iostream.h
conio.h
stdlib.h
time.h
(yes there was one include too many :p)
kuni
|
|
|
|
|
if (a=5)
Shouldn't that be if (a==5) ?
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
no i tried that before, it gives something even more odd, v becomes negative....
kuni
|
|
|
|
|
Perhaps you should initialize v variable at the start of the program
int v = 0;
Miroslav Rajcic
http://www.spacetide.com
|
|
|
|
|
lol i just figured that out thx anyways
|
|
|
|