Target Framework

In VS2013 this isn't settable within VS itself. To view the target framework Project Properties > Common Properties Ifa target framework is set (not all applications need it) then it is displayed above the right side main box(es). To set / change a target framework Close the project. Open the projects .vcxproj with notepad.  Find the […]

Read More

Other System Applications

Other Applications / Processes Running This is a C# example of finding all processes that are running with something particular in their name (include System.Diagnostics namespace):- var Processses = from p in Process.GetProcesses() where p.ProcessName.Contains(“x”) select p;

Read More

Manipulating Other Applications

FULL LIST OF AVAILABLE FUNCTIONS ON MSDN: http://msdn.microsoft.com/en-us/library/dd469351(VS.85).aspx SetCursorPos – Move and Click Mouse Cursor Move the cursor postion to somewhere, relative to top left corner of screen Outside of function / in header file: [DllImport(“user32.dll”)] static bool SetCursorPos(int X, int Y); [DllImport(“user32.dll”)] static void mouse_event(unsigned int dwFlags, unsigned int dx, unsigned int dy, unsigned […]

Read More

Getting Arguments Passed To The Application Exe

//N.B. You can do this anywhere in the application – it doesn’t have to be in the main function. array<String^> ^arguments = Environment::GetCommandLineArgs(); if (arguments != nullptr) { for each (String ^argument in arguments) { //CHECK THE NEXT ARGUMENT //Note that if there we’re no arguments you still get the exe filename / path as […]

Read More

.Useful Things

DO EVENTS Whilst your application will be multi threaded if you hold waiting for something you need to use this to allow other tasks on the same thread to execute, and to tell the OS that your holding so it’s OK for it to attend to other things. System::Windows::Forms::Application::DoEvents(); Warning! Remember that using this can […]

Read More

Launching Specific Things

Launching A Web Page In A Browser System::Diagnostics::Process::Start("http://www.ibexuk.com"); Opening file in Notepad using namespace System::Diagnostics; ProcessStartInfo ^startInfo = gcnew ProcessStartInfo(); startInfo->FileName = "C:\\Windows\\notepad.exe"; startInfo->Arguments = "\"" + Path::GetDirectoryName(Application::ExecutablePath) + "\\SomeDocName.Config\""; Process::Start(startInfo); Launching Another Application From C++ using namespace System::Diagnostics; Process::Start("C:\\GVNVR\\ViewLog500.exe"); //or System::Diagnostics::Process::Start("C:\\GVNVR\\ViewLog500.exe"); If you need to pass arguments then use ProcessStartInfo ^startInfo = gcnew ProcessStartInfo(); […]

Read More

Foreground Window Detect and Set

Define The DLL Functions [System::Runtime::InteropServices::DllImport(L”user32.dll”)] static System::IntPtr GetForegroundWindow(); [System::Runtime::InteropServices::DllImport(L”user32.dll”)] static bool SetForegroundWindow(System::IntPtr hWnd); Check Some Other Ap Is Not In Foreground System::IntPtr WinHandle = GetForegroundWindow(); //BRING US TO THE FRONT if (WinHandle == ProcessName->MainWindowHandle) //ProcessName is a process we created elsewhere SetForegroundWindow(this->Handle); //Can test return bool value if we want //Use this if you want […]

Read More

Assembly Attributes

You may want to use FileVersionInfo instead of or in attaion to these as they get passed into the .exe file and are viewable in explorer, whereas assembly attributes don’t using namespace System::Windows::Forms; Assembly attributes are basically global text strings that you can get at in your code. Default Assembly Attributes They are in the […]

Read More

FileVersionInfo

You can read file version attributes of your applications exe or other files using this class.  If you prefer to use file attributes for your application rather than assembly attributes (so they show up in the exe file properly in explorer etc), you can use this to read them in you application. Reading Values (Application […]

Read More