Jump to content

MSH

New Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Favorite Area of Science
    the world is my home

MSH's Achievements

Lepton

Lepton (1/13)

0

Reputation

  1. this is my code: // CreatProcess.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <Windows.h> #include <stdio.h> #include <iostream> #include <Psapi.h> #pragma comment(lib,"Psapi") using namespace std; void _tmain(int argc, _TCHAR* argv[]) { int intNumberofProcesses; cout << "Enter Number Of Processes:" << endl; cin >> intNumberofProcesses; STARTUPINFOA startUpInfo = {sizeof(startUpInfo)}; PROCESS_INFORMATION processInfo; int intNumberOfOpenFiles = 0; int processCounter = 0; for(int i = 0; i < intNumberofProcesses;i++) { try { CreateProcessA("c:\\windows\\system32\\calc.exe", NULL,NULL,NULL,FALSE,NULL,NULL,NULL,&startUpInfo,&processInfo); intNumberOfOpenFiles++; } catch(char * str) { cout << "Error:" << str << endl; } unsigned long listOfProccesses[1024]; unsigned long cbNeeded; EnumProcesses(listOfProccesses,sizeof(listOfProccesses),&cbNeeded); unsigned long numberOfProcesses = cbNeeded / sizeof(unsigned long); int calcID = GetProcessId("calc.exe"); for(unsigned long i = 0 ;i < numberOfProcesses ;i++) { if(calcID == listOfProccesses) { processCounter++; } } } cout << processCounter << endl; system("Pause"); } opening 200 processes cause the application crash, but system have enough resources, i don't know why???? sorry bot it is not my problem... the same, Excel application. Excel says "not enough resources" this occur when just 10% of CPU and ram used... i know this: the desktop heap too have enough resources, and i don't know whats the problem... be or not to be, this is the question... :-D
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.