cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Windows Programming
Multitasking
Multitasking
Dec 4, 2010 at 9:21am UTC
Rooonaldinho
(3)
Hello,
Can you please tell me how to make a program with processes (parent,child,grandchild) and how to print the id of a process and a number in each process. I have tried the following, but it isn't what I need:
#include "stdafx.h"
#include "process.h"
#include "iostream"
#include "windows.h"
#include "string"
#include "cstdio"
int _tmain(int argc, _TCHAR* argv[])
{
spawnl(P_NOWAIT,"processes1.exe","5","6","7");
std::wstring windowName;
std::getline(std::wcin, windowName);
HWND windowHandle = FindWindowW(NULL, windowName.c_str());
DWORD* processID = new DWORD;
GetWindowThreadProcessId(windowHandle, processID);
int i;
std::wcout<<*processID<<std::endl;
std::getline(i);
printf(("%u"),i);
system("pause");
return 0;
}
Thank you in advance!
Topic archived. No new replies allowed.