Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!watserv1!mims-iris.waterloo.edu!tom From: tom@mims-iris.waterloo.edu (Tom Haapanen) Subject: Frequently Asked Questions, comp.windows.ms.programmer edition Message-ID: <1991May18.122403.17601@watserv1.waterloo.edu> Summary: version 1.16 [last change: th/91-05-14 --- tools, instances] Sender: news@watserv1.waterloo.edu Reply-To: tom@mims-iris.waterloo.edu (Tom Haapanen) Organization: WATMIMS Research Group, University of Waterloo Date: Sat, 18 May 1991 12:24:03 GMT Lines: 371 TABLE OF CONTENTS 0. Index >> 1. Windows newsgroups 2. Windows development tools 3. Windows linkers 4. Windows debuggers 5. Windows RTF word processors 6. Windows SQL products 7. Windows extended memory handling 8. Windows screen prints 9. Device driver development 10. Hiding dialog box controls 11. Adding controls to a non-dialog box window 12. Using floating-point in Windows 13. Changing button colors 14. Programming using large model 15. Linking .FON files 16. Window background colors 17. Subclassing control windows 18. Program instance communication *** A companion posting can be found in comp.windows.ms ** ---------------------------------------------------------------------- 1. Why are there two newsgroups for windows? >> comp.windows.ms.programmer is for discussion about developing Windows software. It is not intended for discussions about Windows software or for questions about the Foobar SVGA drivers. comp.windows.ms is for any Windows discussions that do not concern development of Windows software. -------------------- 2. What tools can I use to develop software for Windows? >> There are a number of options, which are summarized below: 1. Use the Microsoft Windows SDK (Software Development Kit). This is a necessity for heavy-duty application development. The SDK is designed for Microsoft C 5.1/6.0 and Microsoft Macro Assembler 5.1, but it is possible to use it with other compilers, such as Zortech C++ (but not including most Borland compilers). If you plan to use a non-Microsoft compiler, call Microsoft Technical Support to obtain the free Supplemental Compiler Utilities disk. The following compilers are currently known to work: - Microsoft C 5.1+ - Microsoft QuickC 2.0 - Topspeed C # - Watcom C 8.0 - Watcom C/386 for Windows 8.0 - Borland C++ 2.0 - Glockenspiel C++ ?.? - Topspeed C++ # - Zortech C++ 2.06+ - Watcom Fortran 8.1 [announced] - Watcom Fortran/386 for Windows 8.1 [announced] - Microsoft MASM 5.0+ - Stonybrook Modula-2 2.0+ - Topspeed Pascal # - Microsoft Pascal 5.0 - Topspeed Modula-2 2.01+ - Turbo Pascal for Windows 1.0 Of these, Borland C++ and Turbo Pascal for Windows include their own Windows libraries, and do not require you to purchase a Windows SDK (although you will need to buy the SDK documentation, which is available separately). Applications written using Borland C++ will not run in Windows 3.0 Real Mode, nor do they permit the use of huge pointers. Some of the languages that will *NOT* work are: - Microsoft Fortran, QuickPascal, Basic, QuickBasic - Borland Turbo C, Turbo C++, Turbo Pascal, Turbo Basic - Watcom Basic, Pascal - Logitech Modula-2 2. Use an integrated development environment. There are a number of these systems available; the following summarizes the known ones: a. Actor. $495 list ($99 special), free runtime An object-oriented programming environment, with C-like syntax. It allows quick development of programs and/or prototypes, and compiles into an "image" file. This must be distributed along with actor.exe; however, it is possible to combine these into a single .exe if you have the Whitewater Resource Toolkit. b. Smalltalk/V for Windows. $500 list, free runtime An object-oriented programming environment, portable to OS/2 and Macintosh. c. Objectworks\Smalltalk for Windows. $2000 (?) list, runtime $* An object-oriented programming environment, portable to Macintosh, Open Look and Motif. Runtime license fees depend on quantity required; prices range from $375 for one to below $100 for large quantities. d. KnowledgePro for Windows. e. Borland ObjectVision. $395 list ($99 special), runtime $395 A form-oriented environment. Lacks a "true" programming language. Runtime package allows unlimited runtime distribution. f. Asymetrix ToolBook. $395 list, runtime [ARK] $495. A HyperCard-like environment, including hypertext capabilities. Current version is quite slow. Includes a conversion utility to create ToolBook books from HyperCard stacks. Author's Resource Kit includes tools plus a runtime distribution license. g. Spinnaker Plus. ? list, ? runtime. A Windows version of HyperCard, compatible with the Mac original. 3. Use W:CASE or WindowsMAKER, both of which generate C code for Windows. This will still require the use of the SDK. There is also available a shareware code generator UCB/WordPlan (available on cica.cica.indiana.edu), but it's considerably more limited in functionality than the commercial products. No runtime license fees. 5. Use EASEL/Windows. This is an MIS-oriented package intended for development of client-server or cooperative processing applications. 3270 connectivity, SQL, DDE, and Windows --- all for mere $7500. 3. What linkers can be used for Windows programs? >> You can use link4, included on the Microsoft C 5.1/6.0 compiler disks, and available separately with the Supplemental Compiler Utilities diskette (free) from Microsoft. Other linkers that work for Windows development are Optilink/Windows, Borland's tlink and Watcom's wlink. 4. What debuggers can I use for Windows development? >> First of all, if you use Actor, Smalltalk or ToolBook, you're limited to the debugging tools built into those packages. If you are using C, C++ or another conventional language with Windows SDK, you have several choices. 1. In real mode, you are limited to SYMDEB, which is pretty basic. It also requires the use of a second monitor (monochrome for most machines, 8514/A for MCA machines) or a serial terminal. SYMDEB is included with the Windows SDK. 2. In standard mode, you can also use Codeview for Windows (CVW), which is included with Windows SDK, or Logitech's MultiScope (list: $500). CVW, which is similar to the DOS version of Codeview, requires a secondary monitor; a serial terminal can not be used. CVW is included with the Windows SDK; MultiScope is a separate product. Watcom compilers include their own WVideoW debugger. There is also a product called CV/1 (list: $149), which allows you to use CVW without a second monitor. 3. If you have a 386, you have an additional option of using WDEB386, which provides some further debugging features over CVW, at the expense of an antiquated user interface. WDEB386, which is included with the SDK, will work wither with a secondary monitor or a serial terminal. If you are using Borland C++, you can use TDW. TDW can do single- screen debugging (not windowed, but screen-swapping), but only if you are using the standard VGA driver. You may also use TDW for dual- monitor and remote debugging. 5. What word processor can I use to create RTF files for the Windows SDK Help Compiler? >> The following will create RTF files: Ami Professional [RTF compatibility problems] JustWrite Microsoft Works Professional Write Plus Word for DOS Word for Macintosh [Mac] Word for Windows Word for Windows, Working Model [limited file size] WordPerfect [using wp2rtf.arc macros] WriteNow [Mac, NeXT] Xantippe [shareware hypertext tool] You can also create them manually, as the RTF format is plain ASCII, but this will very quickly get very awkward and very tedious. There is a description of the RTF format on cica.cica.indiana.edu (Xantippe can also be found on cica). Some conversion programs (including Doc-to-Doc) will also create RTF files from other native word processor formats. 7. What tools are available for SQL development under Windows? >> The following products provide SQL interfaces: ADI SQL for Windows [announced, not shipping] db_VISTA III [read-only] Gupta SQL Novell Netware SQL [announced, not shipping] Ocelot SQL for Windows [one-time $500 distribution royalty] Paradox [requires SQL Link] Q+E [read-only] XDB SQL C SDK -------------------- 7. What does Windows do with my extended memory? After I run Windows, Norton SI reports that I don't have any extended memory. Is this a bug? >> No, it's not a bug. Windows requires applications to access extended memory using a mechanism known as "XMS". This mechanism is implemented in himem.sys. If you have device=himem.sys in your config.sys, the first XMS call (by Windows or SmartDrive, for example) will transfer control of the extended memory to himem.sys, and thus make it in- accessible to non-XMS applications. 8. How can I take a snapshot of my Windows screen? >> Simple -- just pres PrtScr, and Windows will copy the image to the clipboard, from where you can paste it into your favourite application. Using Alt-PrtScr will take a snapshot of only your current window. -------------------- 9. What do I need to develop device drivers for Windows? >> You need to purchase the Windows Device Driver Kit (DDK). It's available direct from Microsoft, and costs $500. -------------------- 10. How can I hide dialog box controls? >> EnableWindow(GetDlgItem(hDlg, IDD_CONTROLTOHIDE), FALSE); ShowWindow(GetDlgItem(hDlg, IDD_CONTROLTOHIDE), SW_HIDE); UpdateWindow(GetDlgItem(hDlg, IDD_CONTROLTOHIDE)); 11. How can I add pushbuttons and edit controls to a "normal" window which is not a dialog box? >> You can do this by simply calling CreateWindow() with one of the pre- defined child window control class names (see table 4.2 in the SDK reference manual). 12. Why does compiling a Windows application with emulator floating-point cause corrupted code segments when running on a non-87 machine? And should I use emulator or alternate floating-point math? >> The emulated floating point tries to used the coprocessor. When it does not find one on startup, it patches the code to use the software floating point. Patching does however not adapt the code-segment checksum, thus the windows debugging version chokes when it horridly founds that some- thing terrible must have happened to the code. Get rid of it by setting 'EnableSegmentChecksum=0' in the [debug] section of WIN.INI; the problem only affects debugging versions of Windows. The alternate math package is faster on non-x87 machines, but slower on those equipped with a math chip. Depending on your application, you might want to ship either, or both. Borland C++ does not support the alternate math package. -------------------- 13. How do I change the button colors? >> In Windows 3.0, the button face is defined by two colors. The grey (white if ega) face and a dark grey (grey if ega) shadow. The colors also change when the button goes from a normal to pushed in state. The WM_CTLCOLOR message only allows you to change one color at a time so to which of the button face colors should this apply? (Windows 2 button faces had only one color so it made sense.) Maybe something tricky could have been done by using the background color for the shadow and foreground color for the face and perhaps doing something strange to get the text color in another way... And how do you return 2 brushes (you now need a foreground and a background brush)? Or maybe even better, make colors a property of the window and some windows could have multiple color properties... Anyway, Windows doesn't look at the WM_CTLCOLOR message for buttons and thus doesn't allow you to change the button colors. Try it with a listbox instead... The only way to change button colors is to specify ButtonColor=, ButtonShadow= and ButtonText= in the [Colors] section of your win.ini file. 14. Why should I not use large model in my Windows application? Can I do it anyway? >> Yes, you can do it. There are several problems with using large model, though: i. Your program's data memory will be fixed in real mode. Effectively, your application will cripple any real-mode Windows system. ii. You will only be able to have one instance of your application active at any one time. iii.Your application will run more slowly. You should consider very carefully before you decide that large model is the only way to go; the preferred method is to use medium model, and to allocate far data as required. Another alternative is to use Watcom C/386 for development; this will let you use a single 4GB segment, and 32-bit registers, increasing your applications performace substantially (but limiting it to running in 386 enhanced mode). 15. I get errors linking fonts into a .FON file? What's the problem? >> The linker provided with the Windows 3.0 SDK will produce the following error when linking fonts: Link Error L2049 no segments defined The above LINK error is a bug in link. The fix is to run exehdr /r on the .exe file, and then run rc on it. The Win3 SDK linker incorrectly detects an error, and marks the resulting .exe file with some kind of error bit, even though the rest of the exe file is ok. Exehdr /r will reset this "error bit", after which rc will work just fine. An alternate fix is to use link4 from Windows 2.x SDK. 16. Should I use GetStockObject( GCW_WHITEBRUSH ) for my window background? >> Not unless you insist on a white background. It is preferable to use the Control Panel-defined window background color instead: WinClass.hbrBackground = COLOR_WINDOW + 1; 17. The SDK Guide to Programming says that I shouldn't subclass standard edit controls. Why is this? >> That's not strictly true. You can *subclass* them by having your own window procedure handle the messages for the windows you create. What is definitely a bad idea is *superclassing* a standard control by doing a SetClassLong() to change the window procedure for *all* such windows, as this will affect all edit controls in all applications currently running in the Windows session. -------------------- [ \tom haapanen --- university of waterloo --- tom@mims-iris.waterloo.edu ] [ "i don't even know what street canada is on" -- al capone ]