|
#using <mscorlib.dll>
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
using namespace System;
using namespace System::Diagnostics;
using namespace System::Drawing;
using namespace System::Windows::Forms;
__gc class splitter : public Form
{
public:
splitter()
{
Text = S"Process useage class!";
Size = Drawing::Size(500, 400);
this->set_BackColor(Color::FloralWhite);
this->StartPosition = FormStartPosition::CenterScreen;
this->MaximizeBox=false;
this->FormBorderStyle=FormBorderStyle::Fixed3D;
but = new Button();
but->Text="Click to run notepad";
but->Size = System::Drawing::Size(160, 30);
but->Top=100;
but->Left=80;
this->Controls->Add(but);
but->Click += new EventHandler(this, OnProcess_click);
}
private:
void OnProcess_click(Object *sender,EventArgs* e)
{
// create object
Process *notePad = new Process();
//inialize
notePad->StartInfo->FileName = "notepad.exe";
notePad->StartInfo->Arguments = "selvam.txt";
//start the process
notePad->Start();
//wait 1000 secounds and kill it
notePad->WaitForExit(1000);
notePad->Kill();
/*
System::Threading::Thread::Sleep(1000);
ProcessModule *myProcessModule;
// Get all the modules associated with 'myProcess'.
ProcessModuleCollection *myProcessModuleCollection = notePad->Modules;
myProcessModule = notePad->MainModule;
String *strFileNAme, *strModulName;
int nMemory;
strFileNAme = myProcessModule->FileName;
strModulName = myProcessModule->ModuleName;
//myProcessModule->FileVersionInfo;
nMemory = myProcessModule->ModuleMemorySize;
MessageBox::Show(str);
*/
}
private:
Button *but;
};
int __stdcall WinMain()
{
splitter *Object= new splitter();
Application::Run(Object);
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Selvam has worked on several technologies like Java, Python, Big data, VC++, MFC, Windows API and Weblogic server. He takes a lot of interest in reading technical articles and enjoys writing them too. He has been awarded as a Microsoft Community Star in 2004, MVP in 2005-06, SCJP 5.0 in 2009, Microsoft Community Contributor(MCC) 2011.
Big Data
o Google Professional Data Engineer 2021
o Confluent Certified Developer for Apache Kafka 2020
o Datastax Apache Cassandra 3.x Developer Associate Certification 2020
✓ Cloud
o Google Professional Cloud Architect 2021
o Microsoft Certified: Azure Solutions Architect Expert 2020
o AWS Certified Solutions Architect - Associate 2020
✓ Oracle Certified Master, Java EE 6 Enterprise Architect (OCMEA) 2018
Github :
https://github.com/selvamselvam
Web site:
http://www.careerdrill.com
Linkedin:
https://www.linkedin.com/in/selvamselvam/