PRODUCT : Borland C++ NUMBER : 8502 VERSION : All OS : All DATE : October 25, 1993 PAGE : 1/5 TITLE : C++ Language News - Volume 1 Number 3 _C++ Support News_ ---------------------------------------------------------------- volume 1, number 3 May 3, 1993 ---------------------------------------------------------------- WE LIKE YOUR FEEDBACK! One of the suggestions that we have heard about the format of the newsletter is that you would like to see common bugs be highlighted and documented here. As of this issue, we will be beginning a column which will be addressing bugs which have been confirmed and possible workarounds. As with the various programming tips included in each issue, this will become a standard column. To further disseminate information, the Knowledge Base CD, the publicly available bug list known for our compilers has been reduced in price. The cost for this CD is now $49.95 and can be ordered from our Order Desk at (800)331-0877, or by contact- ing Customer Service on CompuServe at GO BORCS. Likewise, if you have concerns which can be addressed here in the newsletter along with suggestions as to the information presented, you now have a means to get back in touch with us via CompuServe address 75410,1763. Your feedback is greatly appreciated as we continue to modify and tailor this newsletter to reflect your development needs. If you have followed the Getting Started pamphlet included with Turbo C++ Visual Edition for Windows, then you may have exper- ienced a general protection fault when following the directions for creating the example application outlined in the document. The central issue in this memory violation is the ordering of the components within the dialog resource. Having a button as the last item is the culprit in generating the exception. If the button is anything other than the last item specified, the GP-fault can be circumvented. For example, move the addition of the button before the static text control, and this will allow the application to work as expected. DOS PRODUCT : Borland C++ NUMBER : 8502 VERSION : All OS : All DATE : October 25, 1993 PAGE : 2/5 TITLE : C++ Language News - Volume 1 Number 3 1. What is the precision of floats, doubles, and long doubles? In FLOAT.H, the following constants are defined -- mantissa digits: #define FLT_MANT_DIG 23 #define DBL_MANT_DIG 53 #define LDBL_MANT_DIG 64 Taking 2 to these powers approximately yields 10e6, 10e15, and 10e19. Each of these exponents corresponds to the num- ber of digits which are representable. FLOAT.H also lists these values as -- #define FLT_DIG 6 #define DBL_DIG 15 #define LDBL_DIG 19 OS/2 1. By default, IBM's C/2 compiler will not place an under- score at the beginning of function names found in object files upon compiling source files to object modules. This must be considered when linking libraries, DLL's, and/or object files created with their product and Borland C++ for OS/2 which by default will place an underscore before functions names within object code. This behavior can be changed by unchecking the Generate underbars checkbox found under Project|View Settings|Compiler|Code Generation. On the command-line, disable this feature by using the -u- switch. 2. Small sized icons may be displayed in only black and white. If any of the black and white devices are listed in the icon editor for the desktop object, the icon will only be displayed in black and white when iconized. This behavior can be changed by -- a. right click on a desktop object b. click on the arrow to the right of "Open" c. click on "Settings" d. click on the "General" tab e. click on the "Edit" button PRODUCT : Borland C++ NUMBER : 8502 VERSION : All OS : All DATE : October 25, 1993 PAGE : 3/5 TITLE : C++ Language News - Volume 1 Number 3 This will invoke the Icon Editor where the following should be done -- f. click on the "Files" menu bar item g. click on "Save" At this point, a list box will appear showing the devices supported by this object. Click once on all the listed devices except for the following -- Independent Color Form (= VGA) 8514 - 16 colors When finished, only the above devices will be highlighted. Save these changes by -- h. click on "Save" i. double click on the "System - Settings" system menu icon to exit the "Settings" option. WINDOWS 1. If you have a static icon control inside a dialog box, there is a trick that you can use to change it. There are little used messages which allow you to change the icon displayed in the control which are STM_GETICON and STM_SETICON. The STM_SETICON message can be used to change the icon displayed in an icon static control in a dialog box. On the other hand, STM_GETICON allows you to retrieve the handle of an icon in a dialog box. You must include the icon within your resource script, or use any of the predefined Windows icons. The LoadIcon() API function is used to get a handle to the icon, and SendDlgItemMessage() changes the icon. eg. hIcon = LoadIcon(hInstance, "FOO_ICON"); hPrev = (HICON) Send DlgItemMessage(hDlgBox, IDD_ICON, STM_SETICON, (WPARAM) hIcon, 0); IDD_ICON is an identifier which refers to the resource name of the static icon control as defined in the resource script. Notice that the SendDlgItemMessage() function call PRODUCT : Borland C++ NUMBER : 8502 VERSION : All OS : All DATE : October 25, 1993 PAGE : 4/5 TITLE : C++ Language News - Volume 1 Number 3 returns the previous icon's handle. If an error occurs, the return value will be zero. Likewise, a handle to the current icon within a dialog box can be obtained with the following code -- hIcon = (HICON) SendDlgItemMessage(hDlgBox, IDD_ICON, STM_GETICON, 0, 0L); As before, the hDlgBox parameter is a handle to the dialog box and IDD_ICON refers to the identifier of the static icon control. TURBO VISION 1. How can two Turbo Vision applications be made to run simul- taneously under DESQView? One of the members of class TScreen is the static data member far char* screenBuffer which points to the portion of memory where Turbo Vision updates the screen. Though this pointer usually points to video memory, it must be changed if Turbo Vision applications are to run under DESQView since this en- vironment will not allow two Turbo Vision applications to directly update the screen simultaneously. This can be solved by obtaining a pointer to DESQView's virtual screen, and set TScreen::screenBuffer to this pointer. PARADOX ENGINE 1. Many problems can be pinpointed in Paradox Engine applica- tions by checking the return code from Engine function calls. Simply write a function which accepts values and character strings and use the preprocessor to pass on the origin of the error. #define error(x) errordump(x, #x, __LINE__, __FILE__) QUIZ Why does the following program call function close()? PRODUCT : Borland C++ NUMBER : 8502 VERSION : All OS : All DATE : October 25, 1993 PAGE : 5/5 TITLE : C++ Language News - Volume 1 Number 3 #include void close(void) { printf("closing...\n"); } void main(void) { FILE *f; f = fopen("duh", "w"); } NEW TECHNICAL INFORMATION DOCUMENTS AVAILABLE Some of the latest technical information documents available to customers include the following. 1012 interrupt chaining & modifying registers 1014 casting from a base pointer to a derived pointer 1015 beta testing application form 1021 how to extract text from a Turbo Vision TEdit buffer 1024 using member function pointers 1152 example of a function returning a pointer to a function 1160 modifying Turbo Vision Menus at runtime 1332 using the IDE to create programs written entirely in assembly language These documents can be found on either LIB-2 of BCPPDOS and BCPPWIN under CompuServe, Borland's DLBBS at (408)431-5096, TechFAX at (800)822-4269, or OAS at (408)431-5250. DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.