C++ 打开记事本 并写入文件 (能打开但是写不进去求解答)

#include <iostream>
#include <windows.h>
#include <fstream>
int main ()
{
 
HWND hwnd;




hwnd = ::FindWindow ("Notepad","无标题-记事本");
if (hwnd == NULL) 

::ShellExecute(hwnd,"open","a.txt",NULL,NULL,SW_SHOWNORMAL); 


Sleep(1000);
char str[12] = "1"; 
::SendMessage (hwnd, WM_SETTEXT, 0,(LPARAM)str); //向EDIT写入文字
}


}

你可能感兴趣的:(C++,记事本)