Code Comments
Programming Forum and web based access to our favorite programming groups.Hello Everyone, If you like to create a dialogBox dynamically on-the-fly with COBOL language, and without having to create and load a .DLL file during runtime execution, simply compile and run this program that I have put together as an example of using a memory template, to create an empty dialogBox, then you can append to it several controls based on the needs of the parent program, or perhaps on some events that occurs within the main program. This program was developed and tested with a Micro Focus COBOL compiler (Net Express) and works fine like a charm. However, before you create the .EXE file on your machine, simply include your own library file (.DLL) that have a bitMap and an icon files into the same folder, and please ensure to include the following library files from your SDK library as well: user32.lib, kernel32.lib, comctl32.lib, gdi32.lib. Personally, I wanted to customize the skin of the dialogBox so I can have a more sophisticated looking dialogBox, or perhaps to have a professional image on the screen (Oracle database are notorious of doing that). Unfortunately, I don't know how to do that, so, if you find some sample programs or maybe a website link that shows how to customize the skin and appreance of a dialogBox, please please let me know. Regards. ;--)) Kellie Fitton. *>---- My Cobol Sample Program --------<* $set ans85 case align"8" defaultbyte"00" mfoo identification division. program-id. Dialogue. author. Kellie Fitton (April 10, 2005). Environment Division. CONFIGURATION SECTION. special-names. call-convention 74 is WinAPI. SOURCE-COMPUTER. IBM-ATX. OBJECT-COMPUTER. IBM-ATX. INPUT-OUTPUT SECTION. FILE-CONTROL. DATA DIVISION. FILE SECTION. working-storage section. 78 MyLibrary value "MyDLL.DLL" & x"0000". 78 IDCANCEL value h"0002". 78 WM-INITDIALOG value h"0110". 78 WM-COMMAND value h"0111". 78 WM-HELP value h"0053". 78 WM-CLOSE value h"0010". 78 WM-CTLCOLOREDIT value h"0133". 78 WM-SETFONT value h"0030". 78 WM-SETICON value h"0080". 78 WM-USER value h"0400". 78 BM-SETIMAGE value h"00f7". 78 TTM-ACTIVATE value WM-USER + 1. 78 TTM-ADDTOOL value WM-USER + 4. 78 TTM-SETTOOLINFO value WM-USER + 9. 78 ID-PUSHBUTTON1 value 100. 78 ID-PUSHBUTTON2 value 101. 78 ID-PUSHBUTTON3 value 102. 78 ID-PUSHBUTTON4 value 103. 78 ID-MYICON value 107. 78 ID-MYBITMAP value 102. 01 uint is typedef pic 9(9) comp-5. 01 int is typedef pic s9(9) comp-5. 01 HINSTANCE is typedef int. 01 HANDLE is typedef int. 01 LONG is typedef pic s9(9) comp-5. 01 ULONG is typedef pic 9(9) comp-5. 01 DWORD is typedef ulong. 01 SHORT is typedef pic s9(4) comp-5. 01 uns-short is typedef pic 9(4) comp-5. 01 data-pointer is typedef pointer value null. 01 LPTSTR is typedef usage data-pointer. 01 HFONT is typedef usage data-pointer. 01 ushort is typedef uns-short. 01 HWND is typedef int. 01 WORD is typedef uns-short. 01 COLORREF is typedef. 03 red pic x comp-5 value 0. 03 green pic x comp-5 value 0. 03 blue pic x comp-5 value 0. 03 leadByte pic x comp-5 value 0. 01 ClientRect. 03 xleft int. 03 ytop int. 03 xright int. 03 ybottom int. 01 RECT is typedef. 03 rleft int. 03 rtop int. 03 rright int. 03 rbottom int. 01 ToolInfo. 03 TOOLsize UINT. 03 TOOLflags UINT. 03 TOOLhwnd HWND. 03 TOOLuId UINT. 03 TOOLrect RECT. 03 TOOLhinst HINSTANCE. 03 TOOLtext LPTSTR. 01 InitCommonControlsEx is typedef. 03 dwSize DWORD value h"0000". 03 dwICC DWORD value h"0107". 01 POINT is typedef. 02 POINTx LONG. 02 POINTy LONG. 01 HELPINFO. 02 HELPSize UINT. 02 HELPContextType int. 02 HELPCtrlId int. 02 HELPItemHandle HANDLE. 02 HELPContextId DWORD. 02 HELPMousePos POINT. 01 DLGBoxTemplate. 02 DLGtemplateEX. 03 DLGver WORD value h"0001". 03 DLGsignature WORD value h"ffff". 03 DLGhelpID DWORD value h"0500". 03 DLGexStyle DWORD value h"0001". 03 DLGstyle DWORD value h"94c82ac4". 03 DLGcontrolItems WORD value h"0000". 03 DLGx short value h"0000". 03 DLGy short value h"0000". 03 DLGcx short value 295. 03 DLGcy short value 140. 03 DLGmenu WORD value h"0000". 03 DLGwindowClass WORD value h"0000". 03 DLGtitle pic x(64) value all x"00". 03 DLGpointSize WORD value 18. 03 DLGweight WORD value 700. 03 DLGitalic WORD value h"0000". 03 DLGcharSet WORD value h"0001". 03 DLGtypeFace pic x(32) value all x"00". 03 Filler pic x(02) value all x"00". 01 DLGBoxPointer procedure-pointer value null. 01 CommonControls InitCommonControlsEx. 01 MyColorRef COLORREF. 01 hNewFont HFONT. 01 hDC INT. 01 hIcon pic s9(9) comp-5 value 0. 01 hDLGBox pic s9(9) comp-5 value 0. 01 hStatic1 pic s9(9) comp-5 value 0. 01 hEdit1 pic s9(9) comp-5 value 0. 01 hStatic2 pic s9(9) comp-5 value 0. 01 hEdit2 pic s9(9) comp-5 value 0. 01 hStatic3 pic s9(9) comp-5 value 0. 01 hEdit3 pic s9(9) comp-5 value 0. 01 hStatic4 pic s9(9) comp-5 value 0. 01 hEdit4 pic s9(9) comp-5 value 0. 01 hTabControl pic s9(9) comp-5 value 0. 01 hTabFace pic s9(9) comp-5 value 0. 01 hImageBox pic s9(9) comp-5 value 0. 01 hButton1 pic s9(9) comp-5 value 0. 01 hButton2 pic s9(9) comp-5 value 0. 01 hButton3 pic s9(9) comp-5 value 0. 01 hButton4 pic s9(9) comp-5 value 0. 01 MyEdit1 pic x(32) value all x"00". 01 MyEdit2 pic x(32) value all x"00". 01 MyEdit3 pic x(32) value all x"00". 01 MyEdit4 pic x(32) value all x"00". 01 hInst pic s9(9) comp-5 value 0. 01 hPrevInstance pic s9(9) comp-5 value 0. 01 lpszCmdLine POINTER value null. 01 nCmdShow pic s9(9) comp-5 value 0. 01 hWinInit pic s9(9) comp-5 value 0. 01 MultiByteString pic x(256) value spaces. 01 WideCharString pic x(512) value spaces. 01 WideCharSize pic s9(9) comp-5 value 512. 01 hBitmap pic 9(9) comp-5 value 0. 01 hInstResource usage pointer value null. 01 hToolTip usage pointer value null. 01 ToolTipText pic x(32) value z"My Cobol ToolTip". 01 hPS pic s9(9) comp-5 value 0. 01 hSolidBrush pic s9(9) comp-5 value 0. local-storage section. 01 MyData. 03 ls-mResult pic s9(9) comp-5. 01 ls-wParam. 03 ls-wId ushort. 03 ls-wNotifyParam ushort. linkage section. 01 lnk-hWnd HWND. 01 lnk-iMessage UINT. 01 lnk-wParam. 03 lnk-wParam-LoWord pic 9(4) comp-5. 03 lnk-wParam-HiWord pic 9(4) comp-5. 01 lnk-lParam. 03 lnk-lParam-LoWord pic 9(4) comp-5. 03 lnk-lParam-HiWord pic 9(4) comp-5. procedure division WinApi. 100-main-section. call "cob32api" end-call. call "PC_WIN_INIT" using hInst hPrevInstance lpszCmdLine nCmdShow returning hWinInit end-call. move length of InitCommonControlsEx to dwSize. call WinAPI "InitCommonControlsEx" using by reference CommonControls returning Return-code end-call. call WinAPI "LoadLibraryA" using by reference MyLibrary returning hInstResource end-call. move spaces to MultiByteString move "My Title..." to MultiByteString. move x"00" to MultiByteString (12:1). perform UnicodeText. move WideCharString to DLGtitle. move spaces to MultiByteString move "Arial" to MultiByteString. move x"00" to MultiByteString (6:1). perform UnicodeText. move WideCharString to DLGtypeface. set DLGBoxPointer to entry "MyDLGBoxProc". call winapi "DialogBoxIndirectParamA" using by value hInst by reference DLGBoxTemplate by value h"0000" size 4 by value DLGBoxPointer by value h"0000" size 4 returning hDLGBox end-call. call WINAPI "ShowWindow" using by value hDLGbox by value nCmdShow returning Return-Code end-call call WinAPi "DestroyWindow" using by value hDLGbox returning Return-Code end-call. stop run. UnicodeText Section. if MultiByteString not = spaces call winapi "MultiByteToWideChar" using by value h"0000" size 4 by value h"00000001" by reference MultiByteString by value -1 size 4 by reference WideCharString by reference WideCharSize returning Return-Code end-call end-if. exit section. entry "MyDLGBoxProc" WinAPI using by value hDLGbox by value lnk-iMessage by value lnk-wParam by value lnk-lParam. move 0 to ls-mResult evaluate lnk-iMessage when WM-INITDIALOG call winapi "GetDC" using by value hDLGbox returning hDC end-call call winapi "CreateFontA" using by value 18 size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value 700 size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0001" size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value 48 size 4 by reference "Arial" & x"0000" returning hNewFont end-call call winapi "SetMapperFlags" using by value hDC by value h"0001" size 4 returning Return-Code end-call call winapi "ReleaseDC" using by value hDLGbox by value hDC returning Return-Code end-call move 0 to red of MyColorRef move 255 to green of MyColorRef move 255 to blue of MyColorRef call winapi "CreateSolidBrush" using by reference MyColorRef returning hSolidBrush end-call if hInstResource not = null call WINAPI "LoadIconA" using by value hInstResource by value ID-MYICON size 4 returning hIcon end-call call winapi "SendMessageA" using by value hDLGbox by value WM-SETICON size 4 by value h"0000" size 4 by value hIcon returning Return-Code end-call end-if call winapi "CreateWindowExA" using by value h"0080" size 4 by reference "tooltips_class32" & x"0000" by reference x"0000" by value h"80000003" by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hToolTip end-call if hToolTip not = null call winapi "SetWindowPos" using by value hToolTip by value -1 size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0000" size 4 by value h"0013" size 4 returning return-code end-call initialize ToolInfo move length of ToolInfo to TOOLsize call winapi "GetClientRect" using by value hDLGbox by reference ClientRect returning Return-Code end-call move xLeft to rLeft of ToolRect move yTop to rTop of ToolRect move xRight to rRight of ToolRect move yBottom to rBottom of ToolRect move 16 to TOOLflags move hDLGbox to TOOLhwnd move hInst to TOOLhinst set TOOLtext to address of ToolTipText call winapi "SendMessageA" using by value hToolTip by value TTM-ADDTOOL size 4 by value h"0000" size 4 by reference ToolInfo returning Return-Code end-call call winapi "SendMessageA" using by value hToolTip by value TTM-SETTOOLINFO size 4 by value h"0000" size 4 by reference ToolInfo returning Return-Code end-call call winapi "SendMessageA" using by value hToolTip by value TTM-ACTIVATE size 4 by value h"0001" size 4 by reference ToolInfo returning Return-Code end-call end-if call WINAPI "CreateWindowExA" using by value h"0001" size 4 by reference "SysTabControl32" & x"0000" by reference x"0000" by value h"54002000" by value 15 size 4 by value 8 size 4 by value 560 size 4 by value 250 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hTabControl end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "STATIC" & x"0000" by reference "Data Entry1:" & x"0000" by value h"50000000" by value 42 size 4 by value 34 size 4 by value 80 size 4 by value 22 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hStatic1 end-call call WINAPI "CreateWindowExA" using by value h"00000200" by reference "EDIT" & x"0000" by reference MyEdit1 by value h"50810000" by value 130 size 4 by value 30 size 4 by value 243 size 4 by value 26 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hEdit1 end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "STATIC" & x"0000" by reference "Data Entry2:" & x"0000" by value h"50000000" by value 42 size 4 by value 74 size 4 by value 80 size 4 by value 22 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hStatic2 end-call call WINAPI "CreateWindowExA" using by value h"00000200" by reference "EDIT" & x"0000" by reference MyEdit2 by value h"50810000" by value 130 size 4 by value 70 size 4 by value 243 size 4 by value 26 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hEdit2 end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "STATIC" & x"0000" by reference "Data Entry3:" & x"0000" by value h"50000000" by value 42 size 4 by value 114 size 4 by value 80 size 4 by value 22 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hStatic3 end-call call WINAPI "CreateWindowExA" using by value h"00000200" by reference "EDIT" & x"0000" by reference MyEdit3 by value h"50810000" by value 130 size 4 by value 110 size 4 by value 243 size 4 by value 26 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hEdit3 end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "STATIC" & x"0000" by reference "Data Entry4:" & x"0000" by value h"50000000" by value 42 size 4 by value 154 size 4 by value 80 size 4 by value 22 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hStatic4 end-call call WINAPI "CreateWindowExA" using by value h"00000200" by reference "EDIT" & x"0000" by reference MyEdit4 by value h"50810000" by value 130 size 4 by value 150 size 4 by value 243 size 4 by value 26 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hEdit4 end-call if (hEdit1 not = 0) and (hEdit2 not = 0) and (hEdit3 not = 0) and (hEdit4 not = 0) call winapi "SendMessageA" using by value hEdit1 by value WM-SETFONT size 4 by value hNewFont by value h"0001" size 4 returning Return-Code end-call call winapi "SendMessageA" using by value hEdit2 by value WM-SETFONT size 4 by value hNewFont by value h"0001" size 4 returning Return-Code end-call call winapi "SendMessageA" using by value hEdit3 by value WM-SETFONT size 4 by value hNewFont by value h"0001" size 4 returning Return-Code end-call call winapi "SendMessageA" using by value hEdit4 by value WM-SETFONT size 4 by value hNewFont by value h"0001" size 4 returning Return-Code end-call end-if call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "BUTTON" & x"0000" by value h"0000" size 4 by value h"50000080" size 4 by value 390 size 4 by value 25 size 4 by value 160 size 4 by value 160 size 4 by value hDLGbox by value h"0000" size 4 by value hInst by value h"0000" size 4 returning hImageBox end-call if hInstResource not = null call winapi "LoadImageA" using by value hInstResource by value ID-MYBITMAP size 4 by value h"0000" size 4 by value 152 size 4 by value 152 size 4 by value h"0000" size 4 returning hBitmap end-call call winapi "SendMessageA" using by value hImagebox by value BM-SETIMAGE size 4 by value h"0000" size 4 by value hBitmap returning Return-Code end-call end-if call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "BUTTON" & x"0000" by reference "Push Button1" & x"0000" by value h"50010001" by value 35 size 4 by value 200 size 4 by value 105 size 4 by value 40 size 4 by value hDLGbox by value ID-PUSHBUTTON1 by value hInst by value h"0000" size 4 returning hButton1 end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "BUTTON" & x"0000" by reference "Push Button2" & x"0000" by value h"50010000" by value 170 size 4 by value 200 size 4 by value 105 size 4 by value 40 size 4 by value hDLGbox by value ID-PUSHBUTTON2 by value hInst by value h"0000" size 4 returning hButton2 end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "BUTTON" & x"0000" by reference "Push Button3" & x"0000" by value h"50010000" by value 305 size 4 by value 200 size 4 by value 105 size 4 by value 40 size 4 by value hDLGbox by value ID-PUSHBUTTON3 by value hInst by value h"0000" size 4 returning hButton3 end-call call WINAPI "CreateWindowExA" using by value h"0000" size 4 by reference "BUTTON" & x"0000" by reference "Push Button4" & x"0000" by value h"50010000" by value 440 size 4 by value 200 size 4 by value 105 size 4 by value 40 size 4 by value hDLGbox by value ID-PUSHBUTTON4 by value hInst by value h"0000" size 4 returning hButton4 end-call if hEdit1 not = 0 call winapi "SetFocus" using by value hEDIT1 returning Return-Code end-call end-if continue when WM-CTLCOLOREDIT move lnk-wParam to hPs if hNewFont not = null call winapi "SelectObject" using by value hPS by value hNewFont returning Return-Code end-call end-if if hSolidBrush not = 0 call winapi "SelectObject" using by value hPS by value hSolidBrush returning Return-Code end-call call winapi "SetBkMode" using by value hPS by value h"0002" size 4 returning Return-Code end-call move 0 to red of MyColorRef move 255 to green of MyColorRef move 255 to blue of MyColorRef call winapi "SetBkColor" using by value hPS by value MyColorRef returning Return-Code end-call move 0 to red of MyColorRef move 0 to green of MYColorRef move 128 to blue of MyColorRef call winapi "SetTextColor" using by value hPS by value MyColorRef returning Return-Code end-call move hSolidBrush to ls-mResult end-if continue when WM-HELP call winapi "WinHelpA" using by value hDLGbox by reference "C:\WINDOWS\HELP\WINHLP32.HLP" & x"0000" by value h"000b" size 4 by value h"0000" size 4 returning Return-Code end-call continue when WM-COMMAND move lnk-wParam to ls-wParam evaluate ls-wID when IDCANCEL call winapi "SendMessageA" using by value hDLGbox by value WM-SETICON size 4 by value h"0000" size 4 by value h"0000" size 4 returning Return-Code end-call call winapi "SendMessageA" using by value hDLGbox by value BM-SETIMAGE size 4 by value h"0000" size 4 by value h"0000" size 4 returning Return-Code end-call call winapi "ReleaseDC" using by value hDLGbox by value hPS returning Return-Code end-call call winapi "DeleteObject" using by value hNewFont returning Return-Code end-call call winapi "DeleteObject" using by value hSolidBrush returning Return-Code end-call call WinAPI "EndDialog" using by value hDLGbox by value lnk-wParam returning Return-Code end-call continue when ID-PUSHBUTTON1 continue when ID-PUSHBUTTON2 continue when ID-PUSHBUTTON3 continue when ID-PUSHBUTTON4 continue when other call WINAPI "DefWindowProcA" using by value hDLGbox by value lnk-iMessage by value lnk-wParam by value lnk-lParam returning ls-mResult end-call end-evaluate when WM-CLOSE call WinAPI "EndDialog" using by value hDLGbox by value lnk-wParam returning Return-Code end-call continue when other continue end-evaluate exit program returning ls-mresult. end program Dialogue.
Post Follow-up to this messageKellie Fitton wrote: > Hello Everyone, > > If you like to create a dialogBox dynamically on-the-fly with COBOL > language, and without having to create and load a .DLL file during > runtime execution, simply compile and run this program that I have > put together as an example of using a memory template, to create an > empty dialogBox, then you can append to it several controls based > on the needs of the parent program, or perhaps on some events that > occurs within the main program. > > This program was developed and tested with a Micro Focus COBOL > compiler (Net Express) and works fine like a charm. However, before > you create the .EXE file on your machine, simply include your own > library file (.DLL) that have a bitMap and an icon files into the > same folder, and please ensure to include the following library > files from your SDK library as well: > user32.lib, kernel32.lib, comctl32.lib, gdi32.lib. > > Personally, I wanted to customize the skin of the dialogBox so I > can have a more sophisticated looking dialogBox, or perhaps to have > a professional image on the screen (Oracle database are notorious > of doing that). Unfortunately, I don't know how to do that, so, if > you find some sample programs or maybe a website link that shows > how to customize the skin and appreance of a dialogBox, please > please let me know. Regards. ;--)) Congrats, plus the source that you sent me so that I can visually see the Dialog Box. I'll reply later privately with some 'constructive criticisms' - but let's see what else you get. Do you want to translate your last paragraph :-). What exactly do you want to skin ? Are you really asking how can I merge a Dialog with data from a Database. If that's your question then within N/E :- Menu Bar------>Tools-------->ESQL Assistant Give the background some reading, but steps are, assuming use of MS Access :- 1. Create your MS Database xxxxxx.mdb; although if you want to "play" Micro Focus provides Sample1 and Sample2. If you installed ODBC/SQL as a feature then these two mdb's should appear listed under the ODBC driver, "System". Check out the ODBC through the Control Panel. 2. Once you have a Database 'attached' to the ODBC Driver then you can use the ESQL Assistant above. Click on the DB you are interested in and expand to show all tables contained therein. For each table you can now generate a set of SQL Statements. Use the icon at the top to Copy/Paste into your COBOL source the SQL statement you generated. Also for each table use the ESQL feature :- Auxiliary Code--->Host Variable Declaratives This generates a three section copyfile :- 1. Field definitions for SQL - VARCHAR, INT etc. 2. Field definitions for COBOL - pic x(??) or pic x(4) comp-5 etc for numerics 3. Field definitions for SQL NULLs I extract #2 to keep it as a separate copyfile so that I can use it in a File Edit Class and in the MyTable Class. I only need 1 and 3 in the latter, because all my SQL is segregated into this one class per table. (Don't have to do it that way - but that's the approach I took). Same principle should apply if you are using any other DB software. There's a pretty comprehensive on-line manual dealing with DBs. If you are looking for a 'pattern' to display records from a DB - If you like the Listview approach then in effect you have a 'collection' containing the following. (In my case, *existing* records from the DB are listed alpha ascending in a ListBox - from which the user can choose. Note - any record 'adds, 'changes' or 'deletes' mean you have to update the Listbox and do a 'refresh' display :- 1. Display Dialog and focus on Customer A/c # (Note - in my case I focus on the Listbox but the user can select the empty Customer # to enter the key, *supposedly" for a new record - if they choose a legit key THEN display the *existing* record). 2. User enters zeroes/spaces - Quit 3. Otherwise PERFORM/CALL/INVOKE "Read-file" using key returning detailed record or blank record. 4. Detailed - display and accept changes or DELETE 4a PB-OK - Changes made - check for validity - PERFORM/CALL/INVOKE "rewrite/update" 4b. OK to delete ? PERFORM/CALL/INVOKE 'delete-record" using key 5. Blank new record - tab through accepting fields until done. (NB : Once you have accepted/displayed a Customer # as legit - make it READ ONLY - you don't want the user buggering around with the number, otherwise he is going to send your program off into space and screw up your file/DB !) 5a. Then allow user to 'jump' around fields correcting previous typos, and of course any errors resulting from validity checks in 5b below. 5b. PB-OK - validity checks on new record - PERFORM/CALL/INVOKE 'write/insert-record" 6. PB-Cancel - ignore what has happened so far and display fresh screen (dialog) Jimmy
Post Follow-up to this messageOn 10 Apr 2005 17:56:44 -0700, "Kellie Fitton" <KELLIEFITTON@YAHOO.COM> wrote: Very nice code. I have a few nitpicks on style: > SOURCE-COMPUTER. IBM-ATX. > OBJECT-COMPUTER. IBM-ATX. Leave them out. They don't do anything. > > INPUT-OUTPUT SECTION. > FILE-CONTROL. > > DATA DIVISION. > FILE SECTION. Same. > 78 MyLibrary value "MyDLL.DLL" & x"0000". Change to 78 MyLibrary value z"MyDLL.DLL". > call "cob32api" > end-call. Delete end-call. The only scope delimiters you need are end-if, end-evaluate and end-perform. > returning Return-code Delete. That's what it does by default. > end-if > continue Delete continue.
Post Follow-up to this messageAnd of course what Robert means <G>, Is that *IF* you were coding to his coding standards, this is what HE would do. Of the items that he points out, there is NOTHING wrong with how you have co ded them. Personally, I would even argue that using "MyDLL.DLL" & x"0000". (which conforms to the ISO 2002 Standard *and* the "&" operator is in EVERY X/Open conforming compiler) is better than using a z-literal - which is available in Micro Focus and IBM - but (as far as I know) no other compiler. "continue" following an END-IF can be useful for "break-point" debugging, bu t in MOST cases is "pretty useless". Do *not* remove the "Data Division" header (if that is what RW meant) if you have a Working-Storage (or Local-Storage) Section unless you want to create source code that will compile with Micro Focus but NO other compiler that I know of. (Removing "empty" section headers is reasonable, but doesn't really accomplish anything except POTENTIALLY making it harder to add new sections later on.) Using scope-terminators with unconditional statements MAY prove beneficial w hen doing future maintenance, but I agree they certainly do NOT add anything "today". Having a scope terminator (End-Call) after an unconditional CALL statement and immediately before a period (full stop) is particularly redund ant (he said redundantly <G> ) - but it does NOT hurt anything (unless it violate s YOUR "shop standard"). -- Bill Klein wmklein <at> ix.netcom.com "Robert Wagner" <spamblocker-robert@wagner.net> wrote in message news:d2qj51ti4r5d6rqspgqoo3u4hko1is1ppn@ 4ax.com... > On 10 Apr 2005 17:56:44 -0700, "Kellie Fitton" > <KELLIEFITTON@YAHOO.COM> wrote: > > Very nice code. I have a few nitpicks on style: > > > Leave them out. They don't do anything. > > Same. > > > Change to 78 MyLibrary value z"MyDLL.DLL". > > > Delete end-call. The only scope delimiters you need are end-if, > end-evaluate and end-perform. > > > Delete. That's what it does by default. > > > Delete continue. >
Post Follow-up to this messageCharles, this is just a simple program to demonstrate the use of the win32 API's functions, which is readily documented on the MSDN's website and in their SDK software. The code is pretty much straight forward and self explanatory. However, I did not include the style variables in my code just to keep it short and simple, beside, I used the standard styles for all the controls, which is avaiables in the windows.h and the commctrl.h files. Kellie.
Post Follow-up to this messageRobert, I like to use the "end-call" and "returning Return-Code" clause for two simple reasons: 1). End-call helps me to visualize the end of the call, thus I know there is no more arguments to follow after that. 2). Some times I need to debug and analyze the return-code --- so, its there for me. I tend to use the continue clause out of a habit, simply because, if I use a window message for example, with no cobol code to follow, the compiler would raise a falg unless I include the continue clause. For example: WM-MOVE continue without the continue clause, I would get an error message from the compiler. Kellie.
Post Follow-up to this message> WM-MOVE > continue > without the continue clause, I would get an error message from the compiler. You shouldn't get an error message unless this is the last WHEN in an EVALUATE, but you may get strange effects at run-time. When two or more WHENs are contiguous they are treated as a if there was an OR between them: EVALUATE something WHEN 'a' code executed when value is 'a' WHEN 'b' WHEN 'c' code executed when value is 'b' or 'c' WHEN 'd' CONTINUE WHEN 'e' code executed when value is 'e' only END-EVALUATE So a CONTINUE is necessary if you comment out the action code for a value and leave the WHEN in.
Post Follow-up to this messageRichard, if I comment the continue clause --- it causes more problems to other statements in the windows procedure, especially the Evaluate statement. Here is the error message that I get when there is NO continue clause in my windows procedure section. Rebuilding C:\Unzipped\DIALOGUE\DIALOGUE.cbl C:\Unzipped\DIALOGUE\DIALOGUE.cbl(749,31): * 14-S Invalid operand C:\Unzipped\DIALOGUE\DIALOGUE.cbl(759,17): * 368-S Exception phrase inappropriate C:\Unzipped\DIALOGUE\DIALOGUE.cbl(767,17): * 368-S Exception phrase inappropriate C:\Unzipped\DIALOGUE\DIALOGUE.cbl(769,12): * 564-S A scope-delimiter did not have a matching verb and was discarded. Rebuild complete with errors Kellie.
Post Follow-up to this messageBill, speaking of scope-terminators and end-performs, I was having problems with this particular cobol code in my windows procedure --- I could use your help on this one, does this coding style looks correct to you: move zeros to Myhandle perform until EXIT if Myhandle = 5 exit perform end-if add 1 to Myhandle add some numbers or some cobol code here more cobol code end-perform. my program was hanging because of this perform statement --- the program went into an infinite loop, and never came back to planet earth again. Did I code this perform statement correctly?? Kellie.
Post Follow-up to this messageJimmy, to customize the skin of a dialogBox is simply to change its apprears dramatically, it is more than just slapping a bitMap image on its surface to hide the grey color. You would add more rounded and 3D buttons into the title bar to replace the default system menu, the corners of the dialogBox per se would be rounded as well to give it the illusion of being Floating on the screen. Also, each button would have a titleBar with its own property buttons for further menu selections and colour choices. The titleBar can also have toolBar buttons for more menu selections as well. Its very very blase, you know. Kellie.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.