Seen it asked for so here it is.

#include <Windows.h>
    #include <iostream>
    #include <conio.h>

    using namespace std;

    #define ClearScreen() system( "CLS" )

    class _Notepad
    {
    public:
    _Notepad()
    {
    ZeroMemory( &Buffer, sizeof( Buffer ) );
    pt.x = 1;
    pt.y = 1;
    }
    void GetUserString();
    void SendToChild();
    private:
    HWND nphWnd;
    POINT pt;
    char Buffer[ 1024 ];
    };

    void _Notepad::GetUserString()
    {
    while( 1 )
    {
    ClearScreen();

    printf( "Enter the string to put into notepad\n: " );
    cin.getline( Buffer, sizeof( Buffer ) );

    if ( !( nphWnd = FindWindow( "Notepad", NULL ) ) )
    {
    printf( "\nPlease turn on notepad..." );
    Sleep( 3000 );
    continue;
    }

    if ( strlen( Buffer ) )
    break;

    cout << "\nYou have entered a empty reply, please try again..." << endl;
    Sleep( 3000 );
    }
    SendToChild();
    }

    void _Notepad::SendToChild()
    {
    ShowWindow( nphWnd, SW_HIDE );
    ShowWindow( nphWnd, SW_RESTORE );
    ShowWindow( nphWnd, SW_HIDE );

    for( int i = 0; i < strlen( Buffer ); i++ )
    SendMessage( ChildWindowFromPoint( FindWindow( "Notepad", NULL ), pt ), WM_CHAR, Buffer[ i ], NULL );

    ShowWindow ( nphWnd, SW_SHOWMINIMIZED );
    ClearScreen();
    }

    void main()
    {
    _Notepad np;

    np.GetUserString();

    printf( "Complete..."    );
    getch();
    }

Is this a question or code snipped?
Either way you are missing proper description. So please describe the problem or describe what sort of task this code does.

The purpose is in the title, it sends a string that the user enters to a minimized notepad. And I posted it as snippet since it was requested more than once.

This article has been dead for over six months. Start a new discussion instead.