├── .gitignore
├── LICENSE
├── README.md
├── make
├── clean__doslib_all.bat
├── make__doslib_Debug_all.bat
├── make__doslib_Release_all.bat
├── make_doslib.bat
└── make_doslib.sln
├── resources
└── doslib.png
└── source
├── ArxVer.h
├── DOSLib.cpp
├── DOSLib.rc
├── DOSLib.sln
├── DOSLib.vcxproj
├── DOSLib.vcxproj.filters
├── DOSLibApp.cpp
├── DOSLibApp.h
├── DosAboutDialog.cpp
├── DosAboutDialog.h
├── DosAdsHelpers.cpp
├── DosAdsHelpers.h
├── DosCheckListDialog.cpp
├── DosCheckListDialog.h
├── DosColorDialog.cpp
├── DosColorDialog.h
├── DosColorListBox.cpp
├── DosColorListBox.h
├── DosComboListDialog.cpp
├── DosComboListDialog.h
├── DosDragListBox.cpp
├── DosDragListBox.h
├── DosDualListDialog.cpp
├── DosDualListDialog.h
├── DosDwgPreviewDialog.cpp
├── DosDwgPreviewDialog.h
├── DosEditBoxDialog.cpp
├── DosEditBoxDialog.h
├── DosEditListDialog.cpp
├── DosEditListDialog.h
├── DosFileDialog.cpp
├── DosFileDialog.h
├── DosFileMerge.cpp
├── DosFileMerge.h
├── DosFileOperation.cpp
├── DosFileOperation.h
├── DosFolderDialog.cpp
├── DosFolderDialog.h
├── DosGetCancelDialog.cpp
├── DosGetCancelDialog.h
├── DosGetDateDialog.cpp
├── DosGetDateDialog.h
├── DosGetIntDialog.cpp
├── DosGetIntDialog.h
├── DosGetProgressDialog.cpp
├── DosGetProgressDialog.h
├── DosGetPwdDialog.cpp
├── DosGetPwdDialog.h
├── DosGetRealDialog.cpp
├── DosGetRealDialog.h
├── DosGetStringDialog.cpp
├── DosGetStringDialog.h
├── DosGlyphButton.cpp
├── DosGlyphButton.h
├── DosHtmlDialog.cpp
├── DosHtmlDialog.h
├── DosHtmlDialogEx.cpp
├── DosHtmlDialogEx.h
├── DosInPlaceCtrls.cpp
├── DosInPlaceCtrls.h
├── DosInterDragListBox.cpp
├── DosInterDragListBox.h
├── DosLayerListDialog.cpp
├── DosLayerListDialog.h
├── DosListBoxDialog.cpp
├── DosListBoxDialog.h
├── DosListBoxEx.cpp
├── DosListBoxEx.h
├── DosLoadLibrary.cpp
├── DosLoadLibrary.h
├── DosMath.cpp
├── DosMath.h
├── DosMemDC.cpp
├── DosMemDC.h
├── DosMessageBox.cpp
├── DosMessageBox.h
├── DosMessageDialog.cpp
├── DosMessageDialog.h
├── DosMultiListDialog.cpp
├── DosMultiListDialog.h
├── DosOrderListDialog.cpp
├── DosOrderListDialog.h
├── DosPathMonitor.cpp
├── DosPathMonitor.h
├── DosPathString.cpp
├── DosPathString.h
├── DosPopupMenu.cpp
├── DosPopupMenu.h
├── DosProcessHelpers.cpp
├── DosProcessHelpers.h
├── DosProgressCtrl.cpp
├── DosProgressCtrl.h
├── DosPropList.cpp
├── DosPropList.h
├── DosPropListDialog.cpp
├── DosPropListDialog.h
├── DosReadDir.cpp
├── DosReadDir.h
├── DosRegExp.cpp
├── DosRegExp.h
├── DosRelativePaths.cpp
├── DosRelativePaths.h
├── DosScreenImage.cpp
├── DosScreenImage.h
├── DosScreenSelectionDialog.cpp
├── DosScreenSelectionDialog.h
├── DosSplash.cpp
├── DosSplash.h
├── DosStaticLink.cpp
├── DosStaticLink.h
├── DosString.cpp
├── DosString.h
├── DosStringArray.cpp
├── DosStringArray.h
├── DosUnicodeTextFile.cpp
├── DosUnicodeTextFile.h
├── DosVersionInfo.cpp
├── DosVersionInfo.h
├── Res
├── buddy.bmp
└── doslib.ico
├── StdAfx.cpp
├── StdAfx.h
├── ToasterWnd.cpp
├── ToasterWnd.h
├── atlrx.h
├── func_autocad.cpp
├── func_config.cpp
├── func_crc.cpp
├── func_dialogs.cpp
├── func_drives.cpp
├── func_encrypt.cpp
├── func_files.cpp
├── func_folders.cpp
├── func_getfiles.cpp
├── func_math.cpp
├── func_modeless.cpp
├── func_paths.cpp
├── func_printers.cpp
├── func_processes.cpp
├── func_strings.cpp
├── func_systems.cpp
├── func_tcpip.cpp
├── resource.h
├── webbrowser2.cpp
└── webbrowser2.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 1992-2024, Robert McNeel & Associates.
4 |
5 | DOSLib is a trademark of Robert McNeel & Associates.
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DOSLib: LISP Library for CAD Applications
2 |
3 |
4 |
5 | This repository contains the source code to DOSLib, a library of LISP-callable functions that provide functionality not available in CAD-base LISP interpreters, such as those included with AutoCAD, BricsCAD and ZWCAD.
6 |
7 | ## Prerequisites
8 |
9 | The following tools are required to build DOSLib:
10 |
11 | - [Microsoft Visual Studio 2022](https://visualstudio.microsoft.com/)
12 | - [ObjectARX SDK for AutoCAD](https://www.autodesk.com/developer-network/platform-technologies/autocad/objectarx-license-download)
13 | - [BRX SDK for BricsCAD](https://www.bricsys.com/en-eu/applications/developers/)
14 | - [ZRX SDK for ZWCAD](https://www.zwsoft.com/support/zwcad-devdoc/) (Requires Visual Studio 2017*)
15 |
16 | When installing Visual Studio 2022, make sure to install the Visual Studio 2019 (v142) and Visual Studio 2017 (v141) C++ x64/x86 build tools and libraries, including ATL and MFC.
17 |
18 | Note, to build DOSLib for version of AutoCAD, BricsCAD and/or ZWCAD earlier than what is listed above may also require an earlier version of Visual Studio. Check the documentation that comes with each of these SDK for their Visual Studio requirement.
19 |
20 | The DOSLib build solution looks for ObjectARX, BRXSDK and ZRXSDK installations in this folder structure:
21 |
22 | ```
23 | \acad
24 | \arx
25 | \23 - ObjectARX for AutoCAD 2019
26 | \24 - ObjectARX for AutoCAD 2021
27 | \25 - ObjectARX for AutoCAD 2025
28 | \brx
29 | \21 - BRXSDK for BricsCAD Pro V21
30 | \22 - BRXSDK for BricsCAD Pro V22
31 | \23 - BRXSDK for BricsCAD Pro V23
32 | \24 - BRXSDK for BricsCAD Pro V24
33 | \25 - BRXSDK for BricsCAD Pro V25
34 | \zrx
35 | \21 - ZRXSDK for ZWCAD 2021/2022/2023/2024
36 | \25 - ZRXSDK for ZWCAD 2025
37 | ```
38 |
39 | ### Compiling
40 |
41 | 1. Clone the repository. At a command prompt, enter the following command:
42 | ```
43 | git clone https://github.com/dalefugier/doslib
44 | ```
45 | 2. Open the `DOSLib.sln` solution file, found in the `doslib\source` folder, in Visual Studio.
46 | 3. Select either the `Release_ARX24`, `Release_BRX25` or `Release_ZRX25` solution configuration.
47 | 4. Press F7, or click *Build > Build Solution* to build the solution.
48 |
49 | Note, you can target DOSLib for other versions of AutoCAD, BricsCAD or ZWCAD as long as:
50 |
51 | 1. The correct ObjectARX, BRXSDK or ZRXSDK is installed in above mentioned location.
52 | 2. The correct Visual Studio platform toolset is installed.
53 |
54 | ### More Information
55 |
56 | [DOSLib home page](https://wiki.mcneel.com/doslib/home)
57 |
58 | ### License
59 | Code licensed under the [MIT License](https://github.com/dalefugier/DOSLib/blob/master/LICENSE).
60 |
--------------------------------------------------------------------------------
/make/clean__doslib_all.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | call make_doslib.bat Debug_ARX19 Win32 clean %1 %2 %3 %4 %5 %6
4 | call make_doslib.bat Release_ARX19 Win32 clean %1 %2 %3 %4 %5 %6
5 | call make_doslib.bat Debug_ARX19 x64 clean %1 %2 %3 %4 %5 %6
6 | call make_doslib.bat Release_ARX19 x64 clean %1 %2 %3 %4 %5 %6
7 |
8 | call make_doslib.bat Debug_ARX20 Win32 clean %1 %2 %3 %4 %5 %6
9 | call make_doslib.bat Release_ARX20 Win32 clean %1 %2 %3 %4 %5 %6
10 | call make_doslib.bat Debug_ARX20 x64 clean %1 %2 %3 %4 %5 %6
11 | call make_doslib.bat Release_ARX20 x64 clean %1 %2 %3 %4 %5 %6
12 |
13 | call make_doslib.bat Debug_ARX21 Win32 clean %1 %2 %3 %4 %5 %6
14 | call make_doslib.bat Release_ARX21 Win32 clean %1 %2 %3 %4 %5 %6
15 | call make_doslib.bat Debug_ARX21 x64 clean %1 %2 %3 %4 %5 %6
16 | call make_doslib.bat Release_ARX21 x64 clean %1 %2 %3 %4 %5 %6
17 |
18 | call make_doslib.bat Debug_ARX22 Win32 clean %1 %2 %3 %4 %5 %6
19 | call make_doslib.bat Release_ARX22 Win32 clean %1 %2 %3 %4 %5 %6
20 | call make_doslib.bat Debug_ARX22 x64 clean %1 %2 %3 %4 %5 %6
21 | call make_doslib.bat Release_ARX22 x64 clean %1 %2 %3 %4 %5 %6
22 |
23 | call make_doslib.bat Debug_ARX23 Win32 clean %1 %2 %3 %4 %5 %6
24 | call make_doslib.bat Release_ARX23 Win32 clean %1 %2 %3 %4 %5 %6
25 | call make_doslib.bat Debug_ARX23 x64 clean %1 %2 %3 %4 %5 %6
26 | call make_doslib.bat Release_ARX23 x64 clean %1 %2 %3 %4 %5 %6
27 |
28 | call make_doslib.bat Debug_BRX13 Win32 clean %1 %2 %3 %4 %5 %6
29 | call make_doslib.bat Release_BRX13 Win32 clean %1 %2 %3 %4 %5 %6
30 | call make_doslib.bat Debug_BRX13 x64 clean %1 %2 %3 %4 %5 %6
31 | call make_doslib.bat Release_BRX13 x64 clean %1 %2 %3 %4 %5 %6
32 |
33 | call make_doslib.bat Debug_BRX14 Win32 clean %1 %2 %3 %4 %5 %6
34 | call make_doslib.bat Release_BRX14 Win32 clean %1 %2 %3 %4 %5 %6
35 | call make_doslib.bat Debug_BRX14 x64 clean %1 %2 %3 %4 %5 %6
36 | call make_doslib.bat Release_BRX14 x64 clean %1 %2 %3 %4 %5 %6
37 |
38 | call make_doslib.bat Debug_BRX15 Win32 clean %1 %2 %3 %4 %5 %6
39 | call make_doslib.bat Release_BRX15 Win32 clean %1 %2 %3 %4 %5 %6
40 | call make_doslib.bat Debug_BRX15 x64 clean %1 %2 %3 %4 %5 %6
41 | call make_doslib.bat Release_BRX15 x64 clean %1 %2 %3 %4 %5 %6
42 |
43 | call make_doslib.bat Debug_BRX16 Win32 clean %1 %2 %3 %4 %5 %6
44 | call make_doslib.bat Release_BRX16 Win32 clean %1 %2 %3 %4 %5 %6
45 | call make_doslib.bat Debug_BRX16 x64 clean %1 %2 %3 %4 %5 %6
46 | call make_doslib.bat Release_BRX16 x64 clean %1 %2 %3 %4 %5 %6
47 |
48 | call make_doslib.bat Debug_BRX17 Win32 clean %1 %2 %3 %4 %5 %6
49 | call make_doslib.bat Release_BRX17 Win32 clean %1 %2 %3 %4 %5 %6
50 | call make_doslib.bat Debug_BRX17 x64 clean %1 %2 %3 %4 %5 %6
51 | call make_doslib.bat Release_BRX17 x64 clean %1 %2 %3 %4 %5 %6
52 |
53 | call make_doslib.bat Debug_BRX18 Win32 clean %1 %2 %3 %4 %5 %6
54 | call make_doslib.bat Release_BRX18 Win32 clean %1 %2 %3 %4 %5 %6
55 | call make_doslib.bat Debug_BRX18 x64 clean %1 %2 %3 %4 %5 %6
56 | call make_doslib.bat Release_BRX18 x64 clean %1 %2 %3 %4 %5 %6
57 |
58 | call make_doslib.bat Debug_BRX19 Win32 clean %1 %2 %3 %4 %5 %6
59 | call make_doslib.bat Release_BRX19 Win32 clean %1 %2 %3 %4 %5 %6
60 | call make_doslib.bat Debug_BRX19 x64 clean %1 %2 %3 %4 %5 %6
61 | call make_doslib.bat Release_BRX19 x64 clean %1 %2 %3 %4 %5 %6
62 |
63 | call make_doslib.bat Debug_BRX20 Win32 clean %1 %2 %3 %4 %5 %6
64 | call make_doslib.bat Release_BRX20 Win32 clean %1 %2 %3 %4 %5 %6
65 | call make_doslib.bat Debug_BRX20 x64 clean %1 %2 %3 %4 %5 %6
66 | call make_doslib.bat Release_BRX20 x64 clean %1 %2 %3 %4 %5 %6
67 |
68 | call make_doslib.bat Debug_ZRX20 Win32 clean %1 %2 %3 %4 %5 %6
69 | call make_doslib.bat Release_ZRX20 Win32 clean %1 %2 %3 %4 %5 %6
70 | call make_doslib.bat Debug_ZRX20 x64 clean %1 %2 %3 %4 %5 %6
71 | call make_doslib.bat Release_ZRX20 x64 clean %1 %2 %3 %4 %5 %6
72 |
73 | call make_doslib.bat Debug_ZRX21 Win32 clean %1 %2 %3 %4 %5 %6
74 | call make_doslib.bat Release_ZRX21 Win32 clean %1 %2 %3 %4 %5 %6
75 | call make_doslib.bat Debug_ZRX21 x64 clean %1 %2 %3 %4 %5 %6
76 | call make_doslib.bat Release_ZRX21 x64 clean %1 %2 %3 %4 %5 %6
77 |
78 | call make_doslib.bat Debug_ZRX25 Win32 clean %1 %2 %3 %4 %5 %6
79 | call make_doslib.bat Release_ZRX25 Win32 clean %1 %2 %3 %4 %5 %6
80 | call make_doslib.bat Debug_ZRX25 x64 clean %1 %2 %3 %4 %5 %6
81 | call make_doslib.bat Release_ZRX25 x64 clean %1 %2 %3 %4 %5 %6
82 |
83 | del /F /Q ..\bin\*.*
84 |
--------------------------------------------------------------------------------
/make/make__doslib_Debug_all.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | call make_doslib.bat Debug_ARX19 Win32 rebuild %1 %2 %3 %4 %5 %6
4 | call make_doslib.bat Debug_ARX19 x64 rebuild %1 %2 %3 %4 %5 %6
5 |
6 | call make_doslib.bat Debug_ARX20 Win32 rebuild %1 %2 %3 %4 %5 %6
7 | call make_doslib.bat Debug_ARX20 x64 rebuild %1 %2 %3 %4 %5 %6
8 |
9 | call make_doslib.bat Debug_ARX21 Win32 rebuild %1 %2 %3 %4 %5 %6
10 | call make_doslib.bat Debug_ARX21 x64 rebuild %1 %2 %3 %4 %5 %6
11 |
12 | call make_doslib.bat Debug_ARX22 Win32 rebuild %1 %2 %3 %4 %5 %6
13 | call make_doslib.bat Debug_ARX22 x64 rebuild %1 %2 %3 %4 %5 %6
14 |
15 | call make_doslib.bat Debug_ARX23 Win32 rebuild %1 %2 %3 %4 %5 %6
16 | call make_doslib.bat Debug_ARX23 x64 rebuild %1 %2 %3 %4 %5 %6
17 |
18 | call make_doslib.bat Debug_BRX13 Win32 rebuild %1 %2 %3 %4 %5 %6
19 | call make_doslib.bat Debug_BRX13 x64 rebuild %1 %2 %3 %4 %5 %6
20 |
21 | call make_doslib.bat Debug_BRX14 Win32 rebuild %1 %2 %3 %4 %5 %6
22 | call make_doslib.bat Debug_BRX14 x64 rebuild %1 %2 %3 %4 %5 %6
23 |
24 | call make_doslib.bat Debug_BRX15 Win32 rebuild %1 %2 %3 %4 %5 %6
25 | call make_doslib.bat Debug_BRX15 x64 rebuild %1 %2 %3 %4 %5 %6
26 |
27 | call make_doslib.bat Debug_BRX16 Win32 rebuild %1 %2 %3 %4 %5 %6
28 | call make_doslib.bat Debug_BRX16 x64 rebuild %1 %2 %3 %4 %5 %6
29 |
30 | call make_doslib.bat Debug_BRX17 Win32 rebuild %1 %2 %3 %4 %5 %6
31 | call make_doslib.bat Debug_BRX17 x64 rebuild %1 %2 %3 %4 %5 %6
32 |
33 | call make_doslib.bat Debug_BRX18 Win32 rebuild %1 %2 %3 %4 %5 %6
34 | call make_doslib.bat Debug_BRX18 x64 rebuild %1 %2 %3 %4 %5 %6
35 |
36 | call make_doslib.bat Debug_BRX19 Win32 rebuild %1 %2 %3 %4 %5 %6
37 | call make_doslib.bat Debug_BRX19 x64 rebuild %1 %2 %3 %4 %5 %6
38 |
39 | call make_doslib.bat Debug_BRX20 Win32 rebuild %1 %2 %3 %4 %5 %6
40 | call make_doslib.bat Debug_BRX20 x64 rebuild %1 %2 %3 %4 %5 %6
41 |
42 | call make_doslib.bat Debug_ZRX20 Win32 rebuild %1 %2 %3 %4 %5 %6
43 | call make_doslib.bat Debug_ZRX20 x64 rebuild %1 %2 %3 %4 %5 %6
44 |
45 | call make_doslib.bat Debug_ZRX21 Win32 rebuild %1 %2 %3 %4 %5 %6
46 | call make_doslib.bat Debug_ZRX21 x64 rebuild %1 %2 %3 %4 %5 %6
47 |
48 | call make_doslib.bat Debug_ZRX25 x64 rebuild %1 %2 %3 %4 %5 %6
49 |
--------------------------------------------------------------------------------
/make/make__doslib_Release_all.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | call make_doslib.bat Release_ARX19 Win32 rebuild %1 %2 %3 %4 %5 %6
4 | call make_doslib.bat Release_ARX19 x64 rebuild %1 %2 %3 %4 %5 %6
5 |
6 | call make_doslib.bat Release_ARX20 Win32 rebuild %1 %2 %3 %4 %5 %6
7 | call make_doslib.bat Release_ARX20 x64 rebuild %1 %2 %3 %4 %5 %6
8 |
9 | call make_doslib.bat Release_ARX21 Win32 rebuild %1 %2 %3 %4 %5 %6
10 | call make_doslib.bat Release_ARX21 x64 rebuild %1 %2 %3 %4 %5 %6
11 |
12 | call make_doslib.bat Release_ARX22 Win32 rebuild %1 %2 %3 %4 %5 %6
13 | call make_doslib.bat Release_ARX22 x64 rebuild %1 %2 %3 %4 %5 %6
14 |
15 | call make_doslib.bat Release_ARX23 Win32 rebuild %1 %2 %3 %4 %5 %6
16 | call make_doslib.bat Release_ARX23 x64 rebuild %1 %2 %3 %4 %5 %6
17 |
18 | call make_doslib.bat Release_BRX13 Win32 rebuild %1 %2 %3 %4 %5 %6
19 | call make_doslib.bat Release_BRX13 x64 rebuild %1 %2 %3 %4 %5 %6
20 |
21 | call make_doslib.bat Release_BRX14 Win32 rebuild %1 %2 %3 %4 %5 %6
22 | call make_doslib.bat Release_BRX14 x64 rebuild %1 %2 %3 %4 %5 %6
23 |
24 | call make_doslib.bat Release_BRX15 Win32 rebuild %1 %2 %3 %4 %5 %6
25 | call make_doslib.bat Release_BRX15 x64 rebuild %1 %2 %3 %4 %5 %6
26 |
27 | call make_doslib.bat Release_BRX16 Win32 rebuild %1 %2 %3 %4 %5 %6
28 | call make_doslib.bat Release_BRX16 x64 rebuild %1 %2 %3 %4 %5 %6
29 |
30 | call make_doslib.bat Release_BRX17 Win32 rebuild %1 %2 %3 %4 %5 %6
31 | call make_doslib.bat Release_BRX17 x64 rebuild %1 %2 %3 %4 %5 %6
32 |
33 | call make_doslib.bat Release_BRX18 Win32 rebuild %1 %2 %3 %4 %5 %6
34 | call make_doslib.bat Release_BRX18 x64 rebuild %1 %2 %3 %4 %5 %6
35 |
36 | call make_doslib.bat Release_BRX19 Win32 rebuild %1 %2 %3 %4 %5 %6
37 | call make_doslib.bat Release_BRX19 x64 rebuild %1 %2 %3 %4 %5 %6
38 |
39 | call make_doslib.bat Release_BRX20 Win32 rebuild %1 %2 %3 %4 %5 %6
40 | call make_doslib.bat Release_BRX20 x64 rebuild %1 %2 %3 %4 %5 %6
41 |
42 | call make_doslib.bat Release_ZRX20 Win32 rebuild %1 %2 %3 %4 %5 %6
43 | call make_doslib.bat Release_ZRX20 x64 rebuild %1 %2 %3 %4 %5 %6
44 |
45 | call make_doslib.bat Release_ZRX21 Win32 rebuild %1 %2 %3 %4 %5 %6
46 | call make_doslib.bat Release_ZRX21 x64 rebuild %1 %2 %3 %4 %5 %6
47 |
48 | call make_doslib.bat Release_ZRX25 x64 rebuild %1 %2 %3 %4 %5 %6
49 |
--------------------------------------------------------------------------------
/make/make_doslib.bat:
--------------------------------------------------------------------------------
1 | set configuration=%1
2 | set platform=%2
3 | set buildconfig=%configuration%"|"%platform%
4 | set build_option=%3
5 | set msdev="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
6 | set slnfile=make_doslib.sln
7 | set batchdir=.
8 | set slnfullpath=%batchdir%\%slnfile%
9 | set logfile=%batchdir%\LOG_DETAILS_%build_option%_%configuration%_%platform%.txt
10 | set summaryfile=%batchdir%\LOG_%build_option%.txt
11 | set log=/out %logfile%
12 |
13 | cd %batchdir%
14 | if exist %logfile% del /F %logfile%
15 |
16 | echo %build_option% %buildconfig%
17 | %msdev% %slnfullpath% /%build_option% "%configuration%|%platform%" /project DOSLib %log%
18 | if ERRORLEVEL 1 goto build_summary
19 |
20 | :build_summary
21 |
22 | echo. >> %summaryfile%
23 | echo %buildconfig% >> %summaryfile%
24 | type %logfile% | find "succeeded," >> %summaryfile%
25 | type %logfile% | find "error(s)" >> %summaryfile%
26 | type %logfile% | find "errors" >> %summaryfile%
27 | type %logfile% | find " error" >> %summaryfile%
28 | type %logfile% | find " warning" >> %summaryfile%
29 |
30 | if exist %logfile% del /F %logfile%
31 |
--------------------------------------------------------------------------------
/resources/doslib.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dalefugier/DOSLib/bba37b4b851472f61f5554696551bb7a1a5a1472/resources/doslib.png
--------------------------------------------------------------------------------
/source/ArxVer.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // ArxVer.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #if defined(ARX19)
15 | #define _ARX_VER 19
16 | #elif defined(ARX20)
17 | #define _ARX_VER 20
18 | #elif defined(ARX21)
19 | #define _ARX_VER 21
20 | #elif defined(ARX22)
21 | #define _ARX_VER 22
22 | #elif defined(ARX23)
23 | #define _ARX_VER 23
24 | #elif defined(ARX24)
25 | #define _ARX_VER 24
26 | #elif defined(ARX25)
27 | #define _ARX_VER 25
28 | #else
29 | #define _ARX_VER 0
30 | #endif
31 |
32 | #if defined(BRX13)
33 | #define _BRX_VER 13
34 | #elif defined(BRX14)
35 | #define _BRX_VER 14
36 | #elif defined(BRX15)
37 | #define _BRX_VER 15
38 | #elif defined(BRX16)
39 | #define _BRX_VER 16
40 | #elif defined(BRX17)
41 | #define _BRX_VER 17
42 | #elif defined(BRX18)
43 | #define _BRX_VER 18
44 | #elif defined(BRX19)
45 | #define _BRX_VER 19
46 | #elif defined(BRX20)
47 | #define _BRX_VER 20
48 | #elif defined(BRX21)
49 | #define _BRX_VER 21
50 | #elif defined(BRX22)
51 | #define _BRX_VER 22
52 | #elif defined(BRX23)
53 | #define _BRX_VER 23
54 | #elif defined(BRX24)
55 | #define _BRX_VER 24
56 | #elif defined(BRX25)
57 | #define _BRX_VER 25
58 | #else
59 | #define _BRX_VER 0
60 | #endif
61 |
62 | #if defined(ZRX20)
63 | #define _ZRX_VER 20
64 | #elif defined(ZRX21)
65 | #define _ZRX_VER 21
66 | #elif defined(ZRX25)
67 | #define _ZRX_VER 25
68 | #else
69 | #define _ZRX_VER 0
70 | #endif
--------------------------------------------------------------------------------
/source/DOSLib.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DOSLib.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include
14 |
15 | // Define the sole extension module object.
16 | AC_IMPLEMENT_EXTENSION_MODULE(DOSLibDLL)
17 |
18 | // Please do not remove the 3 following lines. These are here to make .NET MFC Wizards
19 | // running properly. The object will not compile but is require by .NET to recognize
20 | // this project as being an MFC project
21 | #ifdef NEVER
22 | AFX_EXTENSION_MODULE DOSLibExtDLL = { NULL, NULL };
23 | #endif
24 |
25 | // Now you can use the CAcModuleResourceOverride class in
26 | // your application to switch to the correct resource instance.
27 | // Please see the ObjectARX Documentation for more details
28 |
29 | // DLL Entry Point
30 | extern "C"
31 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
32 | {
33 | // Remove this if you use lpReserved
34 | UNREFERENCED_PARAMETER(lpReserved);
35 |
36 | if (dwReason == DLL_PROCESS_ATTACH)
37 | {
38 | _hdllInstance = hInstance;
39 | DOSLibDLL.AttachInstance(hInstance);
40 | InitAcUiDLL();
41 | ::CoInitialize(0);
42 | }
43 | else if (dwReason == DLL_PROCESS_DETACH)
44 | {
45 | ::CoUninitialize();
46 | DOSLibDLL.DetachInstance();
47 | }
48 |
49 | return TRUE;
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/source/DOSLib.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.3.32825.248
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DOSLib", "DOSLib.vcxproj", "{745E02ED-EAAC-41FC-80D7-65BD3C1EB304}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug_ARX23|x64 = Debug_ARX23|x64
11 | Debug_ARX24|x64 = Debug_ARX24|x64
12 | Debug_ARX25|x64 = Debug_ARX25|x64
13 | Debug_BRX21|x64 = Debug_BRX21|x64
14 | Debug_BRX22|x64 = Debug_BRX22|x64
15 | Debug_BRX23|x64 = Debug_BRX23|x64
16 | Debug_BRX24|x64 = Debug_BRX24|x64
17 | Debug_BRX25|x64 = Debug_BRX25|x64
18 | Debug_ZRX21|x64 = Debug_ZRX21|x64
19 | Debug_ZRX25|x64 = Debug_ZRX25|x64
20 | Release_ARX23|x64 = Release_ARX23|x64
21 | Release_ARX24|x64 = Release_ARX24|x64
22 | Release_ARX25|x64 = Release_ARX25|x64
23 | Release_BRX21|x64 = Release_BRX21|x64
24 | Release_BRX22|x64 = Release_BRX22|x64
25 | Release_BRX23|x64 = Release_BRX23|x64
26 | Release_BRX24|x64 = Release_BRX24|x64
27 | Release_BRX25|x64 = Release_BRX25|x64
28 | Release_ZRX21|x64 = Release_ZRX21|x64
29 | Release_ZRX25|x64 = Release_ZRX25|x64
30 | EndGlobalSection
31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
32 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ARX23|x64.ActiveCfg = Debug_ARX23|x64
33 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ARX23|x64.Build.0 = Debug_ARX23|x64
34 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ARX24|x64.ActiveCfg = Debug_ARX24|x64
35 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ARX24|x64.Build.0 = Debug_ARX24|x64
36 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ARX25|x64.ActiveCfg = Debug_ARX25|x64
37 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ARX25|x64.Build.0 = Debug_ARX25|x64
38 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX21|x64.ActiveCfg = Debug_BRX21|x64
39 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX21|x64.Build.0 = Debug_BRX21|x64
40 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX22|x64.ActiveCfg = Debug_BRX22|x64
41 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX22|x64.Build.0 = Debug_BRX22|x64
42 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX23|x64.ActiveCfg = Debug_BRX23|x64
43 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX23|x64.Build.0 = Debug_BRX23|x64
44 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX24|x64.ActiveCfg = Debug_BRX24|x64
45 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX24|x64.Build.0 = Debug_BRX24|x64
46 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX25|x64.ActiveCfg = Debug_BRX25|x64
47 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_BRX25|x64.Build.0 = Debug_BRX25|x64
48 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ZRX21|x64.ActiveCfg = Debug_ZRX21|x64
49 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ZRX21|x64.Build.0 = Debug_ZRX21|x64
50 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ZRX25|x64.ActiveCfg = Debug_ZRX25|x64
51 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Debug_ZRX25|x64.Build.0 = Debug_ZRX25|x64
52 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ARX23|x64.ActiveCfg = Release_ARX23|x64
53 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ARX23|x64.Build.0 = Release_ARX23|x64
54 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ARX24|x64.ActiveCfg = Release_ARX24|x64
55 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ARX24|x64.Build.0 = Release_ARX24|x64
56 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ARX25|x64.ActiveCfg = Release_ARX25|x64
57 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ARX25|x64.Build.0 = Release_ARX25|x64
58 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX21|x64.ActiveCfg = Release_BRX21|x64
59 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX21|x64.Build.0 = Release_BRX21|x64
60 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX22|x64.ActiveCfg = Release_BRX22|x64
61 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX22|x64.Build.0 = Release_BRX22|x64
62 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX23|x64.ActiveCfg = Release_BRX23|x64
63 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX23|x64.Build.0 = Release_BRX23|x64
64 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX24|x64.ActiveCfg = Release_BRX24|x64
65 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX24|x64.Build.0 = Release_BRX24|x64
66 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX25|x64.ActiveCfg = Release_BRX25|x64
67 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_BRX25|x64.Build.0 = Release_BRX25|x64
68 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ZRX21|x64.ActiveCfg = Release_ZRX21|x64
69 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ZRX21|x64.Build.0 = Release_ZRX21|x64
70 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ZRX25|x64.ActiveCfg = Release_ZRX25|x64
71 | {745E02ED-EAAC-41FC-80D7-65BD3C1EB304}.Release_ZRX25|x64.Build.0 = Release_ZRX25|x64
72 | EndGlobalSection
73 | GlobalSection(SolutionProperties) = preSolution
74 | HideSolutionNode = FALSE
75 | EndGlobalSection
76 | GlobalSection(ExtensibilityGlobals) = postSolution
77 | SolutionGuid = {FD4F027D-66E1-4342-8B62-491623530578}
78 | EndGlobalSection
79 | EndGlobal
80 |
--------------------------------------------------------------------------------
/source/DosAboutDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosAboutDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosAboutDialog.h"
14 | #include "DOSLibApp.h"
15 |
16 | CDosAboutDialog::CDosAboutDialog(CWnd* pParent)
17 | : CAcUiDialog(CDosAboutDialog::IDD, pParent)
18 | {
19 | }
20 |
21 | void CDosAboutDialog::DoDataExchange(CDataExchange* pDX)
22 | {
23 | CAcUiDialog::DoDataExchange(pDX);
24 | DDX_Control(pDX, IDC_DOSLIBICON, m_icon);
25 | DDX_Control(pDX, IDC_COPYRIGHT, m_copyright);
26 | DDX_Control(pDX, IDC_PRODUCT, m_product);
27 | DDX_Control(pDX, IDC_WEB, m_web);
28 | }
29 |
30 | BEGIN_MESSAGE_MAP(CDosAboutDialog, CAcUiDialog)
31 | ON_WM_NCHITTEST()
32 | END_MESSAGE_MAP()
33 |
34 | BOOL CDosAboutDialog::OnInitDialog()
35 | {
36 | SetDialogName(L"DOSLib:About");
37 | CAcUiDialog::OnInitDialog();
38 | LockDialogWidth();
39 | LockDialogHeight();
40 |
41 | CString str;
42 | str.Format(L"%s Version %s", DOSLibApp().AppName(), DOSLibApp().AppVersion());
43 | m_product.SetWindowText(str);
44 |
45 | m_copyright.SetWindowText(DOSLibApp().AppCopyright());
46 |
47 | m_web.SetWindowText(DOSLibApp().AppInternet());
48 | m_icon.m_link = DOSLibApp().AppInternet();
49 | m_web.m_link = DOSLibApp().AppInternet();
50 |
51 | return TRUE;
52 | }
53 |
54 | LRESULT CDosAboutDialog::OnNcHitTest(CPoint point)
55 | {
56 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
57 | if (hit == HTCLIENT)
58 | return HTCAPTION;
59 | return hit;
60 | }
61 |
--------------------------------------------------------------------------------
/source/DosAboutDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosAboutDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosStaticLink.h"
15 |
16 | class CDosAboutDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosAboutDialog(CWnd* pParent);
20 |
21 | enum { IDD = IDD_ABOUTBOX };
22 | CDosStaticLink m_icon;
23 | CStatic m_copyright;
24 | CStatic m_product;
25 | CDosStaticLink m_web;
26 |
27 | protected:
28 | virtual void DoDataExchange(CDataExchange* pDX);
29 |
30 | protected:
31 | virtual BOOL OnInitDialog();
32 | afx_msg LRESULT OnNcHitTest(CPoint point);
33 | DECLARE_MESSAGE_MAP()
34 | };
35 |
--------------------------------------------------------------------------------
/source/DosCheckListDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosCheckListDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosCheckListDialog.h"
14 | #include "DosGetStringDialog.h"
15 |
16 | CDosCheckListDialog::CDosCheckListDialog(CWnd* pParent)
17 | : CAcUiDialog(CDosCheckListDialog::IDD, pParent)
18 | {
19 | m_Val = L"";
20 | m_bShowAddButton = false;
21 | }
22 |
23 | void CDosCheckListDialog::DoDataExchange(CDataExchange* pDX)
24 | {
25 | CAcUiDialog::DoDataExchange(pDX);
26 | DDX_Control(pDX, IDC_LIST, m_List);
27 | DDX_LBString(pDX, IDC_LIST, m_Val);
28 | }
29 |
30 | BEGIN_MESSAGE_MAP(CDosCheckListDialog, CAcUiDialog)
31 | ON_BN_CLICKED(IDC_SELECT, OnSelect)
32 | ON_BN_CLICKED(IDC_CLEAR, OnClear)
33 | ON_WM_NCHITTEST()
34 | ON_BN_CLICKED(IDC_ADD, &CDosCheckListDialog::OnBnClickedAdd)
35 | END_MESSAGE_MAP()
36 |
37 | BOOL CDosCheckListDialog::OnInitDialog()
38 | {
39 | SetDialogName(L"DOSLib:CheckList");
40 |
41 | CAcUiDialog::OnInitDialog();
42 |
43 | StretchControlX(IDC_PROMPT, 100);
44 | StretchControlXY(IDC_LIST, 100, 100);
45 | MoveControlX(IDOK, 100);
46 | MoveControlX(IDCANCEL, 100);
47 | MoveControlX(IDC_SELECT, 100);
48 | MoveControlX(IDC_CLEAR, 100);
49 | MoveControlX(IDC_ADD, 100);
50 |
51 | SetWindowText(m_Title);
52 | SetDlgItemText(IDC_PROMPT, m_Prompt);
53 |
54 | if (m_bShowAddButton)
55 | GetDlgItem(IDC_ADD)->ShowWindow(SW_SHOW);
56 |
57 | int i;
58 | for (i = 0; i < m_StrArray.GetCount(); i++)
59 | {
60 | m_List.AddString(m_StrArray[i]);
61 | m_List.SetCheck(m_List.GetCount() - 1, m_nArray[i]);
62 | }
63 | m_List.SetCurSel(0);
64 |
65 | return TRUE;
66 | }
67 |
68 | void CDosCheckListDialog::OnOK()
69 | {
70 | int i;
71 | for (i = 0; i < m_List.GetCount(); i++)
72 | {
73 | if (m_List.GetCheck(i) == TRUE)
74 | m_nArray.SetAt(i, 1);
75 | else
76 | m_nArray.SetAt(i, 0);
77 | }
78 | CAcUiDialog::OnOK();
79 | }
80 |
81 | void CDosCheckListDialog::OnSelect()
82 | {
83 | int i;
84 | for (i = 0; i < m_List.GetCount(); i++)
85 | m_List.SetCheck(i, 1);
86 | }
87 |
88 | void CDosCheckListDialog::OnClear()
89 | {
90 | int i;
91 | for (i = 0; i < m_List.GetCount(); i++)
92 | m_List.SetCheck(i, 0);
93 | }
94 |
95 | LRESULT CDosCheckListDialog::OnNcHitTest(CPoint point)
96 | {
97 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
98 | if (hit == HTCLIENT)
99 | return HTCAPTION;
100 | return hit;
101 | }
102 |
103 | void CDosCheckListDialog::OnBnClickedAdd()
104 | {
105 | CDosGetStringDialog dlg(acedGetAcadFrame());
106 | dlg.m_Title = m_Title;
107 | dlg.m_Prompt = L"Item to add to the list:";
108 |
109 | if (dlg.DoModal() == IDOK)
110 | {
111 | CString str = dlg.m_String;
112 | str.TrimLeft();
113 | str.TrimRight();
114 |
115 | int i;
116 | for (i = 0; i < m_List.GetCount(); i++)
117 | {
118 | if (str.CompareNoCase(m_StrArray[i]) == 0)
119 | {
120 | MessageBox(L"The specified item already exists.", DOS_PlatformName(), MB_ICONEXCLAMATION | MB_OK);
121 | return;
122 | }
123 | }
124 |
125 | m_StrArray.Add(dlg.m_String);
126 | m_List.AddString(dlg.m_String);
127 | m_nArray.Add(1);
128 | m_List.SetCheck(m_List.GetCount() - 1, 1);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/source/DosCheckListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosCheckListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosCheckListDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosCheckListDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_DOSCHECKLIST };
20 | CCheckListBox m_List;
21 | CString m_Val;
22 | CString m_Title;
23 | CString m_Prompt;
24 | CStringArray m_StrArray;
25 | CWordArray m_nArray;
26 | bool m_bShowAddButton;
27 |
28 | protected:
29 | virtual void DoDataExchange(CDataExchange* pDX);
30 |
31 | protected:
32 | virtual BOOL OnInitDialog();
33 | virtual void OnOK();
34 | afx_msg void OnSelect();
35 | afx_msg void OnClear();
36 | afx_msg LRESULT OnNcHitTest(CPoint point);
37 | DECLARE_MESSAGE_MAP()
38 | public:
39 | afx_msg void OnBnClickedAdd();
40 | };
41 |
--------------------------------------------------------------------------------
/source/DosColorDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosColorDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "stdafx.h"
13 | #include "DosColorDialog.h"
14 |
15 | IMPLEMENT_DYNAMIC(CDosColorDialog, CColorDialog)
16 |
17 | CDosColorDialog::CDosColorDialog(COLORREF clrInit, DWORD dwFlags, CWnd* pParentWnd)
18 | : CColorDialog(clrInit, dwFlags, pParentWnd)
19 | {
20 | m_Title = L"Color";
21 | }
22 |
23 | BEGIN_MESSAGE_MAP(CDosColorDialog, CColorDialog)
24 | END_MESSAGE_MAP()
25 |
26 | BOOL CDosColorDialog::OnInitDialog()
27 | {
28 | CColorDialog::OnInitDialog();
29 | SetWindowText(m_Title);
30 | return TRUE;
31 | }
32 |
--------------------------------------------------------------------------------
/source/DosColorDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosColorDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosColorDialog : public CColorDialog
15 | {
16 | DECLARE_DYNAMIC(CDosColorDialog)
17 |
18 | public:
19 | CDosColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0, CWnd* pParentWnd = NULL);
20 | CString m_Title;
21 |
22 | protected:
23 | virtual BOOL OnInitDialog();
24 | DECLARE_MESSAGE_MAP()
25 | };
26 |
--------------------------------------------------------------------------------
/source/DosColorListBox.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosColorListBox.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosColorListBox.h"
14 |
15 | BEGIN_MESSAGE_MAP(CDosColorListBox, CListBox)
16 | END_MESSAGE_MAP()
17 |
18 | void CDosColorListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
19 | {
20 | // losing focus ?
21 | if (lpDrawItemStruct->itemID == -1)
22 | {
23 | DrawFocusRect(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem);
24 | return;
25 | }
26 |
27 | CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
28 |
29 | // Get color info from item data
30 | COLORREF clrNew = (COLORREF)(lpDrawItemStruct->itemData);
31 | COLORREF clrOld;
32 |
33 | // Is the item selected?
34 | if (lpDrawItemStruct->itemState & ODS_SELECTED)
35 | {
36 | clrOld = pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
37 | pDC->SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
38 | pDC->FillSolidRect(&lpDrawItemStruct->rcItem, GetSysColor(COLOR_HIGHLIGHT));
39 | }
40 |
41 | // The item is not selected
42 | else
43 | {
44 | clrOld = pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
45 | pDC->SetBkColor(GetSysColor(COLOR_WINDOW));
46 | pDC->FillSolidRect(&lpDrawItemStruct->rcItem, GetSysColor(COLOR_WINDOW));
47 | }
48 |
49 | // Does the item has focus?
50 | if ((lpDrawItemStruct->itemAction & ODA_FOCUS) && (lpDrawItemStruct->itemState & ODS_FOCUS))
51 | {
52 | pDC->DrawFocusRect(&lpDrawItemStruct->rcItem);
53 | }
54 |
55 | // Has the item lost focus?
56 | if ((lpDrawItemStruct->itemAction & ODA_FOCUS) && !(lpDrawItemStruct->itemState & ODS_FOCUS))
57 | {
58 | pDC->DrawFocusRect(&lpDrawItemStruct->rcItem);
59 | }
60 |
61 | // Is the item disabled?
62 | if (lpDrawItemStruct->itemState & ODS_DISABLED)
63 | {
64 | clrNew = GetSysColor(COLOR_GRAYTEXT);
65 | pDC->SetTextColor(clrNew);
66 | }
67 |
68 | int nBkMode = pDC->SetBkMode(TRANSPARENT);
69 |
70 | CRect rcBlock(lpDrawItemStruct->rcItem);
71 | CRect rcText(lpDrawItemStruct->rcItem);
72 |
73 | rcBlock.DeflateRect(2, 2);
74 | rcBlock.right = rcBlock.left + 25;
75 |
76 | rcText.left = rcBlock.right + 8;
77 |
78 | CString strText;
79 | GetText(lpDrawItemStruct->itemID, strText);
80 | pDC->DrawText(strText, -1, &rcText, DT_LEFT | DT_SINGLELINE | DT_VCENTER);
81 |
82 | CBrush brush;
83 | brush.CreateSolidBrush(clrNew);
84 |
85 | CBrush *pOldBrush = (CBrush*)pDC->SelectObject(&brush);
86 | CPen* pOldPen = NULL;
87 |
88 | if (lpDrawItemStruct->itemState & ODS_SELECTED)
89 | {
90 | pOldPen = (CPen*)pDC->SelectStockObject(WHITE_PEN);
91 | pDC->Rectangle(&rcBlock);
92 | rcBlock.DeflateRect(1, 1);
93 | pDC->SelectStockObject(BLACK_PEN);
94 | pDC->Rectangle(&rcBlock);
95 | }
96 | else
97 | {
98 | pOldPen = (CPen*)pDC->SelectStockObject(BLACK_PEN);
99 | rcBlock.DeflateRect(1, 1);
100 | pDC->Rectangle(&rcBlock);
101 | }
102 |
103 | pDC->SelectObject(pOldPen);
104 | pDC->SelectObject(pOldBrush);
105 | pDC->SetTextColor(clrOld);
106 | pDC->SetBkMode(nBkMode);
107 | }
108 |
109 | int CDosColorListBox::AddString(LPCTSTR lpszItem, COLORREF itemColor)
110 | {
111 | int nIndex = CListBox::AddString(lpszItem);
112 | if (nIndex >= 0)
113 | SetItemData(nIndex, itemColor);
114 | return nIndex;
115 | }
116 |
--------------------------------------------------------------------------------
/source/DosColorListBox.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosColorListBox.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosColorListBox : public CListBox
15 | {
16 | public:
17 | CDosColorListBox() {}
18 | virtual ~CDosColorListBox() {}
19 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
20 |
21 | int AddString(LPCTSTR lpszItem, COLORREF itemColor);
22 |
23 | protected:
24 | DECLARE_MESSAGE_MAP()
25 | };
26 |
--------------------------------------------------------------------------------
/source/DosComboListDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosComboListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosComboListDialog.h"
14 |
15 | CDosComboBox::CDosComboBox()
16 | : CComboBox()
17 | , m_pEdit(NULL)
18 | {
19 | }
20 |
21 | CDosComboBox::~CDosComboBox()
22 | {
23 | }
24 |
25 | BEGIN_MESSAGE_MAP(CDosComboBox, CComboBox)
26 | END_MESSAGE_MAP()
27 |
28 | void CDosComboBox::HandleCompletion()
29 | {
30 | if (m_pEdit == NULL)
31 | {
32 | m_pEdit = new CEdit();
33 | m_pEdit->SubclassWindow(GetDlgItem(1001)->GetSafeHwnd());
34 | }
35 |
36 | CString windowtext;
37 | m_pEdit->GetWindowText(windowtext);
38 |
39 | int start, end;
40 | m_pEdit->GetSel(start, end);
41 |
42 | int bestindex = -1;
43 | int bestfrom = INT_MAX;
44 | for (int x = 0; x < GetCount(); x++)
45 | {
46 | CString s;
47 | GetLBText(x, s);
48 |
49 | int from = s.Find(windowtext);
50 | if (from != -1 && from < bestfrom)
51 | {
52 | bestindex = x;
53 | bestfrom = from;
54 | }
55 | }
56 |
57 | if (bestindex != -1 && GetCurSel() != bestindex)
58 | {
59 | ShowDropDown(TRUE);
60 | SetCurSel(bestindex);
61 |
62 | m_pEdit->SetWindowText(windowtext);
63 | m_pEdit->SetSel(start, end);
64 | }
65 | }
66 |
67 | BOOL CDosComboBox::OnCommand(WPARAM wParam, LPARAM lParam)
68 | {
69 | if (HIWORD(wParam) == EN_CHANGE)
70 | {
71 | HandleCompletion();
72 | return true;
73 | }
74 | return CComboBox::OnCommand(wParam, lParam);
75 | }
76 |
77 | CDosComboListDialog::CDosComboListDialog(CWnd* pParent /*=NULL*/)
78 | : CAcUiDialog(CDosComboListDialog::IDD, pParent)
79 | {
80 | m_Val = L"";
81 | }
82 |
83 | void CDosComboListDialog::DoDataExchange(CDataExchange* pDX)
84 | {
85 | CAcUiDialog::DoDataExchange(pDX);
86 | DDX_Control(pDX, IDC_LIST, m_List);
87 | DDX_CBString(pDX, IDC_LIST, m_Val);
88 | }
89 |
90 | BEGIN_MESSAGE_MAP(CDosComboListDialog, CAcUiDialog)
91 | ON_CBN_DBLCLK(IDC_LIST, OnDblClkCombo)
92 | ON_WM_NCHITTEST()
93 | END_MESSAGE_MAP()
94 |
95 | BOOL CDosComboListDialog::OnInitDialog()
96 | {
97 | SetDialogName(L"DOSLib:ComboList");
98 |
99 | CAcUiDialog::OnInitDialog();
100 |
101 | LockDialogHeight();
102 | StretchControlX(IDC_PROMPT, 100);
103 | StretchControlX(IDC_LIST, 100);
104 | MoveControlX(IDOK, 100);
105 | MoveControlX(IDCANCEL, 100);
106 |
107 | SetWindowText(m_Title);
108 | SetDlgItemText(IDC_PROMPT, m_Prompt);
109 |
110 | int i;
111 | for (i = 0; i < m_StrArray.GetCount(); i++)
112 | m_List.AddString(m_StrArray[i]);
113 |
114 | int n = m_List.SelectString(-1, m_Default);
115 | if (n == CB_ERR)
116 | SetDlgItemText(IDC_LIST, m_Default);
117 |
118 | return TRUE;
119 | }
120 |
121 | void CDosComboListDialog::OnDblClkCombo()
122 | {
123 | OnOK();
124 | }
125 |
126 | void CDosComboListDialog::OnOK()
127 | {
128 | CAcUiDialog::OnOK();
129 | }
130 |
131 | LRESULT CDosComboListDialog::OnNcHitTest(CPoint point)
132 | {
133 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
134 | if (hit == HTCLIENT)
135 | return HTCAPTION;
136 | return hit;
137 | }
138 |
--------------------------------------------------------------------------------
/source/DosComboListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosComboListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosComboBox : public CComboBox
15 | {
16 | public:
17 | CDosComboBox();
18 | virtual ~CDosComboBox();
19 |
20 | protected:
21 | virtual void HandleCompletion();
22 | virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
23 | DECLARE_MESSAGE_MAP()
24 |
25 | private:
26 | CEdit* m_pEdit;
27 | };
28 |
29 | class CDosComboListDialog : public CAcUiDialog
30 | {
31 | public:
32 | CDosComboListDialog(CWnd* pParent);
33 |
34 | enum { IDD = IDD_DOSCOMBOLIST };
35 | CDosComboBox m_List;
36 | CString m_Val;
37 | CString m_Title;
38 | CString m_Prompt;
39 | CString m_Default;
40 | CStringArray m_StrArray;
41 |
42 | protected:
43 | virtual void DoDataExchange(CDataExchange* pDX);
44 |
45 | protected:
46 | virtual BOOL OnInitDialog();
47 | afx_msg void OnDblClkCombo();
48 | virtual void OnOK();
49 | afx_msg LRESULT OnNcHitTest(CPoint point);
50 | DECLARE_MESSAGE_MAP()
51 | };
52 |
--------------------------------------------------------------------------------
/source/DosDragListBox.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosDragListBox.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosDragListBox : public CListBox
15 | {
16 | DECLARE_DYNAMIC(CDosDragListBox)
17 |
18 | public:
19 | CDosDragListBox();
20 | virtual ~CDosDragListBox();
21 |
22 | virtual BOOL BeginDrag(CPoint point);
23 | virtual void CancelDrag(CPoint point);
24 | virtual UINT Dragging(CPoint point);
25 | virtual void Dropped(CPoint point);
26 | virtual void EndDrag();
27 |
28 | public:
29 | virtual BOOL PreTranslateMessage(MSG* pMsg);
30 |
31 | protected:
32 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
33 | afx_msg void OnMouseMove(UINT nFlags, CPoint point);
34 | afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
35 | afx_msg void OnTimer(UINT_PTR nIDEvent);
36 | afx_msg void OnDestroy();
37 | DECLARE_MESSAGE_MAP()
38 |
39 | enum // drag states
40 | {
41 | DTS_NONE, // not dragging
42 | DTS_TRACK, // left button down, but motion hasn't reached drag threshold
43 | DTS_PREDRAG, // motion reached drag threshold, but drag hasn't started yet
44 | DTS_DRAG, // drag is in progress
45 | };
46 |
47 | enum
48 | {
49 | SCROLL_TIMER = 150, // scroll timer ID
50 | SCROLL_DELAY = 50 // scroll delay in milliseconds
51 | };
52 |
53 | int m_DragState; // drag state; see enum above
54 | CPoint m_DragOrigin; // point where left button was pressed, in client coords
55 | int m_ScrollDelta; // scroll by this amount per timer tick
56 | INT_PTR m_ScrollTimer; // if non-zero, timer instance for scrolling
57 | bool m_DeferSelect; // true if select was deferred to button up
58 | int m_PrevInsPos; // previous position of insert marker
59 | int m_PrevTop; // previous scroll position
60 |
61 | virtual void DrawInsert(int nItem, bool bEnable);
62 |
63 | int HitTest(CPoint point) const;
64 | void AutoScroll(CPoint point);
65 | void EndScroll();
66 | int GetInsertPos(CPoint point) const;
67 | void UpdateInsert(CPoint point);
68 | void EraseInsert();
69 | static void MakeArrow(CPoint point, bool bLeft, CRgn& rgn);
70 | int GetSelectedItems(CStringArray& ItemText, CDWordArray& ItemData, int& nInsertPos, bool bDelete = TRUE);
71 | void PasteItems(const CStringArray& ItemText, const CDWordArray& ItemData, int nInsertPos);
72 | };
73 |
--------------------------------------------------------------------------------
/source/DosDualListDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosDualListDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "stdafx.h"
13 | #include "DosDualListDialog.h"
14 |
15 | IMPLEMENT_DYNAMIC(CDosDualListDialog, CAcUiDialog)
16 |
17 | CDosDualListDialog::CDosDualListDialog(CWnd* pParent)
18 | : CAcUiDialog(CDosDualListDialog::IDD, pParent)
19 | {
20 | }
21 |
22 | CDosDualListDialog::~CDosDualListDialog()
23 | {
24 | }
25 |
26 | void CDosDualListDialog::DoDataExchange(CDataExchange* pDX)
27 | {
28 | CAcUiDialog::DoDataExchange(pDX);
29 | DDX_Control(pDX, IDC_LIST1, m_listbox1);
30 | DDX_Control(pDX, IDC_LIST2, m_listbox2);
31 | DDX_Control(pDX, IDC_MOVELEFT, m_left);
32 | DDX_Control(pDX, IDC_MOVERIGHT, m_right);
33 | }
34 |
35 | BEGIN_MESSAGE_MAP(CDosDualListDialog, CAcUiDialog)
36 | ON_WM_NCHITTEST()
37 | ON_BN_CLICKED(IDC_MOVELEFT, &CDosDualListDialog::OnMoveLeft)
38 | ON_BN_CLICKED(IDC_MOVERIGHT, &CDosDualListDialog::OnMoveRight)
39 | END_MESSAGE_MAP()
40 |
41 | BOOL CDosDualListDialog::OnInitDialog()
42 | {
43 | SetDialogName(L"DOSLib:DualListBox");
44 |
45 | CAcUiDialog::OnInitDialog();
46 |
47 | DLGCTLINFO dcDlgCtls[] = {
48 | {IDC_PROMPT, ELASTICX, 100},
49 | {IDC_S_LEFT, ELASTICX, 50},
50 | {IDC_S_RIGHT, ELASTICX | MOVEX, 50 },
51 | {IDC_LIST1, ELASTICX, 50},
52 | {IDC_LIST1, ELASTICY, 100},
53 | {IDC_LIST2, ELASTICX | MOVEX, 50},
54 | {IDC_LIST2, ELASTICY, 100},
55 | {IDC_MOVELEFT, MOVEXY, 50},
56 | {IDC_MOVERIGHT, MOVEXY, 50},
57 | {IDOK, MOVEX, 50},
58 | {IDOK, MOVEY, 100},
59 | {IDCANCEL, MOVEX, 50},
60 | {IDCANCEL, MOVEY, 100},
61 | };
62 |
63 | SetControlProperty(dcDlgCtls, sizeof(dcDlgCtls) / sizeof(DLGCTLINFO));
64 |
65 | SetWindowText(m_title);
66 | SetDlgItemText(IDC_PROMPT, m_prompt);
67 | SetDlgItemText(IDC_S_LEFT, m_prompt_list1);
68 | SetDlgItemText(IDC_S_RIGHT, m_prompt_list2);
69 |
70 | m_left.SetWingDingButton(CDosGlyphButton::BTN_LEFTARROW);
71 | m_right.SetWingDingButton(CDosGlyphButton::BTN_RIGHTARROW);
72 |
73 | int i, count = (int)m_list1.GetCount();
74 | for (i = 0; i < count; i++)
75 | {
76 | int index = m_listbox1.AddString(m_list1[i]);
77 | m_listbox1.SetItemData(index, i);
78 | }
79 |
80 | count = (int)m_list2.GetCount();
81 | for (i = 0; i < count; i++)
82 | {
83 | int index = m_listbox2.AddString(m_list2[i]);
84 | m_listbox2.SetItemData(index, i);
85 | }
86 |
87 | return TRUE;
88 | }
89 |
90 | void CDosDualListDialog::OnOK()
91 | {
92 | m_list1.RemoveAll();
93 | m_list2.RemoveAll();
94 |
95 | int i;
96 | CString s;
97 |
98 | for (i = 0; i < (int)m_listbox1.GetCount(); i++)
99 | {
100 | m_listbox1.GetText(i, s);
101 | m_list1.Add(s);
102 | }
103 |
104 | for (i = 0; i < (int)m_listbox2.GetCount(); i++)
105 | {
106 | m_listbox2.GetText(i, s);
107 | m_list2.Add(s);
108 | }
109 |
110 | CAcUiDialog::OnOK();
111 | }
112 |
113 | LRESULT CDosDualListDialog::OnNcHitTest(CPoint point)
114 | {
115 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
116 | if (hit == HTCLIENT)
117 | return HTCAPTION;
118 | return hit;
119 | }
120 | void CDosDualListDialog::OnMoveLeft()
121 | {
122 | if (0 == m_listbox2.GetSelCount())
123 | return;
124 |
125 | int nInsertPos = m_listbox1.GetAnchorIndex();
126 | if (nInsertPos == LB_ERR)
127 | nInsertPos = m_listbox1.GetCount();
128 |
129 | m_listbox2.MoveSelectedItems(&m_listbox1, nInsertPos);
130 | }
131 |
132 | void CDosDualListDialog::OnMoveRight()
133 | {
134 | if (0 == m_listbox1.GetSelCount())
135 | return;
136 |
137 | int nInsertPos = m_listbox2.GetAnchorIndex();
138 | if (nInsertPos == LB_ERR)
139 | nInsertPos = m_listbox2.GetCount();
140 |
141 | m_listbox1.MoveSelectedItems(&m_listbox2, nInsertPos);
142 | }
143 |
--------------------------------------------------------------------------------
/source/DosDualListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosDualListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosInterDragListBox.h"
15 | #include "DosGlyphButton.h"
16 |
17 | class CDosDualListDialog : public CAcUiDialog
18 | {
19 | DECLARE_DYNAMIC(CDosDualListDialog)
20 |
21 | public:
22 | CDosDualListDialog(CWnd* pParent);
23 | virtual ~CDosDualListDialog();
24 |
25 | CString m_title;
26 | CString m_prompt;
27 | CString m_prompt_list1;
28 | CString m_prompt_list2;
29 | CStringArray m_list1;
30 | CStringArray m_list2;
31 | CDosGlyphButton m_left;
32 | CDosGlyphButton m_right;
33 |
34 | // Dialog Data
35 | enum { IDD = IDD_DOSDUALLISTBOX };
36 | CDosInterDragListBox m_listbox1;
37 | CDosInterDragListBox m_listbox2;
38 |
39 | protected:
40 | virtual void DoDataExchange(CDataExchange* pDX);
41 | virtual BOOL OnInitDialog();
42 | virtual void OnOK();
43 | afx_msg void OnMoveLeft();
44 | afx_msg void OnMoveRight();
45 | afx_msg LRESULT OnNcHitTest(CPoint point);
46 | DECLARE_MESSAGE_MAP()
47 | };
48 |
--------------------------------------------------------------------------------
/source/DosDwgPreviewDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosDwgPreviewDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosDwgPreviewDialog.h"
14 | #include "DosFolderDialog.h"
15 |
16 | BEGIN_MESSAGE_MAP(CDosDwgPreviewCtrl, CStatic)
17 | ON_WM_PAINT()
18 | END_MESSAGE_MAP()
19 |
20 | void CDosDwgPreviewCtrl::OnPaint()
21 | {
22 | CRect rc, rcframe;
23 | GetWindowRect(rcframe);
24 | GetClientRect(rc);
25 | ClientToScreen(rc);
26 | int cx = rcframe.Width() - rc.Width();
27 | int cy = rcframe.Height() - rc.Height();
28 | ScreenToClient(rc);
29 | rc.DeflateRect(cx / 2, cy / 2);
30 | GetDC()->FillRect(rc, &CBrush(GetSysColor(COLOR_BTNFACE)));
31 | CStatic::OnPaint();
32 | acdbDisplayPreviewFromDwg(m_strFilename, m_hWnd, (const Adesk::UInt32*)&m_nColor);
33 | }
34 |
35 |
36 | CDosDwgPreviewDialog::CDosDwgPreviewDialog(CWnd* pParent)
37 | : CAcUiDialog(CDosDwgPreviewDialog::IDD, pParent)
38 | {
39 | m_Title = L"";
40 | m_Prompt = L"";
41 | }
42 |
43 | void CDosDwgPreviewDialog::DoDataExchange(CDataExchange* pDX)
44 | {
45 | CAcUiDialog::DoDataExchange(pDX);
46 | DDX_Control(pDX, IDC_LIST, m_List);
47 | DDX_Control(pDX, IDC_STATIC_FRAME, m_DwgPreview);
48 | }
49 |
50 | BEGIN_MESSAGE_MAP(CDosDwgPreviewDialog, CAcUiDialog)
51 | ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
52 | ON_WM_PAINT()
53 | ON_LBN_SELCHANGE(IDC_LIST, OnSelchangeList)
54 | ON_WM_SIZE()
55 | ON_LBN_DBLCLK(IDC_LIST, OnDblclkList)
56 | ON_WM_NCHITTEST()
57 | END_MESSAGE_MAP()
58 |
59 | void CDosDwgPreviewDialog::OnBrowse()
60 | {
61 | CDosFolderDialog dlg(adsw_acadMainWnd());
62 | dlg.SetDialogTitle(L"Select a folder containing drawing files");
63 | dlg.SetDialogFolder(m_Prompt);
64 | if (dlg.DoModal() == IDOK)
65 | {
66 | m_Prompt = dlg.GetFolderName();
67 | SetDlgItemText(IDC_PROMPT, m_Prompt);
68 | FillListBox();
69 | }
70 | }
71 |
72 | void CDosDwgPreviewDialog::OnPaint()
73 | {
74 | CPaintDC dc(this);
75 | }
76 |
77 | BOOL CDosDwgPreviewDialog::OnInitDialog()
78 | {
79 | SetDialogName(L"DOSLib:DwgPreview");
80 |
81 | CAcUiDialog::OnInitDialog();
82 |
83 | DLGCTLINFO dcDlgCtls[] = {
84 | {IDC_PROMPT, ELASTICX, 100},
85 | {IDC_LIST, ELASTICX, 50},
86 | {IDC_LIST, ELASTICY, 100},
87 | {IDC_STATIC_FRAME, ELASTICX | MOVEX, 50},
88 | {IDC_STATIC_FRAME, ELASTICY, 100},
89 | {IDOK, MOVEX, 50},
90 | {IDOK, MOVEY, 100},
91 | {IDCANCEL, MOVEX, 50},
92 | {IDCANCEL, MOVEY, 100},
93 | {IDC_BROWSE, MOVEX, 50},
94 | {IDC_BROWSE, MOVEY, 100},
95 | };
96 |
97 | SetControlProperty(dcDlgCtls, sizeof(dcDlgCtls) / sizeof(DLGCTLINFO));
98 |
99 | SetWindowText(m_Title);
100 | SetDlgItemText(IDC_PROMPT, m_Prompt);
101 |
102 | FillListBox();
103 |
104 | return TRUE;
105 | }
106 |
107 | void CDosDwgPreviewDialog::FillListBox()
108 | {
109 | m_List.ResetContent();
110 |
111 | if (m_StrArray.GetCount() > 0)
112 | {
113 | int i;
114 | for (i = 0; i < m_StrArray.GetCount(); i++)
115 | m_List.AddString(m_StrArray[i]);
116 | m_List.SetCurSel(0);
117 | OnSelchangeList();
118 | GetDlgItem(IDC_BROWSE)->EnableWindow(FALSE);
119 | return;
120 | }
121 |
122 | CString str = m_Prompt;
123 | str += L"\\*.dwg";
124 |
125 | CFileFind finder;
126 | BOOL bWorking = finder.FindFile(str);
127 | if (!bWorking)
128 | return;
129 |
130 | while (bWorking)
131 | {
132 | bWorking = finder.FindNextFile();
133 | if (finder.IsDots())
134 | continue;
135 | if (finder.IsDirectory())
136 | continue;
137 | m_List.AddString(finder.GetFileName());
138 | }
139 |
140 | m_List.SetCurSel(0);
141 | OnSelchangeList();
142 | }
143 |
144 | void CDosDwgPreviewDialog::OnOK()
145 | {
146 | m_Prompt = m_DwgPreview.m_strFilename;
147 | CAcUiDialog::OnOK();
148 | }
149 |
150 | void CDosDwgPreviewDialog::OnSelchangeList()
151 | {
152 | CString cFile;
153 | int nSel = m_List.GetCurSel();
154 | m_List.GetText(nSel, cFile);
155 |
156 | if (m_StrArray.GetCount() > 0)
157 | m_DwgPreview.m_strFilename = cFile;
158 | else
159 | m_DwgPreview.m_strFilename.Format(L"%s\\%s", m_Prompt, cFile);
160 |
161 | m_DwgPreview.m_nColor = m_Color;
162 | m_DwgPreview.Invalidate();
163 | }
164 |
165 | void CDosDwgPreviewDialog::OnSize(UINT nType, int cx, int cy)
166 | {
167 | CAcUiDialog::OnSize(nType, cx, cy);
168 | m_DwgPreview.Invalidate();
169 | }
170 |
171 | void CDosDwgPreviewDialog::OnDblclkList()
172 | {
173 | OnOK();
174 | }
175 |
176 | LRESULT CDosDwgPreviewDialog::OnNcHitTest(CPoint point)
177 | {
178 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
179 | if (hit == HTCLIENT)
180 | return HTCAPTION;
181 | return hit;
182 | }
183 |
--------------------------------------------------------------------------------
/source/DosDwgPreviewDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosDwgPreviewDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosDwgPreviewCtrl : public CStatic
15 | {
16 | public:
17 | CDosDwgPreviewCtrl() {}
18 | virtual ~CDosDwgPreviewCtrl() {}
19 |
20 | CString m_strFilename;
21 | unsigned long m_nColor;
22 |
23 | protected:
24 | afx_msg void OnPaint();
25 | DECLARE_MESSAGE_MAP()
26 | };
27 |
28 | class CDosDwgPreviewDialog : public CAcUiDialog
29 | {
30 | public:
31 | CDosDwgPreviewDialog(CWnd* pParent);
32 |
33 | enum { IDD = IDD_DWGPREVIEW };
34 | CListBox m_List;
35 | CDosDwgPreviewCtrl m_DwgPreview;
36 |
37 | CString m_Title;
38 | CString m_Prompt;
39 | Adesk::UInt32 m_Color;
40 | CStringArray m_StrArray;
41 |
42 | protected:
43 | virtual void DoDataExchange(CDataExchange* pDX);
44 | void FillListBox();
45 |
46 | protected:
47 | afx_msg void OnBrowse();
48 | afx_msg void OnPaint();
49 | virtual BOOL OnInitDialog();
50 | virtual void OnOK();
51 | afx_msg void OnSelchangeList();
52 | afx_msg void OnSize(UINT nType, int cx, int cy);
53 | afx_msg void OnDblclkList();
54 | afx_msg LRESULT OnNcHitTest(CPoint point);
55 | DECLARE_MESSAGE_MAP()
56 | };
57 |
--------------------------------------------------------------------------------
/source/DosEditBoxDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosEditBoxDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosEditBoxDialog.h"
14 |
15 | CDosEditBoxDialog::CDosEditBoxDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosEditBoxDialog::IDD, pParent)
17 | {
18 | }
19 |
20 | void CDosEditBoxDialog::DoDataExchange(CDataExchange* pDX)
21 | {
22 | CAcUiDialog::DoDataExchange(pDX);
23 | DDX_Control(pDX, IDOK, m_OK);
24 | DDX_Control(pDX, IDC_EDIT, m_Edit);
25 | }
26 |
27 | BEGIN_MESSAGE_MAP(CDosEditBoxDialog, CAcUiDialog)
28 | ON_EN_CHANGE(IDC_EDIT, OnChangeEdit)
29 | ON_BN_CLICKED(IDC_IMPORT, OnImport)
30 | ON_WM_NCHITTEST()
31 | END_MESSAGE_MAP()
32 |
33 | BOOL CDosEditBoxDialog::OnInitDialog()
34 | {
35 | SetDialogName(L"DOSLib:EditBox");
36 |
37 | CAcUiDialog::OnInitDialog();
38 |
39 | StretchControlX(IDC_PROMPT, 100);
40 | StretchControlXY(IDC_EDIT, 100, 100);
41 | MoveControlX(IDOK, 100);
42 | MoveControlX(IDCANCEL, 100);
43 | MoveControlX(IDC_IMPORT, 100);
44 |
45 | SetWindowText(m_Title);
46 | SetDlgItemText(IDC_PROMPT, m_Prompt);
47 |
48 | m_Edit.SetWindowText(m_String);
49 | m_Edit.SetSel(m_String.GetLength(), m_String.GetLength());
50 |
51 | OnChangeEdit();
52 | m_OK.SetFocus();
53 |
54 | return TRUE;
55 | }
56 |
57 | void CDosEditBoxDialog::OnOK()
58 | {
59 | m_Edit.GetWindowText(m_String);
60 | CAcUiDialog::OnOK();
61 | }
62 |
63 | void CDosEditBoxDialog::OnChangeEdit()
64 | {
65 | CString str;
66 | m_Edit.GetWindowText(str);
67 | if (str.GetLength() == 0)
68 | m_OK.EnableWindow(FALSE);
69 | else
70 | m_OK.EnableWindow(TRUE);
71 | }
72 |
73 | void CDosEditBoxDialog::OnImport()
74 | {
75 | UpdateData();
76 |
77 | int nStartChar = 0, nEndChar = 0;
78 | m_Edit.GetSel(nStartChar, nEndChar);
79 |
80 | TCHAR tchCurrentDirectory[_MAX_PATH];
81 | DWORD dwChars = GetCurrentDirectory(_MAX_PATH, tchCurrentDirectory);
82 |
83 | CFileDialog dlg(
84 | TRUE,
85 | L"txt",
86 | 0,
87 | OFN_ENABLESIZING | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST,
88 | L"Text Files (*.txt)|*.txt|All Files (*.*)|*.*||"
89 | );
90 |
91 | dlg.m_ofn.nFilterIndex = 1;
92 | dlg.m_ofn.lpstrInitialDir = tchCurrentDirectory;
93 |
94 | if (dlg.DoModal() == IDCANCEL)
95 | return;
96 |
97 | // Read the text from file
98 | CString str;
99 | CStdioFile* pFile = 0;
100 |
101 | TRY
102 | {
103 | pFile = new CStdioFile(dlg.GetPathName(), CFile::modeRead | CFile::shareDenyNone | CFile::typeText);
104 |
105 | CString strLine;
106 | while (pFile->ReadString(strLine))
107 | str += strLine + L"\r\n";
108 |
109 | pFile->Close();
110 |
111 | delete pFile;
112 | pFile = 0;
113 | }
114 |
115 | CATCH(CFileException, e)
116 | {
117 | e->ReportError();
118 | if (pFile != NULL)
119 | {
120 | pFile->Close();
121 |
122 | delete pFile;
123 | pFile = 0;
124 | }
125 | return;
126 | }
127 |
128 | AND_CATCH(CMemoryException, pEx)
129 | AfxAbort();
130 |
131 | END_CATCH
132 |
133 | // Update edit control
134 | m_Edit.SetFocus();
135 | m_Edit.SetSel(nStartChar, nEndChar);
136 | m_Edit.ReplaceSel(str, TRUE);
137 |
138 | UpdateData();
139 | }
140 |
141 | BOOL CDosEditBoxDialog::PreTranslateMessage(MSG* pMsg)
142 | {
143 | CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT);
144 | if ((CEdit*)this->GetFocus() == pEdit)
145 | {
146 | if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB))
147 | {
148 | int nPos = LOWORD(m_Edit.CharFromPos(m_Edit.GetCaretPos()));
149 | m_Edit.SetSel(nPos, nPos);
150 | m_Edit.ReplaceSel(L"\t", TRUE);
151 | return TRUE;
152 | }
153 | }
154 |
155 | return CAcUiDialog::PreTranslateMessage(pMsg);
156 | }
157 |
158 | LRESULT CDosEditBoxDialog::OnNcHitTest(CPoint point)
159 | {
160 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
161 | if (hit == HTCLIENT)
162 | return HTCAPTION;
163 | return hit;
164 | }
165 |
--------------------------------------------------------------------------------
/source/DosEditBoxDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosEditBoxDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosEditBoxDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosEditBoxDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_DOSEDITBOX };
20 | CButton m_OK;
21 | CEdit m_Edit;
22 | CString m_Title;
23 | CString m_Prompt;
24 | CString m_String;
25 |
26 | public:
27 | virtual BOOL PreTranslateMessage(MSG* pMsg);
28 |
29 | protected:
30 | virtual void DoDataExchange(CDataExchange* pDX);
31 |
32 | protected:
33 | virtual BOOL OnInitDialog();
34 | virtual void OnOK();
35 | afx_msg void OnChangeEdit();
36 | afx_msg void OnImport();
37 | afx_msg LRESULT OnNcHitTest(CPoint point);
38 | DECLARE_MESSAGE_MAP()
39 | };
40 |
--------------------------------------------------------------------------------
/source/DosEditListDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosEditListDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosEditListDialog.h"
14 |
15 | CDosEditListDialog::CDosEditListDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosEditListDialog::IDD, pParent)
17 | , m_ListBoxExBuddy(IDB_BUDDY)
18 | {
19 | }
20 |
21 | void CDosEditListDialog::DoDataExchange(CDataExchange* pDX)
22 | {
23 | CAcUiDialog::DoDataExchange(pDX);
24 | DDX_Control(pDX, IDC_LIST, m_List);
25 | }
26 |
27 | BEGIN_MESSAGE_MAP(CDosEditListDialog, CAcUiDialog)
28 | ON_WM_NCHITTEST()
29 | END_MESSAGE_MAP()
30 |
31 | BOOL CDosEditListDialog::OnInitDialog()
32 | {
33 | SetDialogName(L"DOSLib:EditList");
34 |
35 | CAcUiDialog::OnInitDialog();
36 |
37 | StretchControlX(IDC_BUDDYS, 100);
38 | StretchControlXY(IDC_LIST, 100, 100);
39 | MoveControlX(IDOK, 100);
40 | MoveControlX(IDCANCEL, 100);
41 |
42 | SetWindowText(m_Title);
43 | SetDlgItemText(IDC_BUDDYS, m_Prompt);
44 |
45 | m_ListBoxExBuddy.SubclassDlgItem(IDC_BUDDYS, this);
46 | m_ListBoxExBuddy.SetListBox(&m_List);
47 |
48 | m_List.SetEditStyle(0);
49 | m_List.AllowDrag(FALSE);
50 |
51 | int i;
52 | for (i = 0; i < m_StrArray.GetCount(); i++)
53 | m_List.AddString(m_StrArray[i]);
54 | m_List.SetCurSel(0);
55 |
56 | return TRUE;
57 | }
58 |
59 | void CDosEditListDialog::OnOK()
60 | {
61 | m_StrArray.RemoveAll();
62 |
63 | int i;
64 | for (i = 0; i < m_List.GetCount(); i++)
65 | {
66 | CString str;
67 | m_List.GetText(i, str);
68 | m_StrArray.Add(str);
69 | }
70 |
71 | CAcUiDialog::OnOK();
72 | }
73 |
74 | LRESULT CDosEditListDialog::OnNcHitTest(CPoint point)
75 | {
76 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
77 | if (hit == HTCLIENT)
78 | return HTCAPTION;
79 | return hit;
80 | }
81 |
--------------------------------------------------------------------------------
/source/DosEditListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosEditListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosListBoxEx.h"
15 |
16 | class CDosEditListDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosEditListDialog(CWnd* pParent);
20 |
21 | enum { IDD = IDD_DOSEDITLIST };
22 | CDosListBoxEx m_List;
23 | CDosListBoxExBuddy m_ListBoxExBuddy;
24 | CString m_Val;
25 | CString m_Title;
26 | CString m_Prompt;
27 | CStringArray m_StrArray;
28 |
29 | protected:
30 | virtual void DoDataExchange(CDataExchange* pDX);
31 |
32 | protected:
33 | virtual BOOL OnInitDialog();
34 | virtual void OnOK();
35 | afx_msg LRESULT OnNcHitTest(CPoint point);
36 | DECLARE_MESSAGE_MAP()
37 | };
38 |
--------------------------------------------------------------------------------
/source/DosFileDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosFileDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosFileDialog : public CFileDialog
15 | {
16 | DECLARE_DYNAMIC(CDosFileDialog)
17 |
18 | public:
19 | CDosFileDialog(
20 | LPCTSTR lpszDefExt = NULL,
21 | LPCTSTR lpszFileName = NULL,
22 | DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
23 | LPCTSTR lpszFilter = NULL,
24 | CWnd* pParentWnd = NULL,
25 | DWORD dwSize = 0
26 | );
27 | virtual ~CDosFileDialog();
28 |
29 | virtual INT_PTR DoModal();
30 |
31 | POSITION GetStartPosition() const;
32 | CString GetNextPathName(POSITION& pos) const;
33 |
34 | protected:
35 | virtual void OnFileNameChange();
36 | DECLARE_MESSAGE_MAP()
37 |
38 | protected:
39 | wchar_t* m_files;
40 | wchar_t* m_folder;
41 | bool m_bParsed;
42 | };
--------------------------------------------------------------------------------
/source/DosFileMerge.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosFileMerge.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "stdafx.h"
13 | #include "DosFileMerge.h"
14 |
15 | CDosFileMerge::CDosFileMerge(const CString& output, const CStringArray& input)
16 | : m_pInFile(0)
17 | , m_pOutFile(0)
18 | {
19 | m_output = output;
20 | m_input.Append(input);
21 | }
22 |
23 | CDosFileMerge::~CDosFileMerge()
24 | {
25 | if (m_pInFile)
26 | {
27 | delete m_pInFile;
28 | m_pInFile = 0;
29 | }
30 |
31 | if (m_pOutFile)
32 | {
33 | delete m_pOutFile;
34 | m_pOutFile = 0;
35 | }
36 | }
37 |
38 | bool CDosFileMerge::Merge()
39 | {
40 | if (m_pInFile)
41 | {
42 | delete m_pInFile;
43 | m_pInFile = 0;
44 | }
45 |
46 | if (m_pOutFile)
47 | {
48 | delete m_pOutFile;
49 | m_pOutFile = 0;
50 | }
51 |
52 | if (m_input.GetCount() == 0 || m_output.IsEmpty())
53 | return false;
54 |
55 | try
56 | {
57 | m_pOutFile = new CFile();
58 | if (PathFileExists(m_output))
59 | {
60 | if (!m_pOutFile->Open(m_output, CFile::typeBinary | CFile::modeWrite))
61 | return false;
62 | m_pOutFile->SeekToEnd();
63 | }
64 | else
65 | {
66 | if (!m_pOutFile->Open(m_output, CFile::modeCreate | CFile::typeBinary | CFile::modeWrite))
67 | return false;
68 | }
69 |
70 | m_pInFile = new CStdioFile();
71 |
72 | int i;
73 | for (i = 0; i < m_input.GetCount(); i++)
74 | {
75 | if (!m_pInFile->Open(m_input[i], CFile::modeRead | CFile::typeBinary))
76 | {
77 | m_pOutFile->Close();
78 | return false;
79 | }
80 |
81 | int nBytesRead = 0;
82 | char buffer[BYTES_PER_READ];
83 |
84 | do
85 | {
86 | nBytesRead = m_pInFile->Read(buffer, BYTES_PER_READ);
87 | m_pOutFile->Write(buffer, nBytesRead);
88 | } while (nBytesRead == BYTES_PER_READ);
89 |
90 | m_pInFile->Close();
91 | }
92 |
93 | m_pOutFile->Close();
94 |
95 | if (m_pInFile)
96 | {
97 | delete m_pInFile;
98 | m_pInFile = 0;
99 | }
100 |
101 | if (m_pOutFile)
102 | {
103 | delete m_pOutFile;
104 | m_pOutFile = 0;
105 | }
106 | }
107 |
108 | catch (...)
109 | {
110 | return false;
111 | }
112 |
113 | return true;
114 | }
115 |
--------------------------------------------------------------------------------
/source/DosFileMerge.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosFileMerge.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #define BYTES_PER_READ 65536
15 |
16 | class CDosFileMerge
17 | {
18 | public:
19 | CDosFileMerge(const CString& output, const CStringArray& input);
20 | virtual ~CDosFileMerge();
21 |
22 | bool Merge();
23 |
24 | protected:
25 | CString m_output;
26 | CStringArray m_input;
27 | CFile* m_pInFile;
28 | CFile* m_pOutFile;
29 | };
30 |
--------------------------------------------------------------------------------
/source/DosFileOperation.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosFileOperation.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosFileOperation
15 | {
16 | public:
17 | CDosFileOperation();
18 | ~CDosFileOperation();
19 |
20 | public:
21 | void Initialize();
22 |
23 | bool AddSourceFile(const wchar_t* pszPath);
24 | bool AddDestFile(const wchar_t* pszPath);
25 |
26 | const CStringList& GetSourceFileList();
27 | const CStringList& GetDestFileList();
28 |
29 | bool SetOperationFlags(
30 | UINT uType,
31 | CWnd* pWnd,
32 | bool bSilent,
33 | bool bAllowUndo,
34 | bool bWildcardFilesOnly,
35 | bool bNoConfirmation,
36 | bool bNoConfirmationToMakeDir,
37 | bool bRenameOnCollision,
38 | bool bSimpleProgressDlg
39 | );
40 |
41 | bool SetOperationFlags(UINT uType, CWnd* pWnd, FILEOP_FLAGS fFlags);
42 |
43 | void SetProgressDlgTitle(const wchar_t* pszTitle);
44 |
45 | bool Go(bool* bStarted, int* nResult = 0, bool* bAborted = 0);
46 |
47 | bool Aborted() const;
48 |
49 | protected:
50 | bool m_bFlags;
51 | bool m_bCalled;
52 | CStringList m_SourceFiles;
53 | CStringList m_DestFiles;
54 | CString m_strProgressTitle;
55 | SHFILEOPSTRUCT m_fileop;
56 |
57 | protected:
58 | DWORD GetBufferSize(const CStringList& src);
59 | void FillBuffer(const CStringList& src, wchar_t* psz);
60 | };
61 |
--------------------------------------------------------------------------------
/source/DosFolderDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosFolderDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosFolderDialog
15 | {
16 | public:
17 | CDosFolderDialog(HWND hWnd = NULL);
18 | virtual ~CDosFolderDialog();
19 |
20 | void SetDialogCaption(const wchar_t* pszCaption);
21 | void SetDialogTitle(const wchar_t* pszTitle);
22 | void SetDialogFolder(const wchar_t* pszFolder);
23 | void SetDialogFlags(UINT ulFlags);
24 |
25 | virtual int DoModal();
26 |
27 | CString GetFolderName() const;
28 |
29 | protected:
30 | virtual void OnInitDialog();
31 | virtual void OnSelChanged(LPITEMIDLIST lpItemIDList);
32 | virtual void CallbackFunction(HWND hWnd, UINT uMsg, LPARAM lParam);
33 |
34 | void EnableOK(BOOL bEnable = TRUE);
35 | void SetTitle(const wchar_t* pszTitle);
36 | void SetStatusText(const wchar_t* pszStatusText);
37 | void SetSelection(const wchar_t* pszSelection);
38 | void SetSelection(LPITEMIDLIST lpItemIDList);
39 | void SetExpanded(LPITEMIDLIST lpItemIDList);
40 | void SetExpanded(const wchar_t* pszFolder);
41 |
42 | friend static int CALLBACK BrowseDirectoryCallback(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
43 |
44 | protected:
45 | UINT m_ulFlags;
46 | HWND m_hWnd;
47 | CString m_strCaption;
48 | CString m_strTitle;
49 | CString m_strFolder;
50 | CString m_strDisplayName;
51 | };
52 |
--------------------------------------------------------------------------------
/source/DosGetCancelDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetCancelDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetCancelDialog.h"
14 |
15 | CDosGetCancelDialog::CDosGetCancelDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosGetCancelDialog::IDD, pParent)
17 | {
18 | }
19 |
20 | void CDosGetCancelDialog::DoDataExchange(CDataExchange* pDX)
21 | {
22 | CAcUiDialog::DoDataExchange(pDX);
23 | }
24 |
25 | BEGIN_MESSAGE_MAP(CDosGetCancelDialog, CAcUiDialog)
26 | ON_MESSAGE(WM_ACAD_KEEPFOCUS, OnAcadKeepFocus)
27 | ON_WM_NCHITTEST()
28 | END_MESSAGE_MAP()
29 |
30 | BOOL CDosGetCancelDialog::OnInitDialog()
31 | {
32 | SetDialogName(L"DOSLib:GetCancel");
33 |
34 | CAcUiDialog::OnInitDialog();
35 |
36 | LockDialogHeight();
37 | StretchControlX(IDC_PROMPT, 100);
38 | MoveControlX(IDCANCEL, 50);
39 |
40 | SetWindowText(m_Title);
41 | SetDlgItemText(IDC_PROMPT, m_Prompt);
42 | CenterWindow();
43 |
44 | return TRUE;
45 | }
46 |
47 | LRESULT CDosGetCancelDialog::OnAcadKeepFocus(WPARAM wParam, LPARAM lParam)
48 | {
49 | return TRUE;
50 | }
51 |
52 | void CDosGetCancelDialog::KillDialog()
53 | {
54 | OnCancel();
55 | }
56 |
57 | void CDosGetCancelDialog::OnCancel()
58 | {
59 | DestroyWindow();
60 | }
61 |
62 | void CDosGetCancelDialog::PostNcDestroy()
63 | {
64 | CAcUiDialog::PostNcDestroy();
65 | delete this;
66 | }
67 |
68 | LRESULT CDosGetCancelDialog::OnNcHitTest(CPoint point)
69 | {
70 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
71 | if (hit == HTCLIENT)
72 | return HTCAPTION;
73 | return hit;
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/source/DosGetCancelDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetCancelDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosGetCancelDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosGetCancelDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_DOSCANCEL };
20 | CString m_Title;
21 | CString m_Prompt;
22 |
23 | void KillDialog();
24 |
25 | protected:
26 | virtual void DoDataExchange(CDataExchange* pDX);
27 | virtual void PostNcDestroy();
28 |
29 | protected:
30 | virtual void OnCancel();
31 | virtual BOOL OnInitDialog();
32 | afx_msg LRESULT OnNcHitTest(CPoint point);
33 | afx_msg LRESULT OnAcadKeepFocus(WPARAM wParam, LPARAM lParam);
34 | DECLARE_MESSAGE_MAP()
35 | };
36 |
--------------------------------------------------------------------------------
/source/DosGetDateDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetDateDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetDateDialog.h"
14 |
15 | IMPLEMENT_DYNAMIC(CDosGetDateDialog, CAcUiDialog)
16 |
17 | CDosGetDateDialog::CDosGetDateDialog(CWnd* pParent /*=NULL*/)
18 | : CAcUiDialog(CDosGetDateDialog::IDD, pParent)
19 | {
20 | m_time = CTime::GetCurrentTime();
21 | m_start = CTime::GetCurrentTime();
22 | }
23 |
24 | CDosGetDateDialog::~CDosGetDateDialog()
25 | {
26 | }
27 |
28 | void CDosGetDateDialog::DoDataExchange(CDataExchange* pDX)
29 | {
30 | CAcUiDialog::DoDataExchange(pDX);
31 | DDX_Control(pDX, IDC_MONTHCALENDAR1, m_cal);
32 | }
33 |
34 | BEGIN_MESSAGE_MAP(CDosGetDateDialog, CAcUiDialog)
35 | ON_WM_NCHITTEST()
36 | END_MESSAGE_MAP()
37 |
38 | BOOL CDosGetDateDialog::OnInitDialog()
39 | {
40 | SetDialogName(L"DOSLib:GetDate");
41 |
42 | CAcUiDialog::OnInitDialog();
43 |
44 | StretchControlXY(IDC_MONTHCALENDAR1, 100, 100);
45 | MoveControlXY(IDOK, 50, 100);
46 | MoveControlXY(IDCANCEL, 50, 100);
47 |
48 | SetWindowText(m_title);
49 |
50 | m_cal.SetCurSel(m_start);
51 |
52 | return TRUE;
53 | }
54 |
55 | void CDosGetDateDialog::OnOK()
56 | {
57 | if (m_cal.GetCurSel(m_time))
58 | CAcUiDialog::OnOK();
59 | else
60 | CAcUiDialog::OnCancel();
61 | }
62 |
63 | LRESULT CDosGetDateDialog::OnNcHitTest(CPoint point)
64 | {
65 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
66 | if (hit == HTCLIENT)
67 | return HTCAPTION;
68 | return hit;
69 | }
--------------------------------------------------------------------------------
/source/DosGetDateDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetDateDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosGetDateDialog : public CAcUiDialog
15 | {
16 | DECLARE_DYNAMIC(CDosGetDateDialog)
17 |
18 | public:
19 | CDosGetDateDialog(CWnd* pParent = NULL);
20 | virtual ~CDosGetDateDialog();
21 |
22 | // Dialog Data
23 | enum { IDD = IDD_DOSGETDATE };
24 | CMonthCalCtrl m_cal;
25 | CString m_title;
26 | CTime m_time;
27 | CTime m_start;
28 |
29 | protected:
30 | virtual void DoDataExchange(CDataExchange* pDX);
31 | virtual BOOL OnInitDialog();
32 | virtual void OnOK();
33 | afx_msg LRESULT OnNcHitTest(CPoint point);
34 | DECLARE_MESSAGE_MAP()
35 | };
36 |
--------------------------------------------------------------------------------
/source/DosGetIntDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetIntDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetIntDialog.h"
14 |
15 | CDosGetIntDialog::CDosGetIntDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosGetIntDialog::IDD, pParent)
17 | {
18 | m_sTitle = L"";
19 | m_sPrompt = L"";
20 | m_nValue = 0;
21 | m_bIsEmpty = TRUE;
22 | m_bAllowZero = TRUE;
23 | m_bAllowEmpty = TRUE;
24 | m_bAllowNeg = TRUE;
25 | m_bMin = FALSE;
26 | m_bMax = FALSE;
27 | m_nMin = 0;
28 | m_nMax = 0;
29 | }
30 |
31 | void CDosGetIntDialog::DoDataExchange(CDataExchange* pDX)
32 | {
33 | CAcUiDialog::DoDataExchange(pDX);
34 | DDX_Control(pDX, IDOK, m_OK);
35 | DDX_Control(pDX, IDC_EDIT, m_Edit);
36 | }
37 |
38 | BEGIN_MESSAGE_MAP(CDosGetIntDialog, CAcUiDialog)
39 | ON_EN_CHANGE(IDC_EDIT, OnChangeEdit)
40 | ON_WM_NCHITTEST()
41 | END_MESSAGE_MAP()
42 |
43 | BOOL CDosGetIntDialog::OnInitDialog()
44 | {
45 | SetDialogName(L"DOSLib:GetInt");
46 |
47 | CAcUiDialog::OnInitDialog();
48 |
49 | LockDialogHeight();
50 | StretchControlX(IDC_EDIT, 100);
51 |
52 | SetWindowText(m_sTitle);
53 | SetDlgItemText(IDC_PROMPT, m_sPrompt);
54 | if (!m_bAllowEmpty || !m_bIsEmpty)
55 | {
56 | CString s;
57 | s.Format(L"%d", m_nValue);
58 | m_Edit.SetWindowText(s);
59 | }
60 |
61 | m_Edit.SetFocus();
62 | OnChangeEdit();
63 |
64 | return TRUE;
65 | }
66 |
67 | void CDosGetIntDialog::OnOK()
68 | {
69 | CString s, str;
70 | BOOL bError = FALSE;
71 |
72 | m_Edit.GetWindowText(s);
73 |
74 | if (s.IsEmpty())
75 | {
76 | if (m_bAllowEmpty)
77 | {
78 | m_bIsEmpty = TRUE;
79 | CAcUiDialog::OnOK();
80 | return;
81 | }
82 | else
83 | {
84 | ErrorMessageBox(L"Please enter an integer number.");
85 | return;
86 | }
87 | }
88 |
89 | int n = 0;
90 | if (!DOS_IntegerParse(s, n))
91 | {
92 | ErrorMessageBox(L"Please enter an integer number.");
93 | return;
94 | }
95 |
96 | if (!m_bAllowZero && n == 0)
97 | {
98 | ErrorMessageBox(L"Please enter a non-zero integer number.");
99 | return;
100 | }
101 |
102 | if (!m_bAllowNeg && n < 0)
103 | {
104 | ErrorMessageBox(L"Please enter a positive integer number.");
105 | return;
106 | }
107 |
108 | if (m_bMin && n < m_nMin)
109 | {
110 | str.Format(L"Please enter an integer number greater than or equal to %d", m_nMin);
111 | ErrorMessageBox(str);
112 | return;
113 | }
114 |
115 | if (m_bMax && n > m_nMax)
116 | {
117 | str.Format(L"Please enter an integer number less than or equal to %d", m_nMax);
118 | ErrorMessageBox(str);
119 | return;
120 | }
121 |
122 | m_nValue = n;
123 | m_bIsEmpty = FALSE;
124 |
125 | CAcUiDialog::OnOK();
126 | }
127 |
128 | void CDosGetIntDialog::ErrorMessageBox(LPCTSTR lpMessage)
129 | {
130 | MessageBox(lpMessage, DOS_PlatformName(), MB_ICONEXCLAMATION | MB_OK);
131 | m_Edit.SetFocus();
132 | m_Edit.SetSel(0, -1);
133 | }
134 |
135 | void CDosGetIntDialog::OnChangeEdit()
136 | {
137 | if (m_bAllowEmpty)
138 | return;
139 |
140 | CString str;
141 | m_Edit.GetWindowText(str);
142 | if (str.GetLength() == 0)
143 | m_OK.EnableWindow(FALSE);
144 | else
145 | m_OK.EnableWindow(TRUE);
146 | }
147 |
148 | BOOL CDosGetIntDialog::ParseIntValue(LPCTSTR lpString, int* pValue)
149 | {
150 | CString str1(lpString);
151 | str1.TrimLeft();
152 | str1.TrimRight();
153 |
154 | if (str1.Find('.') != -1)
155 | {
156 | ErrorMessageBox(L"Please enter an integer number.");
157 | return FALSE;
158 | }
159 |
160 | double d = _wtof(lpString);
161 | if (d < -32768.0 || d > 32767.0)
162 | {
163 | ErrorMessageBox(L"Please enter an integer number between -32768 and 32767.");
164 | return FALSE;
165 | }
166 |
167 | int n = (int)_wtof(lpString);
168 |
169 | CString str2;
170 | str2.Format(L"%d", n);
171 |
172 | if (str1.CompareNoCase(str2))
173 | {
174 | ErrorMessageBox(L"Please enter an integer number.");
175 | return FALSE;
176 | }
177 |
178 | *pValue = n;
179 | return TRUE;
180 | }
181 |
182 | LRESULT CDosGetIntDialog::OnNcHitTest(CPoint point)
183 | {
184 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
185 | if (hit == HTCLIENT)
186 | return HTCAPTION;
187 | return hit;
188 | }
189 |
--------------------------------------------------------------------------------
/source/DosGetIntDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetIntDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosGetIntDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosGetIntDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_GETINT };
20 | CButton m_OK;
21 | CEdit m_Edit;
22 |
23 | void SetTitle(LPCTSTR lp) { m_sTitle = lp; };
24 | void SetPrompt(LPCTSTR lp) { m_sPrompt = lp; };
25 | void SetValue(int n = 0) { m_nValue = n; m_bIsEmpty = FALSE; };
26 | void SetAllowEmpty(BOOL b = TRUE) { m_bAllowEmpty = b; };
27 | void SetAllowZero(BOOL b = TRUE) { m_bAllowZero = b; };
28 | void SetAllowNegative(BOOL b = TRUE) { m_bAllowNeg = b; };
29 | void SetMin(int n = 0) { m_nMin = n; m_bMin = TRUE; };
30 | void SetMax(int n = 0) { m_nMax = n; m_bMax = TRUE; };
31 |
32 | int Value() { return m_nValue; };
33 | BOOL IsEmpty() { return m_bIsEmpty; };
34 |
35 | protected:
36 | virtual void DoDataExchange(CDataExchange* pDX);
37 |
38 | protected:
39 | virtual BOOL OnInitDialog();
40 | virtual void OnOK();
41 | afx_msg void OnChangeEdit();
42 | afx_msg LRESULT OnNcHitTest(CPoint point);
43 | DECLARE_MESSAGE_MAP()
44 |
45 | BOOL ParseIntValue(LPCTSTR lpString, int* pValue);
46 | void ErrorMessageBox(LPCTSTR lpMessage);
47 |
48 | CString m_sTitle;
49 | CString m_sPrompt;
50 | int m_nValue;
51 | BOOL m_bIsEmpty;
52 | BOOL m_bAllowEmpty;
53 | BOOL m_bAllowZero;
54 | BOOL m_bAllowNeg;
55 | BOOL m_bMin;
56 | BOOL m_bMax;
57 | int m_nMin;
58 | int m_nMax;
59 | };
60 |
--------------------------------------------------------------------------------
/source/DosGetProgressDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetProgressDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetProgressDialog.h"
14 |
15 | CDosGetProgressDialog::CDosGetProgressDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosGetProgressDialog::IDD, pParent)
17 | {
18 | }
19 |
20 | void CDosGetProgressDialog::DoDataExchange(CDataExchange* pDX)
21 | {
22 | CAcUiDialog::DoDataExchange(pDX);
23 | DDX_Control(pDX, IDCANCEL, m_Cancel);
24 | DDX_Control(pDX, IDC_PROGRESS, m_Progress);
25 | }
26 |
27 | BEGIN_MESSAGE_MAP(CDosGetProgressDialog, CAcUiDialog)
28 | ON_MESSAGE(WM_ACAD_KEEPFOCUS, OnAcadKeepFocus)
29 | ON_WM_NCHITTEST()
30 | END_MESSAGE_MAP()
31 |
32 | BOOL CDosGetProgressDialog::OnInitDialog()
33 | {
34 | SetDialogName(L"DOSLib:GetProgress");
35 |
36 | CAcUiDialog::OnInitDialog();
37 |
38 | LockDialogHeight();
39 | StretchControlX(IDC_PROMPT, 100);
40 | StretchControlX(IDC_PROGRESS, 100);
41 | MoveControlX(IDCANCEL, 50);
42 |
43 | SetWindowText(m_Title);
44 | SetDlgItemText(IDC_PROMPT, m_Prompt);
45 |
46 | m_Progress.SetShowText(TRUE);
47 | m_Progress.SetRange(0, m_nUpper);
48 | m_Progress.SetPos(0);
49 |
50 | // cancel button
51 | //m_Cancel.EnableWindow(m_bCancel);
52 | if (m_bCancel == FALSE)
53 | m_Cancel.ShowWindow(SW_HIDE);
54 |
55 | CenterWindow();
56 |
57 | return TRUE;
58 | }
59 |
60 | void CDosGetProgressDialog::KillDialog()
61 | {
62 | OnCancel();
63 | }
64 |
65 | void CDosGetProgressDialog::OnCancel()
66 | {
67 | DestroyWindow();
68 | }
69 |
70 | LRESULT CDosGetProgressDialog::OnAcadKeepFocus(WPARAM wParam, LPARAM lParam)
71 | {
72 | return TRUE;
73 | }
74 |
75 | void CDosGetProgressDialog::PostNcDestroy()
76 | {
77 | CAcUiDialog::PostNcDestroy();
78 | delete this;
79 | }
80 |
81 | LRESULT CDosGetProgressDialog::OnNcHitTest(CPoint point)
82 | {
83 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
84 | if (hit == HTCLIENT)
85 | return HTCAPTION;
86 | return hit;
87 | }
88 |
--------------------------------------------------------------------------------
/source/DosGetProgressDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetProgressDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosProgressCtrl.h"
15 |
16 | class CDosGetProgressDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosGetProgressDialog(CWnd* pParent);
20 |
21 | enum { IDD = IDD_DOSPROGRESS };
22 | CDosProgressCtrl m_Progress;
23 | CButton m_Cancel;
24 | CString m_Title;
25 | CString m_Prompt;
26 | int m_nUpper;
27 | BOOL m_bCancel;
28 |
29 | void KillDialog();
30 |
31 | protected:
32 | virtual void DoDataExchange(CDataExchange* pDX);
33 | virtual void PostNcDestroy();
34 |
35 | protected:
36 | virtual BOOL OnInitDialog();
37 | virtual void OnCancel();
38 | afx_msg LRESULT OnNcHitTest(CPoint point);
39 | afx_msg LRESULT OnAcadKeepFocus(WPARAM wParam, LPARAM lParam);
40 | DECLARE_MESSAGE_MAP()
41 | };
42 |
--------------------------------------------------------------------------------
/source/DosGetPwdDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetPwdDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetPwdDialog.h"
14 |
15 | CDosGetPwdDialog::CDosGetPwdDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosGetPwdDialog::IDD, pParent)
17 | {
18 | m_Title = L"";
19 | m_Prompt = L"";
20 | m_String = L"";
21 | m_Length = 0;
22 | }
23 |
24 | void CDosGetPwdDialog::DoDataExchange(CDataExchange* pDX)
25 | {
26 | CAcUiDialog::DoDataExchange(pDX);
27 | DDX_Control(pDX, IDOK, m_OK);
28 | DDX_Control(pDX, IDC_EDIT, m_Edit);
29 | }
30 |
31 | BEGIN_MESSAGE_MAP(CDosGetPwdDialog, CAcUiDialog)
32 | ON_EN_CHANGE(IDC_EDIT, OnChangeEdit)
33 | ON_WM_NCHITTEST()
34 | END_MESSAGE_MAP()
35 |
36 | BOOL CDosGetPwdDialog::OnInitDialog()
37 | {
38 | SetDialogName(L"DOSLib:GetPassword");
39 |
40 | CAcUiDialog::OnInitDialog();
41 |
42 | LockDialogHeight();
43 | StretchControlX(IDC_EDIT, 100);
44 |
45 | SetWindowText(m_Title);
46 | SetDlgItemText(IDC_PROMPT, m_Prompt);
47 |
48 | if (m_Length > 0)
49 | m_Edit.SetLimitText(m_Length);
50 | m_Edit.SetWindowText(m_String);
51 | m_Edit.SetFocus();
52 | OnChangeEdit();
53 |
54 | return TRUE;
55 | }
56 |
57 | void CDosGetPwdDialog::OnChangeEdit()
58 | {
59 | CString str;
60 | m_Edit.GetWindowText(str);
61 | if (str.GetLength() == 0)
62 | m_OK.EnableWindow(FALSE);
63 | else
64 | m_OK.EnableWindow(TRUE);
65 | }
66 |
67 | void CDosGetPwdDialog::OnOK()
68 | {
69 | m_Edit.GetWindowText(m_String);
70 | CAcUiDialog::OnOK();
71 | }
72 |
73 | LRESULT CDosGetPwdDialog::OnNcHitTest(CPoint point)
74 | {
75 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
76 | if (hit == HTCLIENT)
77 | return HTCAPTION;
78 | return hit;
79 | }
80 |
--------------------------------------------------------------------------------
/source/DosGetPwdDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetPwdDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosGetPwdDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosGetPwdDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_GETPASSWORD };
20 | CAcUiStringEdit m_Edit;
21 | CButton m_OK;
22 |
23 | CString m_Title;
24 | CString m_Prompt;
25 | CString m_String;
26 | int m_Length;
27 |
28 | protected:
29 | virtual void DoDataExchange(CDataExchange* pDX);
30 |
31 | protected:
32 | virtual BOOL OnInitDialog();
33 | afx_msg void OnChangeEdit();
34 | virtual void OnOK();
35 | afx_msg LRESULT OnNcHitTest(CPoint point);
36 | DECLARE_MESSAGE_MAP()
37 | };
38 |
--------------------------------------------------------------------------------
/source/DosGetRealDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetRealDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetRealDialog.h"
14 |
15 | CDosGetRealDialog::CDosGetRealDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosGetRealDialog::IDD, pParent)
17 | {
18 | m_sTitle = L"";
19 | m_sPrompt = L"";
20 | m_dblValue = 0.0;
21 | m_bIsEmpty = TRUE;
22 | m_bAllowZero = TRUE;
23 | m_bAllowEmpty = TRUE;
24 | m_bAllowNeg = TRUE;
25 | m_bMin = FALSE;
26 | m_bMax = FALSE;
27 | m_dblMin = DBL_MIN;
28 | m_dblMax = DBL_MAX;
29 | }
30 |
31 | void CDosGetRealDialog::DoDataExchange(CDataExchange* pDX)
32 | {
33 | CAcUiDialog::DoDataExchange(pDX);
34 | DDX_Control(pDX, IDOK, m_OK);
35 | DDX_Control(pDX, IDC_EDIT, m_Edit);
36 | }
37 |
38 | BEGIN_MESSAGE_MAP(CDosGetRealDialog, CAcUiDialog)
39 | ON_EN_CHANGE(IDC_EDIT, OnChangeEdit)
40 | ON_WM_NCHITTEST()
41 | END_MESSAGE_MAP()
42 |
43 | BOOL CDosGetRealDialog::OnInitDialog()
44 | {
45 | SetDialogName(L"DOSLib:GetReal");
46 |
47 | CAcUiDialog::OnInitDialog();
48 |
49 | LockDialogHeight();
50 | StretchControlX(IDC_EDIT, 100);
51 |
52 | SetWindowText(m_sTitle);
53 | SetDlgItemText(IDC_PROMPT, m_sPrompt);
54 | if (!m_bAllowEmpty || !m_bIsEmpty)
55 | {
56 | CString s;
57 | s.Format(L"%g", m_dblValue);
58 | m_Edit.SetWindowText(s);
59 | }
60 |
61 | m_Edit.SetFocus();
62 | OnChangeEdit();
63 |
64 | return TRUE;
65 | }
66 |
67 | void CDosGetRealDialog::OnOK()
68 | {
69 | CString s, str;
70 | BOOL bError = FALSE;
71 |
72 | m_Edit.GetWindowText(s);
73 | s.TrimLeft();
74 | s.TrimRight();
75 |
76 | if (s.IsEmpty())
77 | {
78 | if (m_bAllowEmpty)
79 | {
80 | m_bIsEmpty = TRUE;
81 | CAcUiDialog::OnOK();
82 | return;
83 | }
84 | else
85 | {
86 | ErrorMessageBox(L"Please enter a real number.");
87 | return;
88 | }
89 | }
90 |
91 | double d = DOS_UNSET_VALUE;
92 | if (!DOS_FloatParse(s, d))
93 | {
94 | ErrorMessageBox(L"Please enter a real number.");
95 | return;
96 | }
97 |
98 | if (!m_bAllowZero && d == 0.0)
99 | {
100 | ErrorMessageBox(L"Please enter a non-zero real number.");
101 | return;
102 | }
103 |
104 | if (!m_bAllowNeg && d < 0.0)
105 | {
106 | ErrorMessageBox(L"Please enter a positive real number.");
107 | return;
108 | }
109 |
110 | if (m_bMin && d < m_dblMin)
111 | {
112 | str.Format(L"Please enter a real number greater than or equal to %g.", m_dblMin);
113 | ErrorMessageBox(str);
114 | return;
115 | }
116 |
117 | if (m_bMax && d > m_dblMax)
118 | {
119 | str.Format(L"Please enter a real number less than or equal to %g.", m_dblMax);
120 | ErrorMessageBox(str);
121 | return;
122 | }
123 |
124 | m_dblValue = d;
125 | m_bIsEmpty = FALSE;
126 |
127 | CAcUiDialog::OnOK();
128 | }
129 |
130 | void CDosGetRealDialog::ErrorMessageBox(LPCTSTR lpMessage)
131 | {
132 | MessageBox(lpMessage, DOS_PlatformName(), MB_ICONEXCLAMATION | MB_OK);
133 | m_Edit.SetFocus();
134 | m_Edit.SetSel(0, -1);
135 | }
136 |
137 | void CDosGetRealDialog::OnChangeEdit()
138 | {
139 | if (m_bAllowEmpty)
140 | return;
141 |
142 | CString str;
143 | m_Edit.GetWindowText(str);
144 | if (str.GetLength() == 0)
145 | m_OK.EnableWindow(FALSE);
146 | else
147 | m_OK.EnableWindow(TRUE);
148 | }
149 |
150 | BOOL CDosGetRealDialog::ParseRealValue(LPCTSTR lpString, double* pValue)
151 | {
152 | if (0 == lpString || 0 == lpString[0])
153 | {
154 | ErrorMessageBox(L"Please enter a real number.");
155 | return FALSE;
156 | }
157 |
158 | while (*lpString == ' ' || *lpString == '\t')
159 | lpString++;
160 |
161 | errno = 0;
162 | wchar_t* lpEndPtr = 0;
163 | double d = wcstod(lpString, &lpEndPtr);
164 | if (lpString == lpEndPtr || errno == ERANGE)
165 | {
166 | ErrorMessageBox(L"Please enter a real number.");
167 | return FALSE;
168 | }
169 |
170 | if (lpEndPtr)
171 | {
172 | while (*lpEndPtr == ' ' || *lpEndPtr == '\t')
173 | lpEndPtr++;
174 |
175 | if (*lpEndPtr != '\0')
176 | {
177 | ErrorMessageBox(L"Please enter a real number.");
178 | return FALSE;
179 | }
180 | }
181 |
182 | *pValue = d;
183 | return TRUE;
184 | }
185 |
186 | LRESULT CDosGetRealDialog::OnNcHitTest(CPoint point)
187 | {
188 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
189 | if (hit == HTCLIENT)
190 | return HTCAPTION;
191 | return hit;
192 | }
193 |
--------------------------------------------------------------------------------
/source/DosGetRealDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetRealDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosGetRealDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosGetRealDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_GETREAL };
20 | CButton m_OK;
21 | CEdit m_Edit;
22 |
23 | CString m_sTitle;
24 | CString m_sPrompt;
25 |
26 | void SetTitle(LPCTSTR lp) { m_sTitle = lp; };
27 | void SetPrompt(LPCTSTR lp) { m_sPrompt = lp; };
28 | void SetValue(double d = 0.0) { m_dblValue = d; m_bIsEmpty = FALSE; };
29 | void SetAllowEmpty(BOOL b = TRUE) { m_bAllowEmpty = b; };
30 | void SetAllowZero(BOOL b = TRUE) { m_bAllowZero = b; };
31 | void SetAllowNegative(BOOL b = TRUE) { m_bAllowNeg = b; };
32 | void SetMin(double d = DBL_MIN) { m_dblMin = d; m_bMin = TRUE; };
33 | void SetMax(double d = DBL_MAX) { m_dblMax = d; m_bMax = TRUE; };
34 |
35 | double Value() { return m_dblValue; };
36 | BOOL IsEmpty() { return m_bIsEmpty; };
37 |
38 | protected:
39 | virtual void DoDataExchange(CDataExchange* pDX);
40 |
41 | protected:
42 | virtual BOOL OnInitDialog();
43 | virtual void OnOK();
44 | afx_msg void OnChangeEdit();
45 | afx_msg LRESULT OnNcHitTest(CPoint point);
46 | DECLARE_MESSAGE_MAP()
47 |
48 | BOOL ParseRealValue(LPCTSTR lpString, double* pValue);
49 | void ErrorMessageBox(LPCTSTR lpMessage);
50 |
51 | double m_dblValue;
52 | BOOL m_bIsEmpty;
53 | BOOL m_bAllowEmpty;
54 | BOOL m_bAllowZero;
55 | BOOL m_bAllowNeg;
56 | BOOL m_bMin;
57 | BOOL m_bMax;
58 | double m_dblMin;
59 | double m_dblMax;
60 | };
61 |
--------------------------------------------------------------------------------
/source/DosGetStringDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetStringDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosGetStringDialog.h"
14 |
15 | CDosGetStringDialog::CDosGetStringDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosGetStringDialog::IDD, pParent)
17 | {
18 | m_Title = L"";
19 | m_Prompt = L"";
20 | m_String = L"";
21 | m_Length = 0;
22 | }
23 |
24 | void CDosGetStringDialog::DoDataExchange(CDataExchange* pDX)
25 | {
26 | CAcUiDialog::DoDataExchange(pDX);
27 | DDX_Control(pDX, IDOK, m_OK);
28 | DDX_Control(pDX, IDC_EDIT, m_Edit);
29 | }
30 |
31 | BEGIN_MESSAGE_MAP(CDosGetStringDialog, CAcUiDialog)
32 | ON_EN_CHANGE(IDC_EDIT, OnChangeEdit)
33 | ON_WM_NCHITTEST()
34 | END_MESSAGE_MAP()
35 |
36 | BOOL CDosGetStringDialog::OnInitDialog()
37 | {
38 | SetDialogName(L"DOSLib:GetString");
39 |
40 | CAcUiDialog::OnInitDialog();
41 |
42 | LockDialogHeight();
43 | StretchControlX(IDC_EDIT, 100);
44 |
45 | SetWindowText(m_Title);
46 | SetDlgItemText(IDC_PROMPT, m_Prompt);
47 |
48 | if (m_Length > 0)
49 | m_Edit.SetLimitText(m_Length);
50 | m_Edit.SetWindowText(m_String);
51 | m_Edit.SetFocus();
52 | OnChangeEdit();
53 |
54 | return TRUE;
55 | }
56 |
57 | void CDosGetStringDialog::OnChangeEdit()
58 | {
59 | CString str;
60 | m_Edit.GetWindowText(str);
61 | if (str.GetLength() == 0)
62 | m_OK.EnableWindow(FALSE);
63 | else
64 | m_OK.EnableWindow(TRUE);
65 | }
66 |
67 | void CDosGetStringDialog::OnOK()
68 | {
69 | m_Edit.GetWindowText(m_String);
70 | CAcUiDialog::OnOK();
71 | }
72 |
73 | LRESULT CDosGetStringDialog::OnNcHitTest(CPoint point)
74 | {
75 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
76 | if (hit == HTCLIENT)
77 | return HTCAPTION;
78 | return hit;
79 | }
80 |
--------------------------------------------------------------------------------
/source/DosGetStringDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGetStringDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosGetStringDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosGetStringDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_GETSTRING };
20 | CAcUiStringEdit m_Edit;
21 | CButton m_OK;
22 |
23 | CString m_Title;
24 | CString m_Prompt;
25 | CString m_String;
26 | int m_Length;
27 |
28 | protected:
29 | virtual void DoDataExchange(CDataExchange* pDX);
30 |
31 | protected:
32 | virtual BOOL OnInitDialog();
33 | afx_msg void OnChangeEdit();
34 | virtual void OnOK();
35 | afx_msg LRESULT OnNcHitTest(CPoint point);
36 | DECLARE_MESSAGE_MAP()
37 | };
38 |
--------------------------------------------------------------------------------
/source/DosGlyphButton.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosGlyphButton.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | class CDosGlyphButton : public CButton
13 | {
14 | public:
15 | CDosGlyphButton();
16 | virtual ~CDosGlyphButton();
17 |
18 | // Some predefined glyphs from WingDings
19 | enum
20 | {
21 | BTN_DELETE = 0xFB,
22 | BTN_CHECK = 0xFC,
23 | BTN_LEFTARROW = 0xDF,
24 | BTN_RIGHTARROW = 0xE0,
25 | BTN_UPARROW = 0xE1,
26 | BTN_DOWNARROW = 0xE2,
27 | BTN_HOLLOW_LEFTARROW = 0xEF,
28 | BTN_HOLLOW_RIGHTARROW = 0xF0,
29 | BTN_HOLLOW_UPARROW = 0xF1,
30 | BTN_HOLLOW_DOWNARROW = 0xF2
31 | };
32 |
33 | void SetCharSet(BYTE bCharSet);
34 | void SetFaceName(LPCTSTR lpszFaceName);
35 | void SetFont(LOGFONT* plf);
36 | void SetFont(CFont* pFont);
37 | void SetGlyph(UINT cGlyph);
38 | void SetGlyph(LOGFONT* plf, UINT cGlyph);
39 | void SetGlyph(CFont* pFont, UINT cGlyph);
40 | void SetGlyph(LONG lHeight, LONG lPointSize, LONG lWeight, LPCTSTR lpszFaceName, UINT cGlyph);
41 | void SetGlyph(LONG lPointSize, LPCTSTR lpszFaceName, UINT cGlyph);
42 | void SetHeight(LONG lHeight);
43 | void SetPointSize(LONG lPointSize);
44 | void SetWeight(LONG lWeight);
45 | void SetWingDingButton(UINT nButton);
46 |
47 | protected:
48 | virtual void PreSubclassWindow();
49 | afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
50 | DECLARE_MESSAGE_MAP()
51 |
52 | LONG GetFontHeight(LONG nPointSize);
53 | LONG GetFontPointSize(LONG nHeight);
54 | void ReconstructFont();
55 |
56 | LOGFONT m_lf;
57 | UINT m_cGlyph;
58 | CFont m_font;
59 | };
60 |
--------------------------------------------------------------------------------
/source/DosHtmlDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosHtmlDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "webbrowser2.h"
15 |
16 | class CDosHtmlDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosHtmlDialog(CWnd* pParent);
20 | void SetWebAddress(LPCTSTR lpAddress);
21 | void ResizeWindow();
22 |
23 | enum { IDD = IDD_DOSHTMLBOX };
24 | CWebBrowser2 m_webBrowser;
25 |
26 | void SetTitle(LPCTSTR lp) { m_sTitle = lp; };
27 | void SetAddress(LPCTSTR lp) { m_sAddress = lp; };
28 | void SetInitSize(int dx, int dy) { m_dx = dx; m_dy = dy; m_bSize = TRUE; };
29 |
30 | protected:
31 | virtual void DoDataExchange(CDataExchange* pDX);
32 |
33 | protected:
34 | virtual BOOL OnInitDialog();
35 | virtual void OnCancel();
36 | afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
37 | afx_msg void OnSize(UINT nType, int cx, int cy);
38 | afx_msg void OnTitleChangeExplorer(LPCTSTR Text);
39 | afx_msg LRESULT OnNcHitTest(CPoint point);
40 | DECLARE_EVENTSINK_MAP()
41 | DECLARE_MESSAGE_MAP()
42 |
43 | CString m_sTitle;
44 | CString m_sAddress;
45 | BOOL m_bSize;
46 | int m_dx;
47 | int m_dy;
48 | };
49 |
50 | ////////////////////////////////////////////////////////////////
51 |
52 | class CDosModelessHtmlDialog : public CAcUiDialog
53 | {
54 | public:
55 | CDosModelessHtmlDialog(CWnd* pParent);
56 | void SetWebAddress(LPCTSTR lpAddress);
57 | void ResizeWindow();
58 |
59 | enum { IDD = IDD_DOSHTMLBOX };
60 | CWebBrowser2 m_webBrowser;
61 |
62 | void KillDialog();
63 | void SetTitle(LPCTSTR lp) { m_sTitle = lp; };
64 | void SetAddress(LPCTSTR lp) { m_sAddress = lp; };
65 | void SetInitSize(int dx, int dy) { m_dx = dx; m_dy = dy; m_bSize = TRUE; };
66 | void Refresh();
67 |
68 | protected:
69 | virtual void DoDataExchange(CDataExchange* pDX);
70 | virtual void PostNcDestroy();
71 |
72 | protected:
73 | virtual BOOL OnInitDialog();
74 | virtual void OnCancel();
75 | afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
76 | afx_msg void OnSize(UINT nType, int cx, int cy);
77 | afx_msg void OnTitleChangeExplorer(LPCTSTR Text);
78 | afx_msg LRESULT OnNcHitTest(CPoint point);
79 | afx_msg LRESULT OnAcadKeepFocus(WPARAM wParam, LPARAM lParam);
80 | DECLARE_EVENTSINK_MAP()
81 | DECLARE_MESSAGE_MAP()
82 |
83 | CString m_sTitle;
84 | CString m_sAddress;
85 | BOOL m_bSize;
86 | int m_dx;
87 | int m_dy;
88 | };
89 |
--------------------------------------------------------------------------------
/source/DosHtmlDialogEx.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosHtmlDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosHtmlDialogEx.h"
14 |
15 | CDosHtmlDialogEx::CDosHtmlDialogEx(const wchar_t* pszFileName)
16 | {
17 | m_strFileName = pszFileName;
18 | m_strOptions = L"";
19 | }
20 |
21 | CDosHtmlDialogEx::~CDosHtmlDialogEx()
22 | {
23 | }
24 |
25 | bool CDosHtmlDialogEx::DoModal()
26 | {
27 | return DisplayDialog(true);
28 | }
29 |
30 | bool CDosHtmlDialogEx::DoModeless()
31 | {
32 | return DisplayDialog(false);
33 | }
34 |
35 | bool CDosHtmlDialogEx::DisplayDialog(bool bModal)
36 | {
37 | bool rc = false;
38 |
39 | HMODULE hModule = LoadLibrary(L"MSHTML.DLL");
40 | if (0 == hModule)
41 | return rc;
42 |
43 | SHOWHTMLDIALOGEXFN* pfn = (SHOWHTMLDIALOGEXFN*)GetProcAddress(hModule, "ShowHTMLDialogEx");
44 | if (pfn)
45 | {
46 | BSTR bstrFileName = m_strFileName.AllocSysString();
47 |
48 | IMoniker* pMoniker = 0;
49 | CreateURLMoniker(0, bstrFileName, &pMoniker);
50 | if (pMoniker)
51 | {
52 | HWND hWnd = adsw_acadMainWnd();
53 | DWORD dwFlags = (bModal) ? HTMLDLG_MODAL | HTMLDLG_VERIFY : HTMLDLG_MODELESS | HTMLDLG_VERIFY;
54 |
55 | HRESULT hr = S_OK;
56 | if (m_strOptions.IsEmpty())
57 | {
58 | hr = pfn(hWnd, pMoniker, dwFlags, &m_vaArgs, 0, &m_vaResult);
59 | }
60 | else
61 | {
62 | BSTR bstrOptions = m_strOptions.AllocSysString();
63 | hr = pfn(hWnd, pMoniker, dwFlags, &m_vaArgs, bstrOptions, &m_vaResult);
64 | SysFreeString(bstrOptions);
65 | }
66 |
67 | pMoniker->Release();
68 |
69 | rc = (SUCCEEDED(hr)) ? true : false;
70 | }
71 |
72 | SysFreeString(bstrFileName);
73 | }
74 |
75 | FreeLibrary(hModule);
76 |
77 | return rc;
78 | }
79 |
80 | void CDosHtmlDialogEx::SetArguments(const VARIANT& vaArgs)
81 | {
82 | m_vaArgs = vaArgs;
83 | }
84 |
85 | void CDosHtmlDialogEx::SetOptions(const wchar_t* pszOptions)
86 | {
87 | if (pszOptions)
88 | m_strOptions = pszOptions;
89 | }
90 |
91 | VARIANT CDosHtmlDialogEx::GetResult()
92 | {
93 | return m_vaResult.Detach();
94 | }
95 |
--------------------------------------------------------------------------------
/source/DosHtmlDialogEx.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosHtmlDialogEx.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosHtmlDialogEx
15 | {
16 | public:
17 | CDosHtmlDialogEx(const wchar_t* pszFileName);
18 | virtual ~CDosHtmlDialogEx();
19 |
20 | void SetArguments(const VARIANT& vaArgs);
21 | void SetOptions(const wchar_t* pszOptions);
22 |
23 | bool DoModal();
24 | bool DoModeless();
25 |
26 | VARIANT GetResult();
27 |
28 | protected:
29 | bool DisplayDialog(bool bModal);
30 |
31 | protected:
32 | COleVariant m_vaArgs;
33 | COleVariant m_vaResult;
34 | CString m_strFileName;
35 | CString m_strOptions;
36 | };
37 |
--------------------------------------------------------------------------------
/source/DosInPlaceCtrls.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosInPlaceCtrls.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosInPlace
15 | {
16 | public:
17 | static LPCTSTR MsgString();
18 |
19 | enum
20 | {
21 | ipek_key = 1,
22 | ipek_action = 2,
23 | ipek_focus = 3
24 | };
25 |
26 | typedef struct tagIPCENDEDITINFO
27 | {
28 | HWND hwndSrc; // Event source
29 | UINT uKind; // Event (key press, focus change, etc )
30 | union
31 | {
32 | UINT uID; // Control ID (for actions)
33 | UINT nVirtKey; // Virtual key
34 | HWND hNewWnd; // New window with focus
35 | };
36 | POINT pt; // Event point, in screen coordinates
37 | } IPCENDEDITINFO, FAR *LPIPCENDEDITINFO;
38 |
39 | static UINT const m_IPCMsg;
40 | };
41 |
42 |
43 | class CDosInPlaceEdit : public CEdit
44 | {
45 | DECLARE_DYNCREATE(CDosInPlaceEdit)
46 |
47 | public:
48 | CDosInPlaceEdit();
49 | virtual ~CDosInPlaceEdit();
50 |
51 | void Show(CRect rcEdit);
52 | void Hide();
53 |
54 | private:
55 | HWND m_hParent;
56 |
57 | public:
58 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
59 | afx_msg void OnKillFocus(CWnd *pNewWnd);
60 | afx_msg UINT OnGetDlgCode();
61 | afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
62 |
63 | protected:
64 | DECLARE_MESSAGE_MAP()
65 |
66 | public:
67 | virtual BOOL PreTranslateMessage(MSG* pMsg);
68 |
69 | protected:
70 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
71 | };
72 |
73 | class CDosInPlaceButton : public CButton
74 | {
75 | DECLARE_DYNCREATE(CDosInPlaceButton)
76 |
77 | public:
78 | CDosInPlaceButton();
79 | virtual ~CDosInPlaceButton();
80 |
81 | void Show(CRect rcButton);
82 | void Hide();
83 |
84 | private:
85 | HWND m_hParent;
86 | BOOL m_bInAction;
87 |
88 | private:
89 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
90 | afx_msg void OnKillFocus(CWnd *pNewWnd);
91 | afx_msg void OnClick();
92 |
93 | protected:
94 | DECLARE_MESSAGE_MAP()
95 |
96 | public:
97 | virtual BOOL PreTranslateMessage(MSG* pMsg);
98 |
99 | protected:
100 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
101 | };
102 |
--------------------------------------------------------------------------------
/source/DosInterDragListBox.cpp:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | // DosInterDragListBox.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "stdafx.h"
13 | #include "DosInterDragListBox.h"
14 |
15 | IMPLEMENT_DYNAMIC(CDosInterDragListBox, CDosDragListBox)
16 |
17 | CDosInterDragListBox::CDosInterDragListBox()
18 | {
19 | m_hTargetList = 0;
20 | }
21 |
22 | CDosInterDragListBox::~CDosInterDragListBox()
23 | {
24 | }
25 |
26 | BEGIN_MESSAGE_MAP(CDosInterDragListBox, CDosDragListBox)
27 | END_MESSAGE_MAP()
28 |
29 | CDosInterDragListBox* CDosInterDragListBox::ListFromPoint(CPoint point)
30 | {
31 | CWnd* pWnd = WindowFromPoint(point);
32 | return DYNAMIC_DOWNCAST(CDosInterDragListBox, pWnd);
33 | }
34 |
35 | void CDosInterDragListBox::EraseTarget()
36 | {
37 | if (m_hTargetList)
38 | {
39 | CWnd* pTarget = FromHandle(m_hTargetList);
40 | if (pTarget)
41 | {
42 | CDosInterDragListBox* pList = DYNAMIC_DOWNCAST(CDosInterDragListBox, pTarget);
43 | if (pList)
44 | {
45 | pList->EraseInsert();
46 | pList->EndScroll();
47 | }
48 | }
49 | m_hTargetList = 0;
50 | }
51 | }
52 |
53 | UINT CDosInterDragListBox::Dragging(CPoint point)
54 | {
55 | UINT retc = 0;
56 | HWND hTarget = 0;
57 | CDosInterDragListBox* pList = ListFromPoint(point);
58 | if (pList == this)
59 | {
60 | hTarget = m_hWnd;
61 | retc = CDosDragListBox::Dragging(point);
62 | }
63 | else
64 | {
65 | if (pList)
66 | {
67 | hTarget = pList->m_hWnd;
68 | pList->Dragging(point);
69 | }
70 | else
71 | {
72 | hTarget = 0;
73 | SetCursor(LoadCursor(0, IDC_NO));
74 | }
75 | retc = DL_CURSORSET;
76 | }
77 |
78 | if (hTarget != m_hTargetList)
79 | {
80 | EraseTarget();
81 | m_hTargetList = hTarget;
82 | }
83 |
84 | return retc;
85 | }
86 |
87 | void CDosInterDragListBox::Dropped(CPoint point)
88 | {
89 | CDosInterDragListBox *pList = ListFromPoint(point);
90 | if (pList == this)
91 | {
92 | CDosDragListBox::Dropped(point);
93 | }
94 | else
95 | {
96 | if (pList)
97 | {
98 | int nInsertPos = pList->GetInsertPos(point);
99 | MoveSelectedItems(pList, nInsertPos);
100 | }
101 | }
102 | }
103 |
104 | void CDosInterDragListBox::EndDrag()
105 | {
106 | CDosDragListBox::EndDrag();
107 | EraseTarget();
108 | }
109 |
110 | void CDosInterDragListBox::MoveSelectedItems(CDosInterDragListBox* pToList, int nInsertPos)
111 | {
112 | if (pToList)
113 | {
114 | int nTop = GetTopIndex();
115 | CStringArray ItemText;
116 | CDWordArray ItemData;
117 | int nPos = 0;
118 | GetSelectedItems(ItemText, ItemData, nPos);
119 | pToList->PasteItems(ItemText, ItemData, nInsertPos);
120 | SetTopIndex(nTop);
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/source/DosInterDragListBox.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosInterDragListBox.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosDragListBox.h"
15 |
16 | class CDosInterDragListBox : public CDosDragListBox
17 | {
18 | DECLARE_DYNAMIC(CDosInterDragListBox)
19 |
20 | public:
21 | CDosInterDragListBox();
22 | virtual ~CDosInterDragListBox();
23 |
24 | virtual UINT Dragging(CPoint point);
25 | virtual void Dropped(CPoint point);
26 | virtual void EndDrag();
27 |
28 | void MoveSelectedItems(CDosInterDragListBox* pToList, int nInsertPos);
29 |
30 | protected:
31 | DECLARE_MESSAGE_MAP()
32 |
33 | HWND m_hTargetList; // window handle of target foreign list
34 | CDosInterDragListBox* ListFromPoint(CPoint point);
35 | void EraseTarget();
36 | };
37 |
--------------------------------------------------------------------------------
/source/DosLayerListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosLayerListDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosColorListBox.h"
15 |
16 | class CDosLayerListDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosLayerListDialog(CWnd* pParent);
20 |
21 | //{{AFX_DATA(CDosLayerListDialog)
22 | enum { IDD = IDD_DOSLAYERLISTBOX };
23 | CDosColorListBox m_listbox;
24 | CButton m_ok;
25 |
26 | //}}AFX_DATA
27 | CString m_layer;
28 | CStringArray m_layers;
29 |
30 | void SetTitle(LPCTSTR lp);
31 | void SetPrompt(LPCTSTR lp);
32 |
33 | bool MultipleSelection();
34 | void SetMultipleSelection(bool b = true);
35 |
36 | void HideOnLayers(bool b = true);
37 | void HideOffLayers(bool b = true);
38 | void HideUnlockedLayers(bool b = true);
39 | void HideLockedLayers(bool b = true);
40 | void HideThawedLayers(bool b = true);
41 | void HideFrozenLayers(bool b = true);
42 | void HideStdLayers(bool b = true);
43 | void HideXrefLayers(bool b = true);
44 | void HidePlotLayers(bool b = true);
45 | void HideNoPlotLayers(bool b = true);
46 | void HideUsedLayers(bool b = true);
47 | void HideUnusedLayers(bool b = true);
48 |
49 | //{{AFX_VIRTUAL(CDosLayerListDialog)
50 | protected:
51 | virtual void DoDataExchange(CDataExchange* pDX);
52 | //}}AFX_VIRTUAL
53 |
54 | protected:
55 | void FillListBox();
56 | BOOL RecreateListBox(CListBox* pList, LPVOID lpParam = NULL);
57 |
58 | bool ProcessLayers();
59 | bool GetLayerName(const AcDbObjectId& id, CString& strName);
60 |
61 | bool IsUsedLayer(const wchar_t* name);
62 | bool IsUnusedLayer(const wchar_t* name);
63 |
64 | //{{AFX_MSG(CDosLayerListDialog)
65 | virtual BOOL OnInitDialog();
66 | afx_msg void OnSelChangeList();
67 | afx_msg void OnDblClkList();
68 | virtual void OnOK();
69 | //}}AFX_MSG
70 | DECLARE_MESSAGE_MAP()
71 |
72 | CString m_title;
73 | CString m_prompt;
74 |
75 | bool m_hide_on_layers;
76 | bool m_hide_off_layers;
77 |
78 | bool m_hide_unlocked_layers;
79 | bool m_hide_locked_layers;
80 |
81 | bool m_hide_thawed_layers;
82 | bool m_hide_frozen_layers;
83 |
84 | bool m_hide_std_layers;
85 | bool m_hide_xref_layers;
86 |
87 | bool m_hide_plot_layers;
88 | bool m_hide_noplot_layers;
89 |
90 | bool m_multiple_selection;
91 |
92 | bool m_hide_used_layers;
93 | bool m_hide_unused_layers;
94 |
95 | CStringArray m_used_layer_names;
96 | CStringArray m_unused_layer_names;
97 | };
98 |
99 | //{{AFX_INSERT_LOCATION}}
100 |
--------------------------------------------------------------------------------
/source/DosListBoxDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosListBoxDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosListBoxDialog.h"
14 |
15 | CDosListBoxDialog::CDosListBoxDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosListBoxDialog::IDD, pParent)
17 | {
18 | m_Val = L"";
19 | }
20 |
21 | void CDosListBoxDialog::DoDataExchange(CDataExchange* pDX)
22 | {
23 | CAcUiDialog::DoDataExchange(pDX);
24 | DDX_Control(pDX, IDC_LIST, m_List);
25 | DDX_LBString(pDX, IDC_LIST, m_Val);
26 | }
27 |
28 | BEGIN_MESSAGE_MAP(CDosListBoxDialog, CAcUiDialog)
29 | ON_LBN_DBLCLK(IDC_LIST, OnDblclkList)
30 | ON_WM_NCHITTEST()
31 | END_MESSAGE_MAP()
32 |
33 | BOOL CDosListBoxDialog::OnInitDialog()
34 | {
35 | SetDialogName(L"DOSLib:ListBox");
36 |
37 | CAcUiDialog::OnInitDialog();
38 |
39 | StretchControlX(IDC_PROMPT, 100);
40 | StretchControlXY(IDC_LIST, 100, 100);
41 | MoveControlX(IDOK, 100);
42 | MoveControlX(IDCANCEL, 100);
43 |
44 | SetWindowText(m_Title);
45 | SetDlgItemText(IDC_PROMPT, m_Prompt);
46 |
47 | int i;
48 | for (i = 0; i < m_StrArray.GetCount(); i++)
49 | m_List.AddString(m_StrArray[i]);
50 |
51 | int n = m_List.SelectString(-1, m_Default);
52 | if (n == CB_ERR)
53 | m_List.SetCurSel(0);
54 |
55 | return TRUE;
56 | }
57 |
58 | void CDosListBoxDialog::OnDblclkList()
59 | {
60 | OnOK();
61 | return;
62 | }
63 |
64 | void CDosListBoxDialog::OnOK()
65 | {
66 | CAcUiDialog::OnOK();
67 | }
68 |
69 | LRESULT CDosListBoxDialog::OnNcHitTest(CPoint point)
70 | {
71 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
72 | if (hit == HTCLIENT)
73 | return HTCAPTION;
74 | return hit;
75 | }
76 |
--------------------------------------------------------------------------------
/source/DosListBoxDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosListBoxDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosListBoxDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosListBoxDialog(CWnd* pParent);
18 |
19 | enum { IDD = IDD_DOSLISTBOX };
20 | CListBox m_List;
21 | CString m_Val;
22 | CString m_Title;
23 | CString m_Prompt;
24 | CString m_Default;
25 | CStringArray m_StrArray;
26 |
27 | protected:
28 | virtual void DoDataExchange(CDataExchange* pDX);
29 |
30 | protected:
31 | virtual BOOL OnInitDialog();
32 | afx_msg void OnDblclkList();
33 | virtual void OnOK();
34 | afx_msg LRESULT OnNcHitTest(CPoint point);
35 | DECLARE_MESSAGE_MAP()
36 | };
37 |
--------------------------------------------------------------------------------
/source/DosListBoxEx.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosListBoxEx.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosListBoxExBuddy;
15 | class CDosInPlaceEdit;
16 | class CDosInPlaceButton;
17 |
18 | class CDosListBoxEx : public CDragListBox
19 | {
20 | DECLARE_DYNCREATE(CDosListBoxEx)
21 |
22 | public:
23 | CDosListBoxEx();
24 | virtual ~CDosListBoxEx();
25 |
26 | enum
27 | {
28 | LBEX_EDITBUTTON = 0x4000L
29 | };
30 |
31 | void AllowEditing(BOOL bAllowEditing = TRUE) { m_bAllowEditing = bAllowEditing; }
32 | void AllowDrag(BOOL bAllowDrag = TRUE) { m_bAllowDrag = bAllowDrag; }
33 |
34 | void BeginEditing(int iItem);
35 | void EndEditing(BOOL fCancel);
36 |
37 | void EditNew();
38 | void SetEditStyle(DWORD dwEditStyle);
39 | HWND GetEditHandle() const;
40 | void SetEditText(const CString& strNewText) const;
41 |
42 | int MoveItemUp(int iItem);
43 | int MoveItemDown(int iItem);
44 | void SwapItems(int iFirstItem, int iSecondItem);
45 | void SetItem(int iItem, LPCTSTR szItemText, DWORD_PTR dwItemData);
46 | void SetItemText(int iItem, LPCTSTR szItemText);
47 |
48 | private:
49 | void CreateEdit();
50 | UINT ListBoxExStyleFlags() const;
51 | UINT ListBoxExStyleFlagsEX() const;
52 | BOOL AltKeyPressed(UINT uFlag) const;
53 |
54 | private:
55 | enum
56 | {
57 | LBEX_ID_EDITCONTROL = 1,
58 | LBEX_ID_BUTTONCONTROL = 2,
59 | LBEX_LASTITEM_MAGIC = 0x45424558 // 'LBEX'
60 | };
61 |
62 | private:
63 | static UINT const m_DragListMsg;
64 | static UINT const m_IPCEndEditMsg;
65 | CDosListBoxExBuddy* m_pBuddy;
66 | DWORD m_dwEditStyle;
67 | CDosInPlaceEdit* m_pEdit;
68 | CDosInPlaceButton* m_pBrowseButton;
69 | CRect m_rcEdit;
70 | CRect m_rcButton;
71 | int m_iSelected;
72 | int m_iEdited;
73 | BOOL m_bAllowEditing;
74 | BOOL m_bAllowDrag;
75 |
76 | public:
77 | virtual BOOL OnBeginEditing(int iItem);
78 | virtual BOOL OnEndEditing(int iItem, BOOL fCanceled);
79 | virtual void OnBrowseButton(int iItem);
80 | virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
81 |
82 | protected:
83 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
84 | virtual void PreSubclassWindow();
85 | virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
86 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
87 | virtual void DrawInsert(int nIndex);
88 | void DrawSeparator(int nIndex);
89 |
90 | protected:
91 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
92 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
93 | afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
94 | afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
95 | afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
96 | afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
97 | afx_msg LRESULT OnEndEditMessage(WPARAM wParam, LPARAM lParam);
98 | DECLARE_MESSAGE_MAP()
99 | };
100 |
101 | class CDosListBoxExBuddy : public CWnd
102 | {
103 | public:
104 | CDosListBoxExBuddy(UINT nBitmapID);
105 | virtual ~CDosListBoxExBuddy();
106 |
107 | enum
108 | {
109 | bmp_width = 88,
110 | bmp_height = 20,
111 | bmp_btnwidth = 22,
112 | btn_new = 0,
113 | btn_del = 1,
114 | btn_up = 2,
115 | btn_down = 3,
116 | bmp_numbtn = 4
117 | };
118 |
119 | void SetListBox(CDosListBoxEx *pListBox) { m_pListBoxEx = pListBox; }
120 |
121 | protected:
122 | virtual void PreSubclassWindow();
123 | virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
124 | afx_msg void OnPaint();
125 | afx_msg void OnMouseMove(UINT nFlags, CPoint point);
126 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
127 | afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
128 | afx_msg void OnSize(UINT nType, int cx, int cy);
129 | afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
130 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
131 | DECLARE_MESSAGE_MAP()
132 |
133 | private:
134 | void CreateTooltips();
135 | void SetTipText(UINT nID, LPTSTR szTipText);
136 | int FindButton(const CPoint& point);
137 | void InvalidateButton(int iIndex, BOOL bUpdateWindow = TRUE);
138 | void DoClick(int iIndex);
139 |
140 | private:
141 | CDosListBoxEx* m_pListBoxEx;
142 | CBitmap m_ButtonBitmap;
143 | UINT m_iButton;
144 | BOOL m_bButtonPressed;
145 | CRect m_arcButtons[bmp_numbtn];
146 | CToolTipCtrl m_ToolTip;
147 | HBITMAP m_hBitmap;
148 | };
149 |
--------------------------------------------------------------------------------
/source/DosLoadLibrary.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosLoadLibrary.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosLoadLibrary.h"
14 |
15 | CDosLoadLibrary::CDosLoadLibrary()
16 | : m_hInst(0)
17 | {
18 | }
19 |
20 | CDosLoadLibrary::CDosLoadLibrary(const wchar_t* pszLibName)
21 | : m_hInst(0)
22 | {
23 | Load(pszLibName);
24 | }
25 |
26 | CDosLoadLibrary::~CDosLoadLibrary()
27 | {
28 | Free();
29 | }
30 |
31 | CDosLoadLibrary::operator HINSTANCE() const
32 | {
33 | return m_hInst;
34 | }
35 |
36 | HINSTANCE CDosLoadLibrary::Detach()
37 | {
38 | HINSTANCE hInst = m_hInst;
39 | m_hInst = 0;
40 | return hInst;
41 | }
42 |
43 | bool CDosLoadLibrary::Load(const wchar_t* pszLibName, DWORD dwFlags)
44 | {
45 | Free();
46 | if (pszLibName && pszLibName[0])
47 | m_hInst = ::LoadLibraryEx(pszLibName, 0, dwFlags);
48 | return IsLoaded();
49 | }
50 |
51 | void CDosLoadLibrary::Free()
52 | {
53 | if (IsLoaded())
54 | {
55 | ::FreeLibrary(m_hInst);
56 | m_hInst = 0;
57 | }
58 | }
59 |
60 | bool CDosLoadLibrary::IsLoaded() const
61 | {
62 | return (m_hInst != 0);
63 | }
64 |
65 | FARPROC CDosLoadLibrary::ProcAddress(const char* pszFuncName) const
66 | {
67 | if (IsLoaded())
68 | {
69 | if (pszFuncName && pszFuncName[0])
70 | return ::GetProcAddress(m_hInst, pszFuncName);
71 | }
72 | return 0;
73 | }
74 |
75 | bool CDosLoadLibrary::ModuleFileName(CString& filename) const
76 | {
77 | bool rc = false;
78 | if (IsLoaded())
79 | {
80 | wchar_t szFileName[MAX_PATH];
81 | if (::GetModuleFileName(m_hInst, szFileName, MAX_PATH))
82 | {
83 | filename = szFileName;
84 | rc = true;
85 | }
86 | }
87 | return rc;
88 | }
89 |
90 | bool CDosLoadLibrary::IsDataFile() const
91 | {
92 | if (IsLoaded())
93 | return (((ULONG_PTR)(m_hInst)) & (ULONG_PTR)1) ? true : false;
94 | return false;
95 | }
96 |
97 | bool CDosLoadLibrary::IsImageMapping() const
98 | {
99 | if (IsLoaded())
100 | return (((ULONG_PTR)(m_hInst)) & (ULONG_PTR)2) ? true : false;
101 | return false;
102 | }
103 |
104 | bool CDosLoadLibrary::IsResource() const
105 | {
106 | if (IsLoaded())
107 | return (IsDataFile() || IsImageMapping()) ? true : false;
108 | return false;
109 | }
110 |
--------------------------------------------------------------------------------
/source/DosLoadLibrary.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosLoadLibrary.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosLoadLibrary
15 | {
16 | public:
17 | CDosLoadLibrary();
18 | CDosLoadLibrary(const wchar_t* pszLibName);
19 | ~CDosLoadLibrary();
20 |
21 | /*
22 | Description:
23 | Wrapper member for Win32 LoadLibraryEx() function.
24 | */
25 | bool Load(const wchar_t* pszLibName, DWORD dwFlags = 0);
26 |
27 | /*
28 | Description:
29 | Wrapper member for Win32 FreeLibrary() function.
30 | */
31 | void Free();
32 |
33 | /*
34 | Description:
35 | Verifies that a module has been loaded.
36 | */
37 | bool IsLoaded() const;
38 |
39 | /*
40 | Description:
41 | Wrapper member for Win32 GetProcAddress() function.
42 | */
43 | FARPROC ProcAddress(const char* pszFuncName) const;
44 |
45 | /*
46 | Description:
47 | Wrapper member for Win32 GetModuleFileName() function.
48 | */
49 | bool ModuleFileName(CString& filename) const;
50 |
51 | /*
52 | Description:
53 | Cast operator, returns the handle to the loaded module.
54 | */
55 | operator HINSTANCE() const;
56 |
57 | /*
58 | Description:
59 | Detaches the handle to the loaded module. Caller responsible
60 | for calling FreeLibrary on returned instance handle.
61 | */
62 | HINSTANCE Detach();
63 |
64 | /*
65 | Description:
66 | Returns true if the module was loaded with
67 | LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE.
68 | */
69 | bool IsDataFile() const;
70 |
71 | /*
72 | Description:
73 | Returns true if the module was loaded with
74 | LOAD_LIBRARY_AS_IMAGE_RESOURCE.
75 | */
76 | bool IsImageMapping() const;
77 |
78 | /*
79 | Description:
80 | Returns true if the module was loaded with
81 | LOAD_LIBRARY_AS_IMAGE_RESOURCE or either
82 | LOAD_LIBRARY_AS_DATAFILE or LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE.
83 | */
84 | bool IsResource() const;
85 |
86 | private:
87 | // no copy constructor
88 | CDosLoadLibrary(const CDosLoadLibrary&);
89 | // no operator=
90 | CDosLoadLibrary& operator=(const CDosLoadLibrary&);
91 |
92 | private:
93 | HINSTANCE m_hInst; // handle to the loaded module
94 | };
--------------------------------------------------------------------------------
/source/DosMemDC.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosMemDC.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosMemDC.h"
14 |
15 | CDosMemDC::CDosMemDC(CDC* pDC, const CRect* pRect)
16 | : m_pDC(pDC)
17 | , m_bMemDC(false)
18 | , m_oldBitmap(0)
19 | , m_crMask(DOS_UNSET_COLOR)
20 | {
21 | ASSERT(pDC != 0);
22 |
23 | // Some initialization
24 | if (pDC)
25 | m_bMemDC = !pDC->IsPrinting();
26 |
27 | // Get the rectangle to draw
28 | if (0 == pRect)
29 | pDC->GetClipBox(&m_rect);
30 | else
31 | m_rect = *pRect;
32 |
33 | if (m_bMemDC)
34 | {
35 | CreateCompatibleDC(pDC);
36 | pDC->LPtoDP(&m_rect);
37 | m_bitmap.CreateCompatibleBitmap(pDC, m_rect.Width(), m_rect.Height());
38 | m_oldBitmap = SelectObject(&m_bitmap);
39 | SetMapMode(pDC->GetMapMode());
40 | SetWindowExt(pDC->GetWindowExt());
41 | SetViewportExt(pDC->GetViewportExt());
42 | pDC->DPtoLP(&m_rect);
43 | SetWindowOrg(m_rect.left, m_rect.top);
44 | }
45 | else
46 | {
47 | m_bPrinting = pDC->m_bPrinting;
48 | m_hDC = pDC->m_hDC;
49 | m_hAttribDC = pDC->m_hAttribDC;
50 | }
51 |
52 | FillSolidRect(m_rect, pDC->GetBkColor());
53 | }
54 |
55 | CDosMemDC::~CDosMemDC()
56 | {
57 | if (m_bMemDC)
58 | {
59 | if (DOS_UNSET_COLOR == m_crMask)
60 | m_pDC->BitBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
61 | this, m_rect.left, m_rect.top, SRCCOPY);
62 | else
63 | m_pDC->TransparentBlt(m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
64 | this, m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(),
65 | m_crMask);
66 | SelectObject(m_oldBitmap);
67 | }
68 | else
69 | {
70 | m_hDC = m_hAttribDC = 0;
71 | }
72 | }
73 |
74 | COLORREF CDosMemDC::MaskingColor() const
75 | {
76 | return m_crMask;
77 | }
78 |
79 | void CDosMemDC::SetMaskingColor(COLORREF cr)
80 | {
81 | m_crMask = cr;
82 | }
83 |
84 | CDosMemDC* CDosMemDC::operator->()
85 | {
86 | return this;
87 | }
88 |
89 | CDosMemDC::operator CDosMemDC*()
90 | {
91 | return this;
92 | }
--------------------------------------------------------------------------------
/source/DosMemDC.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosMemDC.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #define DOS_UNSET_COLOR 0xFFFFFFFF
15 |
16 | class CDosMemDC : public CDC
17 | {
18 | public:
19 | CDosMemDC(CDC* pDC, const CRect* pRect = 0);
20 | ~CDosMemDC();
21 |
22 | CDosMemDC* operator->();
23 | operator CDosMemDC*();
24 |
25 | COLORREF MaskingColor() const;
26 | void SetMaskingColor(COLORREF cr);
27 |
28 | private:
29 | CBitmap m_bitmap; // Offscreen bitmap
30 | CBitmap* m_oldBitmap; // Bitmap originally found in CDosMemDC
31 | CDC* m_pDC; // Saves CDC passed in constructor
32 | CRect m_rect; // Rectangle of drawing area.
33 | bool m_bMemDC; // True if CDC really is a memory DC.
34 | COLORREF m_crMask; // If set to DOS_UNSET_COLOR the destructor will bit blit the bitmap to
35 | // m_pDC. If set to a color other than DOS_UNSET_COLOR then the bitmap
36 | // will transparent blit to m_pDC using m_crMask as the masking color.
37 | };
38 |
--------------------------------------------------------------------------------
/source/DosMessageBox.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosMessageBox.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosMessageBox.h"
14 |
15 | int CDosMessageBox::DoMessageBox()
16 | {
17 | if (!m_uTimeOut)
18 | return MessageBox(m_hWnd, m_lpText, m_lpCaption, m_uType);
19 | return TimedOutMessageBox();
20 | }
21 |
22 | int CDosMessageBox::DoMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, UINT uTimeOut, BOOL bShowTimeOut)
23 | {
24 | if (!uTimeOut)
25 | return MessageBox(hWnd, lpText, lpCaption, uType);
26 |
27 | m_hWnd = hWnd;
28 | m_lpText = lpText;
29 | m_lpCaption = lpCaption;
30 | m_uType = uType;
31 | m_uTimeOut = uTimeOut;
32 | m_bShowTimeOut = bShowTimeOut;
33 |
34 | return TimedOutMessageBox();
35 | }
36 |
37 | int CDosMessageBox::TimedOutMessageBox()
38 | {
39 | DWORD dwThreadId = 0;
40 | HANDLE hThread = CreateThread(NULL, 0, ThreadFunction, (LPVOID)this, 0, &dwThreadId);
41 | if (0 == hThread)
42 | return -1;
43 |
44 | if (m_bShowTimeOut)
45 | swprintf(m_szTimeOutCaption, L"%s, time remaining: %d", m_lpCaption, (int)(m_uTimeOut / 1000));
46 | else
47 | wcscpy(m_szTimeOutCaption, m_lpCaption);
48 |
49 | m_nResult = MessageBox(m_hWnd, m_lpText, m_szTimeOutCaption, m_uType);
50 |
51 | WaitForSingleObject(hThread, INFINITE);
52 | CloseHandle(hThread);
53 |
54 | if (m_bTimeOut)
55 | return 0;
56 |
57 | return m_nResult;
58 | }
59 |
60 |
61 | DWORD WINAPI CDosMessageBox::ThreadFunction(LPVOID lpParameter)
62 | {
63 | TCHAR szBuffer[_MAX_PATH];
64 |
65 | if (lpParameter)
66 | {
67 | CDosMessageBox* pObject = static_cast(lpParameter);
68 | if (pObject)
69 | {
70 | DWORD dwInitTime = GetTickCount();
71 | DWORD dwStartTime = dwInitTime;
72 | while (!pObject->m_nResult)
73 | {
74 | DWORD dwCurrentTime = GetTickCount();
75 | DWORD dwDeltaTime = dwCurrentTime - dwStartTime;
76 | if (dwDeltaTime >= 1000)
77 | {
78 | if ((dwCurrentTime - dwInitTime) >= pObject->m_uTimeOut)
79 | {
80 | pObject->m_bTimeOut = TRUE;
81 | PostMessage(FindWindow(0, pObject->m_szTimeOutCaption), WM_CLOSE, 0, 0);
82 | return WAIT_OBJECT_0;
83 | }
84 |
85 | if (pObject->m_bShowTimeOut)
86 | {
87 | HWND hWnd = FindWindow(0, pObject->m_szTimeOutCaption);
88 | if (hWnd)
89 | {
90 | int nCaptionLen = (int)wcslen(pObject->m_szTimeOutCaption);
91 | int nMarker = nCaptionLen;
92 |
93 | while (pObject->m_szTimeOutCaption[nMarker] != 32)
94 | nMarker--;
95 |
96 | int val = (int)ceil((double)((pObject->m_uTimeOut - (dwCurrentTime - dwInitTime))) / 1000);
97 | _itow(val, szBuffer, 10);
98 |
99 | memcpy(&pObject->m_szTimeOutCaption[nMarker + 1], szBuffer, wcslen(szBuffer) + 1);
100 | SetWindowText(hWnd, pObject->m_szTimeOutCaption);
101 | }
102 | }
103 |
104 | dwStartTime = GetTickCount();
105 | }
106 |
107 | Sleep(5);
108 | }
109 | }
110 | }
111 |
112 | return WAIT_OBJECT_0;
113 | }
114 |
115 |
116 |
--------------------------------------------------------------------------------
/source/DosMessageBox.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosMessageBox.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosMessageBox
15 | {
16 | public:
17 | CDosMessageBox()
18 | {
19 | m_bTimeOut = FALSE;
20 | m_nResult = 0;
21 | memset(m_szTimeOutCaption, 0, sizeof(m_szTimeOutCaption) / sizeof(TCHAR));
22 | };
23 |
24 | CDosMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, UINT uTimeOut, BOOL bShowTimeOut = TRUE)
25 | {
26 | m_hWnd = hWnd;
27 | m_lpText = lpText;
28 | m_lpCaption = lpCaption;
29 | m_uType = uType;
30 | m_uTimeOut = uTimeOut;
31 | m_bTimeOut = FALSE;
32 | m_nResult = 0;
33 | m_bShowTimeOut = bShowTimeOut;
34 | memset(m_szTimeOutCaption, 0, sizeof(m_szTimeOutCaption) / sizeof(TCHAR));
35 | };
36 |
37 | virtual ~CDosMessageBox() {}
38 |
39 | private:
40 | LPCTSTR m_lpCaption; // Original caption
41 | LPCTSTR m_lpText; // Original text
42 | UINT m_uType; // MessageBox type ( MB_OK ..... )
43 | HWND m_hWnd; // Descriptor of parent window
44 | UINT m_uTimeOut; // Timeout in milliseconds
45 | BOOL m_bTimeOut; // Is timeout reached
46 | BOOL m_bShowTimeOut; // Flag to show timeout in MessageBox caption
47 | int m_nResult; // Result of MessageBox
48 | TCHAR m_szTimeOutCaption[80]; // Real MessageBox caption
49 |
50 | private:
51 | int TimedOutMessageBox();
52 |
53 | public:
54 | int DoMessageBox();
55 | int DoMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, UINT uTimeOut, BOOL bShowTimeOut = TRUE);
56 |
57 | private:
58 | static DWORD WINAPI ThreadFunction(LPVOID lpParameter);
59 | };
60 |
61 |
--------------------------------------------------------------------------------
/source/DosMessageDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // CDosMessageDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosMessageDialog : private CDialog
15 | {
16 | public:
17 | CDosMessageDialog(CWnd* pParentWnd = NULL);
18 | virtual ~CDosMessageDialog();
19 |
20 | INT_PTR DoModal();
21 |
22 | void AddButton(UINT uIDC, BOOL bIsDefault, BOOL bIsEscape, LPCTSTR pszText);
23 | void AddButton(UINT uIDC, BOOL bIsDefault, BOOL bIsEscape, UINT uIdText = (UINT)-1);
24 |
25 | void SetTitle(LPCTSTR pszTitle);
26 |
27 | void SetRtf(BOOL bRtf = TRUE);
28 |
29 | BOOL SetMsg(UINT uMsgId);
30 | BOOL SetMsg(LPCTSTR pszMsg);
31 | BOOL SetMsgEx(LPCTSTR pszMsgResId, LPCTSTR pszMsgResType);
32 | BOOL FormatMsg(LPCTSTR pszFmt, ...);
33 | BOOL FormatMsg(UINT uFmtStrId, ...);
34 | BOOL FormatMsgEx(LPCTSTR pszMsgResId, LPCTSTR pszMsgResType, ...);
35 | BOOL FormatMsgV(LPCTSTR pszFmt, va_list marker);
36 |
37 | void SetIcon(HICON hIcon);
38 | void SetIcon(UINT uIcon);
39 | void SetStandardIcon(LPCTSTR pszIconName);
40 |
41 | enum
42 | {
43 | CX_LEFT_BORDER,
44 | CX_RIGHT_BORDER,
45 | CY_TOP_BORDER,
46 | CY_BOTTOM_BORDER,
47 | CX_ICON_MSG_SPACE,
48 | CY_BTNS_MSG_SPACE,
49 | CX_BTN_BORDER,
50 | CY_BTN_BORDER,
51 | CX_BTNS_SPACE,
52 | CX_MIN_BTN,
53 | NUM_OF_METRICS
54 | };
55 |
56 | void SetMetric(int iMetric, int xy);
57 | int GetMetric(int iMetric);
58 |
59 | private:
60 |
61 | // CString help class (grants access to CString's FormatV)
62 | class XString : public CString
63 | {
64 | public:
65 | inline void FormatV(LPCTSTR pszFmt, va_list argList)
66 | {
67 | CString::FormatV(pszFmt, argList);
68 | }
69 | };
70 |
71 | // Graphical attributes
72 | int m_aMetrics[NUM_OF_METRICS]; // basic metrics (dialog units)
73 | CSize m_dimMsg; // message dimension (pixels)
74 | CSize m_dimBtn; // button dimension (pixels)
75 | CSize m_dimIcon; // icon dimension (pixels)
76 |
77 | // Dialog unit base: dimensions used in d.u. <-> pixel conversion
78 | enum
79 | {
80 | CX_DLGUNIT_BASE = 1000,
81 | CY_DLGUNIT_BASE = 1000,
82 | };
83 |
84 | // Pixel dimensions of the dialog unit base
85 | CSize m_dimDlgUnit;
86 |
87 | // Controls' attributes
88 | UINT m_uDefCmdId; // default command ID:
89 | UINT m_uEscCmdId; // escape command ID: or box close
90 | CStatic m_stIconCtrl; // the icon control
91 | CRichEditCtrl m_edCtrl; // the RTF control
92 |
93 | struct BTNDATA
94 | {
95 | UINT uIDC; // button ID
96 | CString strBtn; // button Text
97 | };
98 |
99 | CArray m_aBtns; // buttons' attributes
100 |
101 | // Message attributes
102 | BOOL m_bRtf; // TRUE if it's a RTF message
103 | HICON m_hIcon; // icon handle
104 | CString m_strMsg; // the message
105 | CString m_strTitle; // the title
106 |
107 | // Overrides
108 | virtual BOOL OnInitDialog();
109 | virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
110 | virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
111 | virtual BOOL PreTranslateMessage(MSG* pMsg);
112 |
113 | // Utility - creating the nested controls
114 | void CreateRtfCtrl();
115 | void CreateBtns();
116 | void CreateIcon();
117 |
118 | void UpdateLayout();
119 |
120 | int FromDlgX(int x);
121 | int FromDlgY(int y);
122 | };
123 |
124 | /////////////////////////////////////////////////////////////////////////////
125 | // CDosMessageDialog - inlined member functions
126 |
127 | inline void CDosMessageDialog::SetTitle(LPCTSTR pszTitle)
128 | {
129 | m_strTitle = pszTitle;
130 | }
131 |
132 | inline void CDosMessageDialog::SetRtf(BOOL bRtf)
133 | {
134 | m_bRtf = bRtf;
135 | }
136 |
137 | inline void CDosMessageDialog::SetMetric(int iMetric, int nValue)
138 | {
139 | ASSERT(0 <= iMetric && iMetric < NUM_OF_METRICS);
140 | m_aMetrics[iMetric] = nValue;
141 | }
142 |
143 | inline int CDosMessageDialog::GetMetric(int iMetric)
144 | {
145 | ASSERT(0 <= iMetric && iMetric < NUM_OF_METRICS);
146 | return m_aMetrics[iMetric];
147 | }
148 |
149 |
150 |
--------------------------------------------------------------------------------
/source/DosMultiListDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosMultiListDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosMultiListDialog.h"
14 |
15 | CDosMultiListDialog::CDosMultiListDialog(CWnd* pParent)
16 | : CAcUiDialog(CDosMultiListDialog::IDD, pParent)
17 | {
18 | }
19 |
20 | CDosMultiListDialog::~CDosMultiListDialog()
21 | {
22 | }
23 |
24 | void CDosMultiListDialog::DoDataExchange(CDataExchange* pDX)
25 | {
26 | CAcUiDialog::DoDataExchange(pDX);
27 | DDX_Control(pDX, IDC_LIST, m_listbox);
28 | }
29 |
30 | BEGIN_MESSAGE_MAP(CDosMultiListDialog, CAcUiDialog)
31 | ON_BN_CLICKED(IDC_SELECT, OnSelect)
32 | ON_BN_CLICKED(IDC_CLEAR, OnClear)
33 | ON_WM_NCHITTEST()
34 | END_MESSAGE_MAP()
35 |
36 | BOOL CDosMultiListDialog::OnInitDialog()
37 | {
38 | SetDialogName(L"DOSLib:MultiList");
39 |
40 | CAcUiDialog::OnInitDialog();
41 |
42 | StretchControlX(IDC_PROMPT, 100);
43 | StretchControlXY(IDC_LIST, 100, 100);
44 | MoveControlX(IDOK, 100);
45 | MoveControlX(IDCANCEL, 100);
46 | MoveControlX(IDC_SELECT, 100);
47 | MoveControlX(IDC_CLEAR, 100);
48 |
49 | SetWindowText(m_title);
50 | SetDlgItemText(IDC_PROMPT, m_prompt);
51 |
52 | int i = 0;
53 | for (i = 0; i < m_string_array.GetCount(); i++)
54 | m_listbox.AddString(m_string_array[i]);
55 |
56 | for (i = 0; i < m_selected_array.GetCount(); i++)
57 | {
58 | int item = m_selected_array[i];
59 | if (item >= 0 && item < m_listbox.GetCount())
60 | m_listbox.SetSel(item);
61 | }
62 |
63 | return TRUE;
64 | }
65 |
66 | void CDosMultiListDialog::OnOK()
67 | {
68 | m_result_array.RemoveAll();
69 |
70 | int count = m_listbox.GetSelCount();
71 | if (count < 1)
72 | EndDialog(IDCANCEL);
73 |
74 | CArray selitems;
75 | selitems.SetSize(count);
76 |
77 | m_listbox.GetSelItems(count, selitems.GetData());
78 |
79 | int i;
80 | for (i = 0; i < selitems.GetCount(); i++)
81 | m_result_array.Add(m_string_array[selitems[i]]);
82 |
83 | CAcUiDialog::OnOK();
84 | }
85 |
86 | void CDosMultiListDialog::OnSelect()
87 | {
88 | int i;
89 | for (i = 0; i < m_listbox.GetCount(); i++)
90 | m_listbox.SetSel(i, TRUE);
91 | }
92 |
93 | void CDosMultiListDialog::OnClear()
94 | {
95 | int i;
96 | for (i = 0; i < m_listbox.GetCount(); i++)
97 | m_listbox.SetSel(i, FALSE);
98 | }
99 |
100 | LRESULT CDosMultiListDialog::OnNcHitTest(CPoint point)
101 | {
102 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
103 | if (hit == HTCLIENT)
104 | return HTCAPTION;
105 | return hit;
106 | }
107 |
--------------------------------------------------------------------------------
/source/DosMultiListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosMultiListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosMultiListDialog : public CAcUiDialog
15 | {
16 | public:
17 | CDosMultiListDialog(CWnd* pParent);
18 | ~CDosMultiListDialog();
19 |
20 | enum { IDD = IDD_DOSMULTILIST };
21 | CListBox m_listbox;
22 | CString m_title;
23 | CString m_prompt;
24 | CStringArray m_string_array;
25 | CArray m_selected_array;
26 | CStringArray m_result_array;
27 |
28 | protected:
29 | virtual void DoDataExchange(CDataExchange* pDX);
30 |
31 | protected:
32 | virtual BOOL OnInitDialog();
33 | virtual void OnOK();
34 | afx_msg void OnSelect();
35 | afx_msg void OnClear();
36 | afx_msg LRESULT OnNcHitTest(CPoint point);
37 | DECLARE_MESSAGE_MAP()
38 | };
39 |
--------------------------------------------------------------------------------
/source/DosOrderListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosOrderListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosDragListBox.h"
15 |
16 | class CDosOrderListDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosOrderListDialog(CWnd* pParent);
20 |
21 | // Dialog Data
22 | enum { IDD = IDD_DOSORDERLIST };
23 | CDosDragListBox m_List;
24 | CString m_Title;
25 | CString m_Prompt;
26 | CStringArray m_StrArray;
27 | CDWordArray m_IntArray;
28 |
29 | protected:
30 | virtual void DoDataExchange(CDataExchange* pDX);
31 |
32 | int Move(int old_index, int new_index);
33 |
34 | protected:
35 | virtual BOOL OnInitDialog();
36 | virtual void OnOK();
37 | afx_msg void OnMoveUp();
38 | afx_msg void OnMoveDown();
39 | afx_msg void OnMoveTop();
40 | afx_msg void OnMoveBottom();
41 | afx_msg LRESULT OnNcHitTest(CPoint point);
42 | DECLARE_MESSAGE_MAP()
43 | };
44 |
--------------------------------------------------------------------------------
/source/DosPathMonitor.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosPathMonitor.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "stdafx.h"
13 | #include "DosPathMonitor.h"
14 |
15 | CDosPathMonitor::CDosPathMonitor()
16 | : m_hThread(0)
17 | , m_hEvent(0)
18 | , m_dwNotifyFilter(FILE_NOTIFY_CHANGE_LAST_WRITE)
19 | , m_bWatchSubtree(FALSE)
20 | {
21 | GUID guid = GUID_NULL;
22 | ::UuidCreate(&guid);
23 |
24 | m_strGuid.Format(
25 | L"%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
26 | guid.Data1,
27 | guid.Data2,
28 | guid.Data3,
29 | guid.Data4[0],
30 | guid.Data4[1],
31 | guid.Data4[2],
32 | guid.Data4[3],
33 | guid.Data4[4],
34 | guid.Data4[5],
35 | guid.Data4[6],
36 | guid.Data4[7]
37 | );
38 | }
39 |
40 | CDosPathMonitor::~CDosPathMonitor()
41 | {
42 | Uninstall();
43 | }
44 |
45 | CString CDosPathMonitor::Id() const
46 | {
47 | return m_strGuid;
48 | }
49 |
50 | void CDosPathMonitor::SetNotifyFilter(DWORD dwFilter)
51 | {
52 | if (0 == m_hThread) // not effective on active thread
53 | m_dwNotifyFilter = dwFilter;
54 | }
55 |
56 | void CDosPathMonitor::SetSubtreeWatch(BOOL bState)
57 | {
58 | if (0 == m_hThread) // not effective on active thread
59 | m_bWatchSubtree = bState;
60 | }
61 |
62 | BOOL CDosPathMonitor::Install(const wchar_t* pszPath, const wchar_t* pszCommand)
63 | {
64 | Uninstall();
65 |
66 | if (0 == pszPath || 0 == pszPath[0])
67 | return FALSE;
68 |
69 | if (0 == pszCommand || 0 == pszCommand[0])
70 | return FALSE;
71 |
72 | m_strPath = pszPath;
73 | m_strCommand = pszCommand;
74 |
75 | m_hEvent = ::CreateEvent(0, FALSE, FALSE, 0);
76 | if (0 == m_hEvent)
77 | return FALSE;
78 |
79 | DWORD dwThreadID = 0;
80 | m_hThread = ::CreateThread(0, 0, CDosPathMonitor::MonitorProc, this, 0, &dwThreadID);
81 | if (!m_hThread)
82 | {
83 | ::CloseHandle(m_hEvent);
84 | m_hEvent = 0;
85 | ::CloseHandle(m_hThread);
86 | m_hThread = 0;
87 | return FALSE;
88 | }
89 |
90 | return TRUE;
91 | }
92 |
93 | void CDosPathMonitor::Uninstall()
94 | {
95 | if (0 == m_hThread)
96 | return;
97 |
98 | ::SetEvent(m_hEvent);
99 | ::WaitForMultipleObjects(1, &m_hThread, TRUE, INFINITE);
100 |
101 | if (m_hEvent)
102 | ::CloseHandle(m_hEvent);
103 | m_hEvent = 0;
104 |
105 | if (m_hThread)
106 | ::CloseHandle(m_hThread);
107 | m_hThread = 0;
108 | }
109 |
110 | DWORD WINAPI CDosPathMonitor::MonitorProc(LPVOID pv)
111 | {
112 | CDosPathMonitor* p = (CDosPathMonitor*)pv;
113 | if (0 == p)
114 | return 1;
115 |
116 | HANDLE hChange = FindFirstChangeNotification(p->m_strPath, p->m_bWatchSubtree, p->m_dwNotifyFilter);
117 | if (hChange == INVALID_HANDLE_VALUE)
118 | return 1;
119 |
120 | HANDLE aHandles[2];
121 | aHandles[0] = hChange;
122 | aHandles[1] = p->m_hEvent;
123 |
124 | while (true)
125 | {
126 | DWORD dwEvent = WaitForMultipleObjects(2, aHandles, FALSE, INFINITE);
127 | if (WAIT_OBJECT_0 == dwEvent)
128 | {
129 | CString strBuffer;
130 | wchar_t* lpBuffer = strBuffer.GetBuffer(_MAX_PATH + 1);
131 | DWORD dwBytesReturned = 0;
132 |
133 | BOOL rc = ReadDirectoryChangesW(hChange, lpBuffer, _MAX_PATH, p->m_bWatchSubtree, p->m_dwNotifyFilter, &dwBytesReturned, 0, 0);
134 |
135 | strBuffer.ReleaseBuffer();
136 | if (rc)
137 | ShellExecute(0, L"open", p->m_strCommand, strBuffer, 0, SW_SHOWNORMAL);
138 |
139 | FindNextChangeNotification(hChange);
140 | continue;
141 | }
142 | break;
143 | }
144 |
145 | FindCloseChangeNotification(hChange);
146 |
147 | return 0;
148 | }
149 |
150 |
151 |
--------------------------------------------------------------------------------
/source/DosPathMonitor.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosPathMonitor.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosPathMonitor
15 | {
16 | public:
17 | CDosPathMonitor();
18 | ~CDosPathMonitor();
19 |
20 | CString Id() const;
21 |
22 | BOOL Install(const wchar_t* pszPath, const wchar_t* pszCommand);
23 | void Uninstall();
24 |
25 | void SetNotifyFilter(DWORD dwFilter);
26 | void SetSubtreeWatch(BOOL bState);
27 |
28 | static DWORD WINAPI MonitorProc(LPVOID pv);
29 |
30 | private:
31 | CString m_strPath;
32 | CString m_strCommand;
33 | BOOL m_bWatchSubtree;
34 | DWORD m_dwNotifyFilter;
35 | HANDLE m_hEvent;
36 | HANDLE m_hThread;
37 | CString m_strGuid;
38 |
39 | private:
40 | // no copy constructor
41 | CDosPathMonitor(const CDosPathMonitor&);
42 | // no operator=
43 | CDosPathMonitor& operator=(const CDosPathMonitor&);
44 | };
45 |
46 |
--------------------------------------------------------------------------------
/source/DosPopupMenu.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosPopupMenu.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosPopupMenu
15 | {
16 | public:
17 | // If you pass a valid resource ID and hInst and HWND then your menu is loaded and a WM_COMMAND
18 | // message is sent the the HWND with the item ID when done. If any of these fields are non 0
19 | // and invalid then ASSERT(...) is called. If you use the defult constructor you must calll AddItem
20 | // one or more times to add strings to a temp menu.
21 | CDosPopupMenu(UINT nResourceID = 0, HINSTANCE hInst = 0);
22 | CDosPopupMenu(LPCTSTR lpsResourceID, HINSTANCE hInst);
23 |
24 | virtual ~CDosPopupMenu();
25 |
26 | // Add items in order you want them to display
27 | int AddItem(LPCTSTR lpszItem);
28 |
29 | // Add sepertaor (this will not have an index)
30 | void AddSeperator();
31 |
32 | // Call using index returned by AddItem to enable/dissable a
33 | // menu item. The default behaivor is to enable everything.
34 | void EnableItem(int nItem, BOOL bEnable = TRUE);
35 |
36 | // Called when the menu selection changes, returns index of selected item or -1 if nothing is selected
37 | virtual void OnMenuSelect(HWND hWnd, HMENU hMenu, int index) {};
38 |
39 | // Called when WM_INITMENU message received for context menu.
40 | virtual void OnInitMenu(HWND hWnd, HMENU hMenu);
41 |
42 | // Display popup menu, returns -1 on error or if escape pressed otherwise returns index of added item.
43 | virtual int PopUp(CWnd*, // Window whos coord system the points are in
44 | CPoint, // Bottom point. Top left corner of the popup. This is used by default if there is enough
45 | // screen space to display the popup menu on the bottom
46 | CPoint); // Top point. Bottom left corner of the poupup. This is used if there is not enough space to display
47 | // the menu below the window.
48 |
49 | // Display popup menu, returns -1 on error or if escape pressed otherwise returns index of added item.
50 | int PopUpEx(CWnd*, // Window whos coord system the points are in
51 | CPoint, // Bottom point. Top left corner of the popup. This is used by default if there is enough
52 | // screen space to display the popup menu on the bottom
53 | CPoint, // Top point. Bottom left corner of the poupup. This is used if there is not enough space to display
54 | // the menu below the window.
55 | int); // 0 = Not transparent, 1 to 100 = percentage of tranparency.
56 |
57 | bool LeftButtonPicked(); // returns true if menu dismissed with left button
58 | bool RightButtonPicked(); // returns true if menu dismissed with right button
59 | LPPOINT PointPicked(); // return NULL if LeftButtonPicked() and RightButtonPicked() are false otherwise returns point where mouse went down.
60 |
61 | // For internal use only
62 | void PopupWndProcOnInitMenu(HWND hWnd, HMENU hMenu);
63 | LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
64 |
65 | public:
66 | int m_menu_select;
67 | bool m_menu_char;
68 |
69 | protected:
70 | bool CheckDefaults(LPCTSTR nResourceID, HINSTANCE hInst);
71 | void Init();
72 |
73 | CStringArray m_item_array;
74 | HMENU m_hMenu;
75 | bool m_bLeft;
76 | bool m_bRight;
77 | CUIntArray m_nEnabledList;
78 | CPoint m_point;
79 | };
80 |
--------------------------------------------------------------------------------
/source/DosProcessHelpers.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosProcessHelpers.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | // Determines if teh user is a member of the Power Users group
15 | bool IsPowerUser();
16 | // Determines if teh user is a member of the Administrators group
17 | bool IsAdministrator();
18 |
19 | // Gets operating system version display string
20 | bool GetOSDisplayString(CString& str);
21 |
22 | // Determines if the current 32-bit process is running under 64-bit Windows
23 | bool IsWow64();
24 | // Determines if Windows is 64-bit
25 | bool Is64BitWindows();
26 | // Determines if Windows is Vista or higher
27 | bool IsVistaOrHigher();
28 |
29 | void DOS_StartProcess(const wchar_t* pszApplicationName);
30 |
--------------------------------------------------------------------------------
/source/DosProgressCtrl.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosProgressCtrl.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosProgressCtrl : public CProgressCtrl
15 | {
16 | public:
17 | CDosProgressCtrl();
18 | virtual ~CDosProgressCtrl();
19 |
20 | int SetPos(int nPos);
21 | int StepIt();
22 | void SetRange(int nLower, int nUpper);
23 | void GetRange(int& nLower, int& nUpper) const;
24 | int OffsetPos(int nPos);
25 | int SetStep(int nStep);
26 |
27 | void SetShowText(BOOL bShow);
28 | COLORREF SetBarColour(COLORREF crBarClr = CLR_DEFAULT);
29 | COLORREF GetBarColour() const;
30 | COLORREF SetBgColour(COLORREF crBgClr = CLR_DEFAULT);
31 | COLORREF GetBgColour() const;
32 |
33 | protected:
34 | int m_nPos;
35 | int m_nStepSize;
36 | int m_nMax;
37 | int m_nMin;
38 | CString m_strText;
39 | BOOL m_bShowText;
40 | int m_nBarWidth;
41 | COLORREF m_crBarClr;
42 | COLORREF m_crBgClr;
43 |
44 | afx_msg BOOL OnEraseBkgnd(CDC* pDC);
45 | afx_msg void OnPaint();
46 | afx_msg void OnSize(UINT nType, int cx, int cy);
47 | afx_msg LRESULT OnSetText(WPARAM, LPARAM);
48 | afx_msg LRESULT OnGetText(WPARAM, LPARAM);
49 | DECLARE_MESSAGE_MAP()
50 | };
51 |
--------------------------------------------------------------------------------
/source/DosPropList.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosPropList.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #define PIT_COMBO 0 //PIT = property item type
15 | #define PIT_EDIT 1
16 | #define PIT_COLOR 2
17 | #define PIT_FONT 3
18 | #define PIT_FILE 4
19 |
20 | #define IDC_PROPCMBBOX 712
21 | #define IDC_PROPEDITBOX 713
22 | #define IDC_PROPBTNCTRL 714
23 |
24 | class CDosPropItem : public CObject
25 | {
26 | public:
27 | CDosPropItem() {}
28 |
29 | CDosPropItem(CString propName, CString curValue, int nItemType, CString cmbItems)
30 | {
31 | m_propName = propName;
32 | m_curValue = curValue;
33 | m_nItemType = nItemType;
34 | m_cmbItems = cmbItems;
35 | }
36 |
37 | void Set(CString propName, CString curValue, int nItemType, CString cmbItems)
38 | {
39 | m_propName = propName;
40 | m_curValue = curValue;
41 | m_nItemType = nItemType;
42 | m_cmbItems = cmbItems;
43 | }
44 |
45 | CString Get() { return m_curValue; }
46 |
47 | public:
48 | CString m_propName;
49 | CString m_curValue;
50 | int m_nItemType;
51 | CString m_cmbItems;
52 | };
53 |
54 | class CDosPropList : public CListBox
55 | {
56 | public:
57 | CDosPropList();
58 |
59 | public:
60 | int AddItem(CString txt);
61 | int AddPropItem(CDosPropItem* pItem);
62 |
63 | //{{AFX_VIRTUAL(CDosPropList)
64 | public:
65 | virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
66 | virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
67 | virtual BOOL PreTranslateMessage(MSG* pMsg);
68 | protected:
69 | virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
70 | virtual void PreSubclassWindow();
71 | //}}AFX_VIRTUAL
72 |
73 | public:
74 | virtual ~CDosPropList();
75 |
76 | protected:
77 | //{{AFX_MSG(CDosPropList)
78 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
79 | afx_msg void OnSelchange();
80 | afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
81 | afx_msg void OnKillFocus(CWnd* pNewWnd);
82 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
83 | afx_msg void OnMouseMove(UINT nFlags, CPoint point);
84 | //}}AFX_MSG
85 | afx_msg void OnKillfocusCmbBox();
86 | afx_msg void OnSelchangeCmbBox();
87 | afx_msg void OnKillfocusEditBox();
88 | afx_msg void OnChangeEditBox();
89 | afx_msg void OnButton();
90 |
91 | DECLARE_MESSAGE_MAP()
92 |
93 | void InvertLine(CDC* pDC, CPoint ptFrom, CPoint ptTo);
94 | void DisplayButton(CRect region);
95 |
96 | CComboBox m_cmbBox;
97 | CEdit m_editBox;
98 | CButton m_btnCtrl;
99 | CFont m_SSerif8Font;
100 |
101 | int m_curSel, m_prevSel;
102 | int m_nDivider;
103 | int m_nDivTop;
104 | int m_nDivBtm;
105 | int m_nOldDivX;
106 | int m_nLastBox;
107 | BOOL m_bTracking;
108 | BOOL m_bDivIsSet;
109 | HCURSOR m_hCursorArrow;
110 | HCURSOR m_hCursorSize;
111 | };
112 |
113 | //
114 | // END CDosPropList class
115 | //
116 | ////////////////////////////////////////////////////////////////
117 | ////////////////////////////////////////////////////////////////
118 |
119 | //{{AFX_INSERT_LOCATION}}
120 |
--------------------------------------------------------------------------------
/source/DosPropListDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosPropListDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosPropListDialog.h"
14 |
15 | CDosPropListDialog::CDosPropListDialog(CWnd* pParent /*=NULL*/)
16 | : CAcUiDialog(CDosPropListDialog::IDD, pParent)
17 | {
18 | m_Val = L"";
19 | }
20 |
21 | void CDosPropListDialog::DoDataExchange(CDataExchange* pDX)
22 | {
23 | CAcUiDialog::DoDataExchange(pDX);
24 | DDX_Control(pDX, IDC_LIST, m_List);
25 | DDX_LBString(pDX, IDC_LIST, m_Val);
26 | }
27 |
28 | BEGIN_MESSAGE_MAP(CDosPropListDialog, CAcUiDialog)
29 | ON_WM_NCHITTEST()
30 | ON_WM_DESTROY()
31 | END_MESSAGE_MAP()
32 |
33 | BOOL CDosPropListDialog::OnInitDialog()
34 | {
35 | SetDialogName(L"DOSLib:PropList");
36 |
37 | CAcUiDialog::OnInitDialog();
38 |
39 | StretchControlX(IDC_PROMPT, 100);
40 | StretchControlXY(IDC_LIST, 100, 100);
41 | MoveControlX(IDOK, 100);
42 | MoveControlX(IDCANCEL, 100);
43 |
44 | SetWindowText(m_Title);
45 | SetDlgItemText(IDC_PROMPT, m_Prompt);
46 |
47 | INT_PTR i, count = m_ValArray.GetCount();
48 | for (i = 0; i < count; i++)
49 | {
50 | CDosPropItem* pItem = new CDosPropItem(m_StrArray[i], m_ValArray[i], PIT_EDIT, L"");
51 | if (pItem)
52 | {
53 | array.Add(pItem);
54 | m_List.AddPropItem((CDosPropItem*)array[i]);
55 | }
56 | }
57 |
58 | return TRUE;
59 | }
60 |
61 | void CDosPropListDialog::OnOK()
62 | {
63 | INT_PTR i, count = m_ValArray.GetCount();
64 | for (i = 0; i < count; i++)
65 | {
66 | CDosPropItem* pItem = (CDosPropItem*)array[i];
67 | if (pItem)
68 | m_ValArray.SetAt(i, pItem->Get());
69 | }
70 |
71 | CAcUiDialog::OnOK();
72 | }
73 |
74 | LRESULT CDosPropListDialog::OnNcHitTest(CPoint point)
75 | {
76 | LRESULT hit = CAcUiDialog::OnNcHitTest(point);
77 | if (hit == HTCLIENT)
78 | return HTCAPTION;
79 | return hit;
80 | }
81 |
82 | void CDosPropListDialog::OnDestroy()
83 | {
84 | INT_PTR i, count = m_ValArray.GetCount();
85 | for (i = 0; i < count; i++)
86 | {
87 | CDosPropItem* pItem = (CDosPropItem*)array[i];
88 | if (pItem)
89 | {
90 | pItem = 0;
91 | delete array[i];
92 | array[i] = 0;
93 | }
94 | }
95 |
96 | CAcUiDialog::OnDestroy();
97 | }
98 |
--------------------------------------------------------------------------------
/source/DosPropListDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosPropListDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #include "DosPropList.h"
15 |
16 | class CDosPropListDialog : public CAcUiDialog
17 | {
18 | public:
19 | CDosPropListDialog(CWnd* pParent);
20 |
21 | enum { IDD = IDD_DOSPROPLIST };
22 | CDosPropList m_List;
23 | CString m_Val;
24 |
25 | CString m_Title;
26 | CString m_Prompt;
27 | CStringArray m_StrArray;
28 | CStringArray m_ValArray;
29 | CObArray array;
30 |
31 | protected:
32 | virtual void DoDataExchange(CDataExchange* pDX);
33 |
34 | protected:
35 | virtual BOOL OnInitDialog();
36 | virtual void OnOK();
37 | afx_msg LRESULT OnNcHitTest(CPoint point);
38 | DECLARE_MESSAGE_MAP()
39 |
40 | public:
41 | afx_msg void OnDestroy();
42 | };
43 |
--------------------------------------------------------------------------------
/source/DosReadDir.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosReadDir.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | using namespace std;
15 |
16 | class CDosReadDir
17 | {
18 | public:
19 | CDosReadDir();
20 | virtual ~CDosReadDir();
21 |
22 | bool& Recurse() { return m_bRecurse; }
23 | bool GetDirs(const wchar_t * pDirPath);
24 | bool GetFiles(const wchar_t *pFilemask);
25 | bool ClearDirs();
26 | bool ClearFiles();
27 |
28 | enum { eSortNone, eSortAlpha, eSortWriteDate, eSortSize };
29 | bool SortFiles(int iSortStyle, bool bReverse);
30 | bool SortDirs();
31 |
32 | struct CDirEntry
33 | {
34 | CDirEntry() {}
35 | CDirEntry(const CString &s)
36 | {
37 | m_sName = s;
38 | }
39 | CString m_sName;
40 | };
41 |
42 | typedef vector DirVector;
43 |
44 | DirVector &Dirs() { return m_dirs; }
45 |
46 | struct CFileEntry
47 | {
48 | CString m_sName;
49 | unsigned int attrib;
50 | unsigned __int64 time_create;
51 | unsigned __int64 time_access;
52 | unsigned __int64 time_write;
53 | unsigned __int64 size;
54 | };
55 |
56 | typedef vector FileVector;
57 |
58 | FileVector &Files() { return m_files; }
59 |
60 | protected:
61 | bool GetSubDirs(DirVector& dir_array, const CString& path);
62 | UINT FindFiles(const CString& dir, const CString& filter);
63 | void FormatPath(CString& path);
64 |
65 | bool m_bRecurse;
66 | CString m_sSourceDir;
67 |
68 | DirVector m_dirs;
69 | FileVector m_files;
70 | };
71 |
--------------------------------------------------------------------------------
/source/DosRegExp.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosRegExp.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Assoicates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | // CDosRegExp encapsulates CAtlRegExp<> to make ATL regular expressions a little
15 | // more usable. CDosRegExp hides CAtlRegExp and CAtlREMatchContext and also
16 | // implements useful functions like Replace and Split.
17 | #include "atlrx.h"
18 |
19 | class CDosRegExp : public CAtlRegExp<>
20 | {
21 | public:
22 | CDosRegExp();
23 | CDosRegExp( const wchar_t* szRegExp, BOOL bCaseSensitive = TRUE );
24 | CDosRegExp( const CDosRegExp& src );
25 | ~CDosRegExp();
26 |
27 | const CDosRegExp& operator=( const CDosRegExp& src );
28 | operator const wchar_t*() const;
29 |
30 | // Parse szRegExp: reset internal state and return error code
31 | REParseError Parse( const wchar_t* szRegExp, BOOL bCaseSensitive = TRUE );
32 |
33 | // Set input string. Use this with NextMatch to find all matches
34 | void SetInput( const wchar_t* szInput );
35 |
36 | // Find a single match in input string.
37 | // Optional argument returns pointer to next input char to search
38 | // after match. Used internally to find successive matches.
39 | BOOL Match( const wchar_t* szInput, const wchar_t** ppszEnd = 0 );
40 |
41 | // Find next match after calling SetInput
42 | BOOL NextMatch();
43 |
44 | // Get current match
45 | // Optional argument returns offset into input string.
46 | CString GetMatch( int* pOffset = 0) const;
47 |
48 | // Get number of groups. In ATL syntax, groups are marked with {}.
49 | UINT GetNumGroups() const;
50 |
51 | // Get nth match group.
52 | // Optional argument returns offset into input string.
53 | CString GetGroup( int nIndex, int* pOffset = 0) const;
54 |
55 | // Callback for dynamic replace
56 | typedef CString (CALLBACK* REREPLACEPROC)( const CDosRegExp& src, const CString& strMatch, void* pParam );
57 |
58 | // Global replace. This is not implemented by ATL.
59 | // Does not support $1 $2 variables (replace with subgroup match).
60 | CString Replace( const wchar_t* szInput, const wchar_t* szValue, BOOL bAll = TRUE );
61 | static CString Replace( const wchar_t* szInput, const wchar_t* szRegExp, const wchar_t* szValue, BOOL bAll = TRUE, BOOL bIgnoreCase = FALSE );
62 |
63 | CString Replace( const wchar_t* szInput, REREPLACEPROC replfn, void* pParam );
64 | static CString Replace( const wchar_t* szInput, const wchar_t* szRegExp, REREPLACEPROC replfn, void* pParam, BOOL bIgnoreCase = FALSE );
65 |
66 | // / Split function implements Perl-style split.
67 | INT_PTR Split( const wchar_t* szInput, CStringArray& arr, INT_PTR maximum = 0 );
68 | static INT_PTR Split( const wchar_t* szInput, const wchar_t* szSep, CStringArray& arr, BOOL bCaseSensitive = TRUE, INT_PTR nMax = 0 );
69 |
70 | // Helper functions to get error name from error code
71 | static CString GetErrorName( REParseError err );
72 |
73 | // Current ATL parse error, if any
74 | REParseError m_error;
75 |
76 | protected:
77 | // helper to extract string from ATL MatchGroup
78 | CString GetMGString( const CAtlREMatchContext<>::MatchGroup& mg ) const;
79 |
80 | protected:
81 | CString m_strRegExp; // the regular expression
82 | BOOL m_bCaseSensitive; // case sensitivity
83 | CAtlREMatchContext<> m_mc; // internal match context
84 | const wchar_t* m_szInput; // original input string
85 | const wchar_t* m_szNext; // next character to search
86 | };
--------------------------------------------------------------------------------
/source/DosRelativePaths.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosRelativePaths.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosRelativePaths
15 | {
16 | public:
17 | static CString AbsoluteToRelative(const CString& strAbsolutePath, const CString& strRelativeTo);
18 | static CString RelativeToAbsolute(const CString& strRelativePath, const CString& strRelativeTo);
19 |
20 | static CString GetFolderAncestor(const CString& strDir, int nLevel);
21 | static int FoldersUpToRootLevel(const CString& strDir);
22 | static int GetAncestorLevel(const CString& strDir, const CString& strSubDir);
23 |
24 | public:
25 | static CCriticalSection sm_cs;
26 | };
27 |
--------------------------------------------------------------------------------
/source/DosScreenImage.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosScreenImage.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosScreenImage.h"
14 |
15 | BOOL CDosScreenImage::CaptureRect(const CRect& rect)
16 | {
17 | // detach and destroy the old bitmap if any attached
18 | CImage::Destroy();
19 |
20 | // get the desktop device context
21 | HDC hDC = ::GetDC(NULL);
22 |
23 | // create a device context
24 | HDC hDest = ::CreateCompatibleDC(hDC);
25 |
26 | // create a bitmap
27 | HBITMAP hBitmap = ::CreateCompatibleBitmap(hDC, rect.Width(), rect.Height());
28 |
29 | // select the bitmap
30 | HBITMAP hOld = (HBITMAP)::SelectObject(hDest, hBitmap);
31 |
32 | // copy from the desktop device context to the bitmap device context
33 | BOOL rc = ::BitBlt(hDest, 0, 0, rect.Width(), rect.Height(), hDC, rect.left, rect.top, SRCCOPY | CAPTUREBLT);
34 |
35 | // attach bitmap handle to this object
36 | Attach(hBitmap);
37 |
38 | // restore the old object
39 | ::SelectObject(hDest, hOld);
40 |
41 | // delete the device context
42 | ::DeleteDC(hDest);
43 |
44 | // release the desktop device context
45 | ::ReleaseDC(NULL, hDC);
46 |
47 | return rc;
48 | }
49 |
50 | BOOL CDosScreenImage::CaptureScreen()
51 | {
52 | CRect rect(
53 | 0,
54 | 0,
55 | ::GetSystemMetrics(SM_CXVIRTUALSCREEN),
56 | ::GetSystemMetrics(SM_CYVIRTUALSCREEN)
57 | );
58 | return CaptureRect(rect);
59 | }
60 |
61 | BOOL CDosScreenImage::CaptureWindow(HWND hWnd)
62 | {
63 | BOOL rc = FALSE;
64 | if (::IsWindow(hWnd))
65 | {
66 | CRect rect;
67 | ::GetWindowRect(hWnd, rect);
68 | rc = CaptureRect(rect);
69 | }
70 | return rc;
71 | }
72 |
73 | BOOL CDosScreenImage::CaptureWindow(CWnd* pWnd)
74 | {
75 | BOOL rc = FALSE;
76 | if (pWnd)
77 | rc = CaptureWindow(pWnd->GetSafeHwnd());
78 | return rc;
79 | }
80 |
--------------------------------------------------------------------------------
/source/DosScreenImage.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosScreenImage.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 | #pragma once
12 |
13 | class CDosScreenImage : public CImage
14 | {
15 | public:
16 | BOOL CaptureRect(const CRect& rect);
17 | BOOL CaptureScreen();
18 | BOOL CaptureWindow(HWND hWnd);
19 | BOOL CaptureWindow(CWnd* pWnd);
20 | };
21 |
--------------------------------------------------------------------------------
/source/DosScreenSelectionDialog.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosScreenSelectionDialog.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "stdafx.h"
13 | #include "DosScreenSelectionDialog.h"
14 |
15 | IMPLEMENT_DYNAMIC(CDosScreenSelectionDialog, CDialog)
16 |
17 | CDosScreenSelectionDialog::CDosScreenSelectionDialog(CRect& rect)
18 | : CDialog(IDD_SCREEN_SELECTION)
19 | , m_rect(rect)
20 | {
21 | rect.SetRectEmpty();
22 | }
23 |
24 | CDosScreenSelectionDialog::~CDosScreenSelectionDialog()
25 | {
26 | }
27 |
28 | BEGIN_MESSAGE_MAP(CDosScreenSelectionDialog, CDialog)
29 | ON_WM_ERASEBKGND()
30 | ON_WM_PAINT()
31 | ON_WM_LBUTTONDOWN()
32 | END_MESSAGE_MAP()
33 |
34 | BOOL CDosScreenSelectionDialog::OnInitDialog()
35 | {
36 | CDialog::OnInitDialog();
37 |
38 | //AfxGetMainWnd()->ShowWindow(SW_HIDE);
39 | //::Sleep(333);
40 |
41 | if (!m_image.CaptureScreen())
42 | EndDialog(IDCANCEL);
43 |
44 | const int cx = ::GetSystemMetrics(SM_CXSCREEN);
45 | const int cy = ::GetSystemMetrics(SM_CYSCREEN);
46 | SetWindowPos(&CWnd::wndTopMost, 0, 0, cx, cy, SWP_SHOWWINDOW);
47 |
48 | return TRUE;
49 | }
50 |
51 | BOOL CDosScreenSelectionDialog::OnEraseBkgnd(CDC* pDC)
52 | {
53 | return TRUE;
54 | }
55 |
56 | void CDosScreenSelectionDialog::OnPaint()
57 | {
58 | CPaintDC dc(this);
59 | m_image.Draw(dc.GetSafeHdc(), 0, 0);
60 | m_tracker.Draw(&dc);
61 | }
62 |
63 | void CDosScreenSelectionDialog::OnLButtonDown(UINT nFlags, CPoint point)
64 | {
65 | m_tracker.TrackRubberBand(this, point);
66 | m_tracker.GetTrueRect(m_rect);
67 | EndDialog(IDOK);
68 | }
69 |
--------------------------------------------------------------------------------
/source/DosScreenSelectionDialog.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosScreenSelectionDialog.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 | #pragma once
12 |
13 | #include "DosScreenImage.h"
14 |
15 | class CDosScreenSelectionDialog : public CDialog
16 | {
17 | DECLARE_DYNAMIC(CDosScreenSelectionDialog)
18 |
19 | public:
20 | CDosScreenSelectionDialog(CRect& rect);
21 | virtual ~CDosScreenSelectionDialog();
22 |
23 | // Dialog Data
24 | enum { IDD = IDD_SCREEN_SELECTION };
25 |
26 | public:
27 | virtual BOOL OnInitDialog();
28 | afx_msg BOOL OnEraseBkgnd(CDC* pDC);
29 | afx_msg void OnPaint();
30 | afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
31 |
32 | protected:
33 | DECLARE_MESSAGE_MAP()
34 |
35 | private:
36 | CRect& m_rect;
37 | CRectTracker m_tracker;
38 | CDosScreenImage m_image;
39 | };
40 |
--------------------------------------------------------------------------------
/source/DosSplash.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosSplash.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosSplash : public CWinThread
15 | {
16 | public:
17 | CDosSplash(UINT nIDRes, UINT duration, WORD flags = 0, CDosSplash** ppBackPtr = 0);
18 | CDosSplash(LPCTSTR szFileName, UINT duration, WORD flags = 0, CDosSplash** ppBackPtr = 0);
19 | ~CDosSplash();
20 |
21 | enum
22 | {
23 | KillOnClick = 0x0001,
24 | IgnoreCmdLine = 0x0002,
25 | NoWaitForMainWnd = 0x0004,
26 | };
27 |
28 | virtual CWnd* OnCreateSplashWnd(UINT nIDRes, UINT duration, WORD flags);
29 | virtual CWnd* OnCreateSplashWnd(LPCTSTR szFileName, UINT duration, WORD flags);
30 |
31 | static void Kill(CDosSplash* pSplash);
32 |
33 | protected:
34 | virtual BOOL InitInstance();
35 | DECLARE_DYNAMIC(CDosSplash)
36 |
37 | protected:
38 | CDosSplash** m_ppBackPtr; // Caller's back pointer to me
39 | UINT m_nIDRes; // Bitmap resource ID
40 | UINT m_duration; // How long to display
41 | WORD m_flags; // CDosSplashWnd creation flags
42 | CString m_strFileName; // Filename of bitmap
43 | };
44 |
45 | class CDosSplashWnd : public CWnd
46 | {
47 | protected:
48 | friend CDosSplash;
49 |
50 | CDosSplashWnd(CDosSplash* pThread);
51 | ~CDosSplashWnd();
52 |
53 | CDosSplash* m_pSplash;
54 | CImage m_image;
55 | UINT m_duration;
56 | WORD m_flags;
57 |
58 | virtual BOOL Create(UINT nIDRes, UINT duration, WORD flags);
59 | virtual BOOL Create(LPCTSTR szFileName, UINT duration, WORD flags);
60 | virtual BOOL PreTranslateMessage(MSG* pMsg);
61 | virtual void PostNcDestroy();
62 |
63 | afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
64 | afx_msg void OnClose();
65 | afx_msg void OnPaint();
66 | afx_msg void OnTimer(UINT_PTR nIDEvent);
67 |
68 | DECLARE_MESSAGE_MAP()
69 | DECLARE_DYNAMIC(CDosSplashWnd)
70 | };
71 |
72 |
73 |
--------------------------------------------------------------------------------
/source/DosStaticLink.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosStaticLink.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosStaticLink.h"
14 |
15 | IMPLEMENT_DYNAMIC(CDosStaticLink, CStatic)
16 |
17 | BEGIN_MESSAGE_MAP(CDosStaticLink, CStatic)
18 | ON_WM_SETCURSOR()
19 | ON_WM_CTLCOLOR_REFLECT()
20 | ON_CONTROL_REFLECT(STN_CLICKED, OnClicked)
21 | END_MESSAGE_MAP()
22 |
23 | CDosStaticLink::CDosStaticLink()
24 | {
25 | m_colorUnvisited = RGB(0, 0, 255); // blue
26 | m_colorVisited = RGB(128, 0, 128); // purple
27 | m_bVisited = FALSE;
28 | }
29 |
30 | HBRUSH CDosStaticLink::CtlColor(CDC* pDC, UINT nCtlColor)
31 | {
32 | ASSERT(nCtlColor == CTLCOLOR_STATIC);
33 | DWORD dwStyle = GetStyle();
34 | if (!(dwStyle & SS_NOTIFY))
35 | {
36 | ::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | SS_NOTIFY);
37 | }
38 |
39 | HBRUSH hbr = NULL;
40 | if ((dwStyle & 0xFF) <= SS_RIGHT)
41 | {
42 | if (!(HFONT)m_font)
43 | {
44 | LOGFONT lf;
45 | GetFont()->GetObject(sizeof(lf), &lf);
46 | lf.lfUnderline = TRUE;
47 | m_font.CreateFontIndirect(&lf);
48 | }
49 |
50 | pDC->SelectObject(&m_font);
51 | pDC->SetTextColor(m_bVisited ? m_colorVisited : m_colorUnvisited);
52 | pDC->SetBkMode(TRANSPARENT);
53 |
54 | hbr = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);
55 | }
56 |
57 | return hbr;
58 | }
59 |
60 | void CDosStaticLink::OnClicked()
61 | {
62 | if (m_link.IsEmpty())
63 | GetWindowText(m_link);
64 |
65 | ShellExecute(0, L"open", m_link, NULL, NULL, SW_SHOWNORMAL);
66 | m_bVisited = TRUE;
67 | Invalidate();
68 | }
69 |
70 | BOOL CDosStaticLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
71 | {
72 | HCURSOR hCursor = (HCURSOR)LoadImage(NULL, IDC_HAND, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
73 | SetCursor(hCursor);
74 | return TRUE;
75 | }
76 |
--------------------------------------------------------------------------------
/source/DosStaticLink.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosStaticLink.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosStaticLink : public CStatic
15 | {
16 | public:
17 | CDosStaticLink();
18 |
19 | COLORREF m_colorUnvisited;
20 | COLORREF m_colorVisited;
21 | BOOL m_bVisited;
22 | CString m_link;
23 |
24 | protected:
25 | DECLARE_DYNAMIC(CDosStaticLink)
26 | CFont m_font;
27 |
28 | protected:
29 | afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
30 | afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
31 | afx_msg void OnClicked();
32 | DECLARE_MESSAGE_MAP()
33 | };
34 |
--------------------------------------------------------------------------------
/source/DosString.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosString.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosString.h"
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // CDosStringW
17 |
18 | CDosStringW::CDosStringW(const wchar_t* p)
19 | : m_sz((wchar_t*)p)
20 | , m_bIsForeign(false)
21 | {
22 | }
23 |
24 | CDosStringW::operator const wchar_t*() const
25 | {
26 | return m_sz;
27 | }
28 |
29 | CDosStringW::CDosStringW(const char* p)
30 | : m_bIsForeign(true)
31 | {
32 | size_t len = strlen(p);
33 | size_t size = mbstowcs(0, p, len) + 1;
34 | if (m_sz = new wchar_t[size])
35 | mbstowcs(m_sz, p, size);
36 | }
37 |
38 | CDosStringW::~CDosStringW()
39 | {
40 | if (m_bIsForeign)
41 | delete[] m_sz;
42 | }
43 |
44 | /////////////////////////////////////////////////////////////////////////////
45 | // CDosStringA
46 |
47 | CDosStringA::CDosStringA(const char* p)
48 | : m_sz((char*)p)
49 | , m_bIsForeign(false)
50 | {
51 | }
52 |
53 | CDosStringA::operator const char*() const
54 | {
55 | return m_sz;
56 | }
57 |
58 | CDosStringA::CDosStringA(const wchar_t* p)
59 | : m_bIsForeign(true)
60 | {
61 | size_t len = wcslen(p);
62 | size_t size = wcstombs(0, p, len) + 1;
63 | if (m_sz = new char[size])
64 | wcstombs(m_sz, p, size);
65 | }
66 |
67 | CDosStringA::~CDosStringA()
68 | {
69 | if (m_bIsForeign)
70 | delete[] m_sz;
71 | }
72 |
--------------------------------------------------------------------------------
/source/DosString.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosString.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | /////////////////////////////////////////////////////////////////////////////
15 | // CDosStringW
16 | // Converts both 8-bit and 16-bit strings to 16-bit wideness
17 |
18 | class CDosStringW
19 | {
20 | public:
21 | CDosStringW(const char*);
22 | CDosStringW(const wchar_t*);
23 | ~CDosStringW();
24 |
25 | operator const wchar_t*() const;
26 |
27 | private:
28 | CDosStringW(const CDosStringW&);
29 | CDosStringW& operator=(const CDosStringW&);
30 |
31 | private:
32 | wchar_t* m_sz;
33 | bool m_bIsForeign;
34 | };
35 |
36 |
37 | /////////////////////////////////////////////////////////////////////////////
38 | // CDosStringA
39 | // Converts both 8-bit and 16-bit strings to 8-bit wideness
40 |
41 | class CDosStringA
42 | {
43 | public:
44 | CDosStringA(const char*);
45 | CDosStringA(const wchar_t*);
46 | ~CDosStringA();
47 |
48 | operator const char*() const;
49 |
50 | private:
51 | CDosStringA(const CDosStringA&);
52 | CDosStringA& operator=(const CDosStringA&);
53 |
54 | private:
55 | char* m_sz;
56 | bool m_bIsForeign;
57 | };
58 |
59 | /////////////////////////////////////////////////////////////////////////////
60 | // Conditional Typedefs for Win32 and OLE Text Data Types
61 |
62 | // typedef OLESTRCVAR to emulate the OLESTR
63 | // macro (converts any string at runtime instead
64 | // of simply changing layout of string literal at
65 | // compile-time).
66 |
67 | #ifdef OLE2ANSI
68 | typedef CDosStringA OLESTRCVAR;
69 | #else
70 | typedef CDosStringW OLESTRCVAR;
71 | #endif
72 |
73 | // typedef __TEXTCVAR to emulate the __TEXT
74 | // macro (converts any string at runtime instead
75 | // of simply changing layout of string literal at
76 | // compile-time).
77 |
78 | #ifdef UNICODE
79 | typedef CDosStringW __TEXTCVAR;
80 | #else
81 | typedef CDosStringA __TEXTCVAR;
82 | #endif
83 |
--------------------------------------------------------------------------------
/source/DosStringArray.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosStringArray.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | /////////////////////////////////////////////////////////////////////////////
15 | // CDosStringArray
16 | class CDosStringArray : public CStringArray
17 | {
18 | public:
19 | CDosStringArray();
20 | ~CDosStringArray();
21 | CDosStringArray(const CDosStringArray& src);
22 | CDosStringArray& operator=(const CDosStringArray& src);
23 | public:
24 | void Sort(bool bCaseSensitive = false, bool bAscending = true);
25 | void SortLogical(bool bAscending = true);
26 | void Cull(bool bCaseSensitive = false);
27 | };
28 |
29 | /////////////////////////////////////////////////////////////////////////////
30 | // CDosNumberArray
31 | class CDosNumberArray : public CArray
32 | {
33 | public:
34 | void Sort(bool bIncreasing = true);
35 | void Cull(double tolerance = DOS_ZERO_TOLERANCE);
36 | };
37 |
38 | /////////////////////////////////////////////////////////////////////////////
39 | // CDos2dPointArray
40 | class CDos2dPointArray : public CArray
41 | {
42 | public:
43 | void SortXY(bool bIncreasing = true);
44 | void SortYX(bool bIncreasing = true);
45 | void Cull(double tolerance = DOS_ZERO_TOLERANCE);
46 | };
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | // CDos3dPointArray
50 | class CDos3dPointArray : public CArray
51 | {
52 | public:
53 | // x,y,z
54 | void SortXYZ(bool bIncreasing = true);
55 | // x,z,y
56 | void SortXZY(bool bIncreasing = true);
57 | // y,x,z
58 | void SortYXZ(bool bIncreasing = true);
59 | // y,z,x
60 | void SortYZX(bool bIncreasing = true);
61 | // z,x,y
62 | void SortZXY(bool bIncreasing = true);
63 | // z,y,x
64 | void SortZYX(bool bIncreasing = true);
65 | // Cull
66 | void Cull(double tolerance = DOS_ZERO_TOLERANCE);
67 | };
--------------------------------------------------------------------------------
/source/DosUnicodeTextFile.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosUnicodeTextFile.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosUnicodeTextFile
15 | {
16 | public:
17 | CDosUnicodeTextFile();
18 | ~CDosUnicodeTextFile();
19 |
20 | enum endian
21 | {
22 | little_endian, // least significant byte first or reverse byte order - Intel x86, ...
23 | big_endian // most significant byte first - Motorola, Sparc, MIPS, ...
24 | };
25 | static endian Endian(int); // convert integer to endian enum
26 | static endian Endian(); // returns endian-ness of current CPU
27 |
28 | enum filetype
29 | {
30 | unknown_filetype,
31 | ansi_filetype,
32 | utf8_filetype,
33 | utf16_filetype,
34 | };
35 | static filetype FileType(int); // convert integer to filetype enum
36 |
37 | enum status
38 | {
39 | no_status,
40 | read_status,
41 | write_status,
42 | };
43 |
44 | bool OpenToRead(const wchar_t* pszFileName);
45 | bool OpenToWrite(const wchar_t* pszFileName, filetype ft = ansi_filetype);
46 | bool OpenToAppend(const wchar_t* pszFileName);
47 |
48 | filetype GetFileType() const;
49 | bool ReadString(CString& string);
50 | bool WriteString(const wchar_t* pszString);
51 |
52 | void Close();
53 |
54 | private:
55 | FILE* m_fp;
56 | endian m_cpu_endian;
57 | endian m_file_endian;
58 | status m_status;
59 | filetype m_filetype;
60 | bool m_bWriteBOM;
61 |
62 | private:
63 | CDosUnicodeTextFile(const CDosUnicodeTextFile&);
64 | CDosUnicodeTextFile& operator=(const CDosUnicodeTextFile&);
65 |
66 | bool ValidateToRead();
67 | bool RewindFilePointer(fpos_t pos_distance);
68 | bool ToggleByteOrder(int count, int sizeof_element, const void* src, void* dst);
69 | bool WriteBOM();
70 | };
71 |
--------------------------------------------------------------------------------
/source/DosVersionInfo.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosVersionInfo.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 | #include "DosVersionInfo.h"
14 |
15 | CDosVersionInfo::CDosVersionInfo()
16 | : m_pVersionInfo(0)
17 | {
18 | }
19 |
20 | CDosVersionInfo::~CDosVersionInfo()
21 | {
22 | if (m_pVersionInfo)
23 | delete[] m_pVersionInfo;
24 | }
25 |
26 | bool CDosVersionInfo::GetFileVersionInfo(const wchar_t* pszModuleName)
27 | {
28 | if (0 == pszModuleName)
29 | return false;
30 |
31 | m_translation.charset = 1252; // default = ANSI code page
32 | memset((VS_FIXEDFILEINFO*)this, 0, sizeof(VS_FIXEDFILEINFO));
33 |
34 | HMODULE hModule = ::GetModuleHandle(pszModuleName);
35 | if (0 == hModule)
36 | return false;
37 |
38 | wchar_t szFilename[_MAX_PATH];
39 | DWORD dwLength = ::GetModuleFileName(hModule, szFilename, DOS_ArrayCount(szFilename));
40 | if (0 == dwLength)
41 | return false;
42 |
43 | DWORD dwDummyHandle = 0;
44 | dwLength = ::GetFileVersionInfoSize(szFilename, &dwDummyHandle);
45 | if (0 == dwLength)
46 | return false;
47 |
48 | if (m_pVersionInfo)
49 | {
50 | delete[] m_pVersionInfo;
51 | m_pVersionInfo = 0;
52 | }
53 |
54 | m_pVersionInfo = new BYTE[dwLength];
55 | if (!::GetFileVersionInfo(szFilename, 0, dwLength, m_pVersionInfo))
56 | return false;
57 |
58 | LPVOID lpBuffer = 0;
59 | UINT uLength = 0;
60 | if (!::VerQueryValue(m_pVersionInfo, L"\\", &lpBuffer, &uLength))
61 | return false;
62 |
63 | *(VS_FIXEDFILEINFO*)this = *(VS_FIXEDFILEINFO*)lpBuffer;
64 |
65 | if (VerQueryValue(m_pVersionInfo, L"\\VarFileInfo\\Translation", &lpBuffer, &uLength) && uLength >= 4)
66 | m_translation = *(TRANSLATION*)lpBuffer;
67 |
68 | return (dwSignature == VS_FFI_SIGNATURE);
69 | }
70 |
71 | CString CDosVersionInfo::GetValue(const wchar_t* pszKeyName)
72 | {
73 | CString str;
74 | if (m_pVersionInfo && pszKeyName)
75 | {
76 | CString query;
77 | query.Format(L"\\StringFileInfo\\%04x%04x\\%s", m_translation.langID, m_translation.charset, pszKeyName);
78 | const wchar_t* pszValue = 0;
79 | UINT uLength = 0;
80 | if (VerQueryValue(m_pVersionInfo, (wchar_t*)(const wchar_t*)query, (LPVOID*)&pszValue, &uLength))
81 | str = pszValue;
82 | }
83 | return str;
84 | }
85 |
--------------------------------------------------------------------------------
/source/DosVersionInfo.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // DosVersionInfo.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | class CDosVersionInfo : public VS_FIXEDFILEINFO
15 | {
16 | public:
17 | CDosVersionInfo();
18 | virtual ~CDosVersionInfo();
19 |
20 | bool GetFileVersionInfo(const wchar_t* pszModuleName);
21 | CString GetValue(const wchar_t* pszKeyName);
22 |
23 | protected:
24 | BYTE* m_pVersionInfo; // all version info
25 |
26 | struct TRANSLATION
27 | {
28 | WORD langID; // language ID
29 | WORD charset; // character set (code page)
30 | } m_translation;
31 | };
32 |
--------------------------------------------------------------------------------
/source/Res/buddy.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dalefugier/DOSLib/bba37b4b851472f61f5554696551bb7a1a5a1472/source/Res/buddy.bmp
--------------------------------------------------------------------------------
/source/Res/doslib.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dalefugier/DOSLib/bba37b4b851472f61f5554696551bb7a1a5a1472/source/Res/doslib.ico
--------------------------------------------------------------------------------
/source/StdAfx.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // StdAfx.cpp
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #include "StdAfx.h"
13 |
--------------------------------------------------------------------------------
/source/StdAfx.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // StdAfx.h
3 | //
4 | // Copyright (c) 1992-2023, Robert McNeel & Associates. All rights reserved.
5 | // DOSLib is a trademark of Robert McNeel & Associates.
6 | //
7 | // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 | // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 | // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 | //
11 |
12 | #pragma once
13 |
14 | #pragma pack (push, 8)
15 | #pragma warning(disable: 4786 4996)
16 |
17 | #define STRICT
18 |
19 | #ifndef _SECURE_ATL
20 | #define _SECURE_ATL 1
21 | #endif
22 |
23 | #ifndef VC_EXTRALEAN
24 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
25 | #endif
26 |
27 | // Modify the following defines if you have to target a platform prior to the ones specified below.
28 | // Refer to MSDN for the latest info on corresponding values for different platforms.
29 | #ifndef WINVER
30 | #define WINVER 0x0501
31 | #endif
32 |
33 | #ifndef _WIN32_WINNT
34 | #define _WIN32_WINNT 0x0501
35 | #endif
36 |
37 | #ifndef _WIN32_WINDOWS
38 | #define _WIN32_WINDOWS 0x0501
39 | #endif
40 |
41 | #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
42 | #define _WIN32_IE 0x0550 // Change this to the appropriate value to target IE 5.5 or later.
43 | #endif
44 |
45 | //#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
46 | #define _AFX_ALL_WARNINGS
47 |
48 | #include "ArxVer.h" // Defines ARX and BRX versions
49 |
50 | #include