Click here to Skip to main content
15,901,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using WriteFile [modified] Pin
Stephen Hewitt18-Jun-06 16:47
Stephen Hewitt18-Jun-06 16:47 
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 
I'm trying to use WriteConsoleOutput to print blocks of text to the screen (strings/streams). I would use WriteConsole() but then I have to move the cursor position after each line is printed and that isn't very elegant. I'm getting this error:

c:\Documents and Settings\John\My Documents\Visual Studio Projects\Testing_Win32_Console\Testing_Win32_Console.cpp(40): error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::allocator<_Ty>::value_type' (or there is no acceptable conversion)
with
[
_Ty=char
]

I know this is probably a really stupid question but I couldn't find any good examples of WriteConsoleOutput() in use on the internet, and I don't have anyone else's brain to pick.

The relevant line has a smiley next to it:

<br />
#include iostream //brackets removed so I could post it<br />
#include string<br />
#include windows.h<br />
<br />
using namespace std;<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 />
	PSMALL_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; i < 20; i++)<br />
        TemporaryBuffer[i].Attributes = BufferInformation.wAttributes;<br />
<br />
for(int i; i < TextToPrint.length() - 1; i++)<br />
	TemporaryBuffer[i].Char = TextToPrint[i]; :mad:<br />
<br />
	WriteConsoleOutput(hOut, TemporaryBuffer, TextToWriteSize, UpperLeftText, DestCoords);<br />
<br />
	cin.get();<br />
<br />
	return 0;<br />
}<br />


-- modified at 16:13 Sunday 18th June, 2006
AnswerRe: WriteConsoleOutput() Problem Pin
Randor 18-Jun-06 11:22
professional Randor 18-Jun-06 11:22 
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 

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.