Click here to Skip to main content
15,793,368 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j30-Sep-20 5:54
professionalsandford_j30-Sep-20 5:54 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
Gerry Schmitz29-Sep-20 19:33
mveGerry Schmitz29-Sep-20 19:33 
GeneralRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j29-Sep-20 23:23
professionalsandford_j29-Sep-20 23:23 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
mo149230-Sep-20 9:55
mo149230-Sep-20 9:55 
GeneralRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j30-Sep-20 13:05
professionalsandford_j30-Sep-20 13:05 
AnswerRe: WritePrinter Fails to Print on Inkjet Printer Pin
mo14921-Oct-20 2:18
mo14921-Oct-20 2:18 
GeneralRe: WritePrinter Fails to Print on Inkjet Printer Pin
sandford_j1-Oct-20 3:53
professionalsandford_j1-Oct-20 3:53 
QuestionCopying to ClipBoard By using SendInput, Failure....[Solved] Pin
EuiyongYun28-Sep-20 15:37
EuiyongYun28-Sep-20 15:37 
Hi~
I wrote the following function to copy the selected part of NotePad.
( Sending Control+C Message )
However, it does not work!
Only 'C' is printed in NotePad.
Does anyone know why?

>> OS : Windows10
>> Compiler : VisualStudio 2010
C++
Send_KeyBoard_Control_C()
{
	HWND notepad = ::FindWindow(__T("NotePad"), NULL );
	if (notepad == NULL) {
		return;
	}
	if (!::SetForegroundWindow(notepad)) {
		return;
	}

	int sendCount = 0;
	INPUT input;

	// Press the "Ctrl" key
	ZeroMemory(&input, sizeof(INPUT));
	input.type = INPUT_KEYBOARD;
	input.ki.wVk = VK_CONTROL;
	input.ki.wScan = 0;
	input.ki.dwFlags = 0;
	sendCount += SendInput(1, &input, sizeof(INPUT));

	// Press the "C" key
	ZeroMemory(&input, sizeof(INPUT));
	input.type = INPUT_KEYBOARD;
	input.ki.wScan = 'C';
	input.ki.dwFlags = KEYEVENTF_UNICODE;
	sendCount += SendInput(1, &input, sizeof(INPUT));

	// Release the "C" key
	ZeroMemory(&input, sizeof(INPUT));
	input.type = INPUT_KEYBOARD;
	input.ki.wScan = 'C';
	input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
	sendCount += SendInput(1, &input, sizeof(INPUT));

	// Release the "Ctrl" key
	ZeroMemory(&input, sizeof(INPUT));
	input.type = INPUT_KEYBOARD;
	input.ki.wVk = VK_CONTROL;
	input.ki.wScan = 0;
	input.ki.dwFlags = KEYEVENTF_KEYUP;
	sendCount += SendInput(1, &input, sizeof(INPUT));

	if ( sendCount != 4 ) {
		TRACE("fail\n");
	}
}


modified 30-Sep-20 6:56am.

AnswerRe: Copying to ClipBoard By using SendInput, Failure.... Pin
Victor Nijegorodov28-Sep-20 23:59
Victor Nijegorodov28-Sep-20 23:59 
GeneralRe: Copying to ClipBoard By using SendInput, Failure.... Pin
EuiyongYun29-Sep-20 3:50
EuiyongYun29-Sep-20 3:50 
GeneralRe: Copying to ClipBoard By using SendInput, Failure.... Pin
Victor Nijegorodov29-Sep-20 8:22
Victor Nijegorodov29-Sep-20 8:22 
QuestionHow do I convert my C++ function pointer to a C function pointer? Pin
arnold_w28-Sep-20 6:06
arnold_w28-Sep-20 6:06 
AnswerRe: How do I convert my C++ function pointer to a C function pointer? Pin
Richard MacCutchan28-Sep-20 6:54
mveRichard MacCutchan28-Sep-20 6:54 
AnswerRe: How do I convert my C++ function pointer to a C function pointer? Pin
CPallini28-Sep-20 7:07
mveCPallini28-Sep-20 7:07 
GeneralRe: How do I convert my C++ function pointer to a C function pointer? Pin
arnold_w28-Sep-20 8:33
arnold_w28-Sep-20 8:33 
AnswerRe: How do I convert my C++ function pointer to a C function pointer? Pin
Mircea Neacsu28-Sep-20 7:14
Mircea Neacsu28-Sep-20 7:14 
QuestionEmbedded C program Pin
Parth Akshay Barange22-Sep-20 23:27
Parth Akshay Barange22-Sep-20 23:27 
SuggestionRe: Embedded C program Pin
Graham Breach22-Sep-20 23:59
Graham Breach22-Sep-20 23:59 
AnswerRe: Embedded C program Pin
Richard MacCutchan23-Sep-20 0:40
mveRichard MacCutchan23-Sep-20 0:40 
AnswerRe: Embedded C program Pin
CPallini23-Sep-20 2:12
mveCPallini23-Sep-20 2:12 
AnswerRe: Embedded C program Pin
Victor Nijegorodov23-Sep-20 9:42
Victor Nijegorodov23-Sep-20 9:42 
AnswerRe: Embedded C program Pin
Dave Kreskowiak23-Sep-20 10:20
mveDave Kreskowiak23-Sep-20 10:20 
QuestionWhy isn't the copy constructor called Pin
Mircea Neacsu22-Sep-20 15:59
Mircea Neacsu22-Sep-20 15:59 
AnswerRe: Why isn't the copy constructor called Pin
_Flaviu22-Sep-20 20:48
_Flaviu22-Sep-20 20:48 
GeneralRe: Why isn't the copy constructor called Pin
Mircea Neacsu23-Sep-20 2:45
Mircea Neacsu23-Sep-20 2:45 

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.