I need to write a program that will do the following:
1. open image file using mspaint.exe
2. Then pass keystroke "cntrl-s" to mspaint.exe
3. Then close mspaint.exe
4. and repeat this process till all image files have been processed.
Here is my code so far
Code:
#include <windows.h>
#include <stdio.h>
int main()
{
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
char szExe[] = "mspaint.exe";
char buf[4444];
if(CreateProcess(0, szExe, 0, 0, 0, 0, 0, 0, &si, &pi))
{
// optionally wait for process to finish
//WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
}
I have no problem opening the images, but have not been able to automatically pass the keystoke "cntrl-s" to mspaint.
I have looked at keyboard dumps and other functions but have not gotton far with this part of program. I have no formal coding education so I am a complete novice here. Any help or suggestions would be greatly appreciated.
Douglas