Click here to Skip to main content
16,012,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionscrolling text Pin
locoone18-Jun-06 12:04
locoone18-Jun-06 12:04 
AnswerRe: scrolling text [modified] Pin
_AnsHUMAN_ 18-Jun-06 17:46
_AnsHUMAN_ 18-Jun-06 17:46 
GeneralRe: scrolling text Pin
locoone18-Jun-06 17:47
locoone18-Jun-06 17:47 
GeneralRe: scrolling text Pin
_AnsHUMAN_ 18-Jun-06 17:52
_AnsHUMAN_ 18-Jun-06 17:52 
Questionchange derived class - building a dll an import it Pin
tbrake18-Jun-06 10:37
tbrake18-Jun-06 10:37 
AnswerRe: change derived class - building a dll an import it Pin
Laxman Auti18-Jun-06 19:44
Laxman Auti18-Jun-06 19:44 
QuestionWriteConsoleOutput() Problem [modified] Pin
CoffeeAddict1918-Jun-06 10:07
CoffeeAddict1918-Jun-06 10:07 
AnswerRe: WriteConsoleOutput() Problem Pin
Randor 18-Jun-06 11:22
professional Randor 18-Jun-06 11:22 
Hi,

There is alot wrong with your source code.

1.) PSMALL_RECT is a pointer, and you never assign it.
2.) In your for-loops, you need to assign the integer i a value. Modern ISO compliant compilers will not default to zero without bitterly complaining.
3.) In your second for-loop, you use a condition of (TextToPrint.length() - 1) which is incorrect. This will cause the last character to be omitted.
4.) Your assigning TemporaryBuffer[i].Char an incorrect string value.

Here is a repaired version that should work:

<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
HANDLE hIn;<br />
HANDLE hOut;<br />
string TextToPrint;<br />
CHAR_INFO TemporaryBuffer[20];<br />
CONSOLE_SCREEN_BUFFER_INFO BufferInformation;<br />
COORD TextToWriteSize;<br />
COORD UpperLeftText;<br />
SMALL_RECT DestCoords;<br />
<br />
hOut = GetStdHandle(STD_OUTPUT_HANDLE);<br />
hIn = GetStdHandle(STD_INPUT_HANDLE);<br />
GetConsoleScreenBufferInfo(hOut, &BufferInformation);<br />
TextToPrint = "It worked!";<br />
TextToWriteSize.X = TextToPrint.length();<br />
TextToWriteSize.Y = 1;<br />
UpperLeftText.X = 0;<br />
UpperLeftText.Y = 0;<br />
DestCoords.Top = 5;<br />
DestCoords.Left = 5;<br />
DestCoords.Right = 5 + TextToPrint.length();<br />
DestCoords.Bottom = 6;<br />
<br />
for(int i=0; i < 20; i++)<br />
TemporaryBuffer[i].Attributes = BufferInformation.wAttributes;<br />
<br />
for(int i=0; i < TextToPrint.length(); i++)<br />
{<br />
	TemporaryBuffer[i].Char.AsciiChar = (char)TextToPrint[i];<br />
	TemporaryBuffer[i].Char.UnicodeChar = (WCHAR)TextToPrint[i];<br />
}<br />
<br />
WriteConsoleOutput(hOut, TemporaryBuffer, TextToWriteSize, UpperLeftText, &DestCoords);<br />
<br />
cin.get();<br />
<br />
return 0;<br />
}<br />
<br />


Note: Your compiler will have Unicode or Ascii build environments. This version should work in both.
Questionproblem with new and pointers Pin
V_shr18-Jun-06 7:40
V_shr18-Jun-06 7:40 
AnswerRe: problem with new and pointers Pin
Shog918-Jun-06 8:26
sitebuilderShog918-Jun-06 8:26 
GeneralRe: problem with new and pointers Pin
V_shr18-Jun-06 10:11
V_shr18-Jun-06 10:11 
GeneralRe: problem with new and pointers Pin
Shog918-Jun-06 10:26
sitebuilderShog918-Jun-06 10:26 
GeneralRe: problem with new and pointers Pin
V_shr18-Jun-06 10:31
V_shr18-Jun-06 10:31 
AnswerRe: problem with new and pointers Pin
Randor 18-Jun-06 9:39
professional Randor 18-Jun-06 9:39 
QuestionRe: problem with new and pointers Pin
Laxman Auti18-Jun-06 19:14
Laxman Auti18-Jun-06 19:14 
QuestionHow to Export leaf from regEdit in runtime ?? Pin
Yanshof18-Jun-06 7:38
Yanshof18-Jun-06 7:38 
AnswerRe: How to Export leaf from regEdit in runtime ?? Pin
peterchen18-Jun-06 9:29
peterchen18-Jun-06 9:29 
AnswerRe: How to Export leaf from regEdit in runtime ?? Pin
Hamid_RT18-Jun-06 23:32
Hamid_RT18-Jun-06 23:32 
QuestionWin32 API: top-level window without focus Pin
Zoomby18-Jun-06 3:08
Zoomby18-Jun-06 3:08 
AnswerRe: Win32 API: top-level window without focus Pin
Shog918-Jun-06 8:38
sitebuilderShog918-Jun-06 8:38 
GeneralRe: Win32 API: top-level window without focus Pin
Zoomby18-Jun-06 10:08
Zoomby18-Jun-06 10:08 
GeneralRe: Win32 API: top-level window without focus Pin
Shog918-Jun-06 10:30
sitebuilderShog918-Jun-06 10:30 
GeneralRe: Win32 API: top-level window without focus Pin
Zoomby18-Jun-06 11:41
Zoomby18-Jun-06 11:41 
GeneralRe: Win32 API: top-level window without focus Pin
Shog918-Jun-06 12:53
sitebuilderShog918-Jun-06 12:53 
GeneralRe: Win32 API: top-level window without focus Pin
Zoomby19-Jun-06 7:37
Zoomby19-Jun-06 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.