There’s no such thing in VC++. Create your own dialog box if you need one
All posts by
Using Null
Determining if a handle is a null pointer if (MyString == nullptr) MyString = “”;
File Access General
There are 2 classes, depending on whether you are doing a single file operation, or whether you need repeated cached file access over a length of time: File – Static methods for one off access FileInfo – Create an instance of a FileInfo class to access files over a length of time. Both have the […]
Filename Not Permitted Characters
//Remove any characters not allowed in filenames characters:- \ / | : * ” ? < > MyString = MyString->Replace(“\\”, “-“); MyString = MyString->Replace(“/”, “-“); MyString = MyString->Replace(“|”, “-“); MyString = MyString->Replace(“:”, “-“); MyString = MyString->Replace(“*”, “-“); MyString = MyString->Replace(“\””, ” “); MyString = MyString->Replace(“?”, ” “); MyString = MyString->Replace(“<“, ” “); MyString = MyString->Replace(“>”, […]
Special Directories
using namespace System::Windows::Forms; using namespace System::IO; Exe path Directory Reflection::Assembly::GetExecutingAssembly()->Location Application Directory Application path Application::ExecutablePath //This gives you the full path including the filename Path::GetDirectoryName(Application::ExecutablePath) //This gives you the path to the directory (without trailing '\') or use String ^sPath sPath = Application::ExecutablePath; sPath = Path::GetDirectoryName(sPath); Location To Store Application Data #define MY_FILE_DIRECTORY_TO_USE Environment::GetFolderPath(Environment::SpecialFolder::ApplicationData) + […]
Write New File
using namespace System::IO; Save As Dialog Box String ^SaveAsFilename; //If last directory is not valid then default to My Documents if (!Directory::Exists(Path::GetDirectoryName(LastFileDirectory))) LastFileDirectory = Environment::GetFolderPath(Environment::SpecialFolder::MyDocuments); //—– SAVE FILE DIALOG BOX —– SaveFileDialog ^SelectFileDialog = gcnew SaveFileDialog(); SelectFileDialog->Filter = "Comma Separated Values (*." + MY_FILE_EXTENSION + ")|*." + MY_FILE_EXTENSION; //"txt files (*.txt)|*.txt|All files (*.*)|*.*" SelectFileDialog->FilterIndex = […]
Is QuickTime Present
This method looks to see if QuickTime is present in the registry. It isn’t foolproof but offers a simple test //————————————– //—– CHECK QUICKTIME IS PRESENT —– //————————————– bool QuicktimePresent = false; try { //This is the registry path we’re interested in: HKEY_LOCAL_MACHINE\Software\Apple Computer, Inc.\QuickTime RegistryKey ^rkey = Registry::LocalMachine; rkey = rkey->OpenSubKey(L”Software\\Apple Computer, Inc.”); array<String^>^names […]
Registry
Search the Registry Class’ in help – lots of examples using namespace Microsoft::Win32; Help has good example for the registry class. Read A Registry Value String ^VlcInstallPath; VlcInstallPath = Convert::ToString(Registry::GetValue(“HKEY_LOCAL_MACHINE\\SOFTWARE\\VideoLAN\\VLC”, “InstallDir”, “”)); Working Example Of Reading FTDI USB Chip entries in the Registry //—– CHECK REGISTRY TO FIND MATCHING FDTI DEVICES AND ONLY INCLUDE THOSE […]
Using QuickTime In An Application
Adding QuickTime to a project Menu > Project > Project Properties > Common Properties > References > Add New Reference > COM > Apple QuickTime Control 2.0 (AxInterop.QTOControlLib) In a form design view open the tool box > Right Click > Choose Items > COM Components > Select the ‘Apple QuickTime Control’ The ‘Apple QuickTime […]
Creating A Windows Forms Project From scratch
This is our internal check list to create a new Windows Forms Project Create a ‘CLR’ > ‘Windows Forms Application’. This selects a C++/CLI project and will automatically set the /clr compiler option. For VS2013 and onwards… Microsoft have decided to discourage using C++ for new windows for applications, instead preferring people to use C# […]
