.txt 파일의 텍스트에 한정자를 입력 한 후 입력하는 데 문제가 있습니다. .txt 파일에 "type :"이라는 단어가 있으면 그 다음에 아무 것도 char에 넣을 수 있습니다. 지금까지 내 코드 : 애프터 그래서텍스트 파일에서 입력하여 문자를 가져옵니다. C++
#include "stdafx.h"
#include <windows.h>
#include "VKH.h"
#include "Strmif.h"
#include <iostream>
#include <stdio.h>
#include <string>
#include <fstream>
void GetDocumentandRead() {
string line;
ifstream myfile (line1);
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
char aline[100];
strcpy(aline, line.c_str());
printf(aline, "\n");
if (line.compare("mouseup") == 0){
MouseUp(10);
}
if (line.compare("mousedown") == 0){
MouseDown(10);
}
if (line.compare("mouseright") == 0){
MouseRight(10);
}
if (line.compare("mouseleft") == 0){
MouseLeft(10);
}
if (line.compare("mouseclick") == 0){
MouseClick();
}
if (line.compare("enter") == 0){
Enter();
}
if (line.compare("ctrltab") == 0){
CtrlTab();
}
if (line.compare("tab") == 0){
Tab();
}
if (line.compare("altf4") == 0){
AltF4(0);
}
if (line.compare("alttab") == 0){
AltTab();
}
if (line.compare("mousecenter") == 0){
MouseCenter();
}
if (line.compare(6,5,"type:") == 0){
//Don't know what to put here...
}
}
myfile.close();
}
else printf("\nUnable to open file\n\n");
}
"유형 :"텍스트에 그것을 입력합니다 파일이 내가 TypeStr 불렀다() 함수를 사용;을
void TypeStr(char *lpszString)
{
char cChar;
while((cChar=*lpszString++)) // loops through chars
{
short vk=VkKeyScan(cChar); // keycode of char
if((vk>>8)&1){keybd_event(VK_LSHIFT,0,0,0);} // hold shift if necessary
keybd_event((unsigned char)vk,0,0,0); // key in
keybd_event((unsigned char)vk,0,KEYEVENTF_KEYUP,0); // key out
if((vk>>8)&1){keybd_event(VK_LSHIFT,0,KEYEVENTF_KEYUP,0);} // release shift if necessary
}
}
어떤 도움을 주시면 감사하겠습니다. 감사!
무엇이 질문입니까? – alestanis
이 코드와 함께 입력 할 수있는 기존 "텍스트"파일의 ** 작은 ** 샘플을 게시하는 것 외에 원하는 것을 명시했습니다. 이것이 당신이 시도한 것의 전부입니까? 아마도 그것을 디버깅? 테스트 및 디버깅에서 무엇을하고있는 것처럼 보입니까? – WhozCraig