MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / UserSelectNewDiskImageOnly

Method UserSelectNewDiskImageOnly

source/Disk.cpp:1834–1873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1832//===========================================================================
1833
1834bool Disk2InterfaceCard::UserSelectNewDiskImageOnly(const int drive, LPCSTR pszFilename, std::string& openFilename, DWORD flags)
1835{
1836 if (!IsDriveConnected(drive))
1837 {
1838 GetFrame().FrameMessageBox("Drive not connected!", "Insert disk", MB_ICONEXCLAMATION | MB_SETFOREGROUND | MB_OK);
1839 return false;
1840 }
1841
1842 char directory[MAX_PATH];
1843 char filename[MAX_PATH];
1844
1845 StringCbCopy(filename, MAX_PATH, pszFilename);
1846
1847 RegLoadString(REG_PREFS, REGVALUE_PREF_START_DIR, 1, directory, MAX_PATH, "");
1848 std::string title = StrFormat("Select Disk Image For Drive %d", drive + 1);
1849
1850 OPENFILENAME ofn;
1851 memset(&ofn, 0, sizeof(OPENFILENAME));
1852 ofn.lStructSize = sizeof(OPENFILENAME);
1853 ofn.hwndOwner = GetFrame().g_hFrameWindow;
1854 ofn.hInstance = GetFrame().g_hInstance;
1855 ofn.lpstrFilter = "All Images\0*.bin;*.do;*.dsk;*.nib;*.po;*.gz;*.woz;*.zip;*.2mg;*.2img;*.iie;*.apl\0"
1856 "Disk Images (*.bin,*.do,*.dsk,*.nib,*.po,*.gz,*.woz,*.zip,*.2mg,*.2img,*.iie)\0*.bin;*.do;*.dsk;*.nib;*.po;*.gz;*.woz;*.zip;*.2mg;*.2img;*.iie\0"
1857 "All Files\0*.*\0";
1858 ofn.lpstrFile = filename;
1859 ofn.nMaxFile = MAX_PATH;
1860 ofn.lpstrInitialDir = directory;
1861 ofn.Flags = OFN_PATHMUSTEXIST;
1862 ofn.lpstrTitle = title.c_str();
1863
1864 if (!GetOpenFileName(&ofn))
1865 return false;
1866
1867 flags = ofn.Flags;
1868 openFilename = filename;
1869 if (!ofn.nFileExtension || !filename[ofn.nFileExtension])
1870 openFilename += ".dsk";
1871
1872 return true;
1873}
1874
1875bool Disk2InterfaceCard::UserSelectNewDiskImage(const int drive, LPCSTR pszFilename/*=""*/)
1876{

Callers 2

HandleHDDComboMethod · 0.45

Calls 3

RegLoadStringFunction · 0.85
StrFormatFunction · 0.85
FrameMessageBoxMethod · 0.80

Tested by

no test coverage detected