VB icon

GhostWriter

Email
Submitted on: 1/3/2015 9:58:00 AM
By: Curtis Miller (from psc cd)  
Level: Intermediate
User Rating: By 4 Users
Compatibility: C++ (general), Microsoft Visual C++
Views: 340
 
     Opens Notepad and mysteriously(By not creating a window) Types a message in notepads text.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :GhostWriter
//**************************************
Windows.h
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: GhostWriter
// Description:Opens Notepad and mysteriously(By not creating a window) Types a message in notepads text.
// By: Curtis Miller (from psc cd)
//
// Inputs:No inputs
//
// Returns:Nothing
//
// Assumes:This program Shows how to gain acess to a main window and a child window and send text to it.
//
// Side Effects:May freak people out if they double click this app.
//**************************************

/*******************
****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;
}


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.