README.md
December 5, 2022 ยท View on GitHub
Description
Opens Notepad and mysteriously(By not creating a window) Types a message in notepads text.
More Info
No inputs
This program Shows how to gain acess to a main window and a child window and send text to it.
May freak people out if they double click this app.
| Submitted On | |
| By | Curtis Miller |
| Level | Intermediate |
| User Rating | 4.8 (19 globes from 4 users) |
| Compatibility | C++ (general), Microsoft Visual C++ |
| Category | Miscellaneous |
| World | C / C++ |
| Archive File |
API Declarations
Windows.h
Source Code
/*******************
****Ghost Writer****
*******************/
#include <windows.h>
int WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
ShellExecute(NULL,"open","C:\\Windows\\NOTEPAD.EXE",NULL,NULL,SW_SHOWNORMAL); //Opens Notepad
Sleep(1000); //Stops the program for 1000 millaseconds
HWND Notepad; //Defines handle notepad
HWND text; //Defines handle to text
Notepad = FindWindow("Notepad",NULL); //Initializes Notepad handle
text = FindWindowEx(Notepad,0,"Edit",0); //Initializes text to the child window Edit
SendMessage(text,WM_SETTEXT,0,(LPARAM)(LPCTSTR)"This Code was written in C++"); //Sends the Text to the CHild window text
return 0;
}