home *** CD-ROM | disk | FTP | other *** search
/ Software Collection (I) / TOOLS.iso / b04 / 18.img / NET / MSNETDEV.AS_ / MSNETDEV.AS
Encoding:
Text File  |  1991-08-07  |  11.3 KB  |  460 lines

  1. page        60, 132
  2. title        Device mode dialog
  3. ;===============================================================================
  4. ; Filename    MSNETDEV.ASM
  5. ; Copyright    (C) 1989 by Research Machines Ltd.
  6. ;        (C) 1989-1990 by Microsoft Corporation
  7. ;===============================================================================
  8. ; REVISIONS:    15/03/1989    Initial version
  9. ;        23/03/1989    Change to segment name / file name
  10. ;        23/03/1989    Update to spec 0.58
  11. ;        31/03/1989    Tidied up comments.
  12. ;        19/03/1989    Add pretty DeviceMode dialog box
  13. ;        1989-1990    Made it work...
  14. ;===============================================================================
  15.  
  16.         memM    equ    1            ; Middle memory model
  17.         ?WIN    =    1            ; Windows prolog/epilog
  18.         ?PLM    =    1            ; Pascal calling convention
  19.  
  20.         .xlist
  21. include     cmacros.inc
  22. include     windows.inc
  23. include     wnet.inc
  24.         .list
  25.  
  26. IDDEVMODE    equ    100
  27. IDWARNING    equ    101
  28. IDABOUT     equ    102
  29. IDD_STARTUPWARN equ    200
  30. IDD_STARTUPRESTORE  equ 201
  31. IDD_HELP    equ    204
  32. IDD_ABOUT    equ    205
  33. ; This comes from cphelp.h 
  34. IDH_CHILD_NETWORK equ   5010
  35.         .sall
  36.  
  37. ;===============================================================================
  38. ; ============= EXTERNAL FUNCTIONS =============================================
  39. ;===============================================================================
  40.  
  41. externFP    DialogBox
  42. externFP    GetDlgItem
  43. externFP    IsDlgButtonChecked
  44. externFP    CheckDlgButton
  45. externFP    EndDialog
  46. externFP    GetProfileInt
  47. externFP    WriteProfileString
  48. externFP    LockSegment
  49. externFP    UnlockSegment
  50. externFP    WinHelp
  51.  
  52. ;===============================================================================
  53. ; ============= DATA SEGMENT ===================================================
  54. ;===============================================================================
  55.  
  56. sBegin        DATA
  57.  
  58. externW     hLibraryModule
  59.  
  60. globalD     lpfnDevmode,<far ptr DeviceModeDialog>, 1
  61. globalD     lpfnAbout, <far ptr AboutDlgProc>, 1
  62.  
  63. globalB     szSection,<'Windows',0>, 1
  64. globalB     szTag,<'NetWarn',0>, 1
  65. globalB     szNetSection, <'Network',0>, 1
  66. globalB     szRestore, <'Restore',0>, 1
  67. globalB        szHelpFile, <'control.hlp',0>, 1
  68. sEnd        DATA
  69.  
  70. ;===============================================================================
  71. ; ============= CODE SEGMENT ===================================================
  72. ;===============================================================================
  73.  
  74. createSeg    _DEV, DEVCODE, BYTE, PUBLIC, CODE
  75. sBegin        DEVCODE
  76.         assumes CS, DEVCODE
  77.         assumes DS, DATA
  78.  
  79.  
  80. cProc    IsWarningEnabled, <NEAR, PUBLIC>
  81. cBegin
  82.     cCall   LockSegment,<DS>
  83.  
  84.     push    ds
  85.     lea     bx, szSection
  86.     push    bx
  87.  
  88.     push    ds
  89.     lea     bx, szTag
  90.     push    bx
  91.  
  92.     mov     ax, 1
  93.     push    ax
  94.  
  95.     call    GetProfileInt
  96.  
  97.     push    ax
  98.  
  99.     cCall   UnlockSegment, <DS>
  100.  
  101.     pop     ax
  102. cEnd
  103.  
  104. cProc    IsRestoreEnabled, <NEAR, PUBLIC>
  105. cBegin
  106.     cCall   LockSegment,<DS>
  107.  
  108.     push    ds
  109.     lea     bx, szNetSection
  110.     push    bx
  111.  
  112.     push    ds
  113.     lea     bx, szRestore
  114.     push    bx
  115.  
  116.     mov     ax, 1
  117.     push    ax
  118.  
  119.     call    GetProfileInt
  120.  
  121.     push    ax
  122.  
  123.     cCall   UnlockSegment, <DS>
  124.  
  125.     pop     ax
  126. cEnd
  127.  
  128.  
  129. ;===============================================================================
  130. ; ============= EXPORTED FUNCTIONS =============================================
  131. ;===============================================================================
  132.  
  133. ;===============================================================================
  134. subttl        AboutDlgProc
  135. page
  136. ;===============================================================================
  137. ;
  138. ; DESCRIPTION .
  139. ; ENTRY .......
  140. ; EXIT ........
  141. ; COMMENTS ....
  142. ;
  143. ;===============================================================================
  144.  
  145. cProc        AboutDlgProc, <FAR, PUBLIC>
  146.  
  147.     parmW   hDlg
  148.     parmW   wMsg
  149.     parmW   wParam
  150.     parmD   lParam
  151.  
  152. cBegin
  153.     sub     ax, ax
  154.     cmp     wMsg, WM_COMMAND
  155.     jnz     adp_exit
  156.     cmp     wParam, IDOK
  157.     jz        adp_bye
  158.     cmp     wParam, IDCANCEL
  159.     jnz     adp_exit
  160. adp_bye:
  161.     push    hDlg
  162.     push    ax
  163.     call    EndDialog
  164. adp_exit:
  165. cEnd
  166.  
  167. ;===============================================================================
  168. subttl        DeviceModeDialog
  169. page
  170. ;===============================================================================
  171. ;
  172. ; DESCRIPTION .
  173. ; ENTRY .......
  174. ; EXIT ........
  175. ; COMMENTS ....
  176. ;
  177. ;===============================================================================
  178.  
  179. cProc        DeviceModeDialog, <FAR, PUBLIC>
  180.  
  181.     parmW   hDlg
  182.     parmW   wMsg
  183.     parmW   wParam
  184.     parmD   lParam
  185.  
  186.     localW  wNoWarn
  187. cBegin
  188.  
  189. ;---------------------------------------------------------------
  190. ; Dispatch to appropriate code
  191. ;---------------------------------------------------------------
  192.  
  193.     cmp     ( wMsg ), WM_INITDIALOG
  194.     je        WMInitDialog
  195.  
  196.     cmp     ( wMsg ), WM_COMMAND
  197.     je        WMCommand
  198.  
  199.     jmp     NotProcessed
  200.  
  201. ;---------------------------------------------------------------
  202. ; Process WM_INITDIALOG
  203. ;---------------------------------------------------------------
  204.  
  205. WMInitDialog:
  206.     call    IsWarningEnabled
  207.     cmp     ax, 1                    ; do a !ax, iow
  208.     sbb     ax, ax
  209.     neg     ax
  210.     mov     cx, IDD_STARTUPWARN
  211.     cCall   CheckDlgButton, <hDlg, cx, ax>
  212.     call    IsRestoreEnabled
  213.     mov     cx, IDD_STARTUPRESTORE
  214.     cCall   CheckDlgButton, <hDlg, cx, ax>
  215.     jmp     Processed
  216.  
  217. ;---------------------------------------------------------------
  218. ; Process WM_COMMAND
  219. ;---------------------------------------------------------------
  220.  
  221. WMCommand:
  222.     cmp     wParam, IDOK
  223.     je        WMIDOK
  224.  
  225.     cmp     wParam, IDCANCEL
  226.     je        WMIDCANCEL
  227.  
  228.     cmp     wParam, IDD_ABOUT
  229.     jne     @F
  230.     jmp     AboutDialog
  231. @@:
  232.     cmp     wParam, IDD_HELP
  233.     jne     @F
  234.     jmp     InvokeHelp
  235. @@:
  236.     jmp     NotProcessed
  237.  
  238.  
  239. ;---------------------------------------------------------------
  240. ; Process WM_COMMAND IDOK
  241. ;---------------------------------------------------------------
  242. WMIDOK:
  243.     ;        lock our ds so string don't move
  244.     cCall   LockSegment, <ds>
  245.  
  246.     ;        is the button for not warning set?
  247.     push    hDlg
  248.     mov     ax, IDD_STARTUPWARN
  249.     push    ax
  250.     call    IsDlgButtonChecked
  251.  
  252.     cmp     ax, 1            ; is ax >= 1?
  253.     sbb     ax, ax            ; 0 if ==, -1 if >= 1
  254.     neg     ax                ; ==> 0 or 1
  255.     add     al, '0'            ; convert to '1' or '0'
  256.  
  257.     mov     wNoWarn, ax         ; put in memory
  258.  
  259.     lea     bx, szSection
  260.     push    ds
  261.     push    bx
  262.  
  263.     lea     bx, szTag
  264.     push    ds
  265.     push    bx
  266.  
  267.     lea     bx, wNoWarn
  268.     push    ss
  269.     push    bx
  270.  
  271.     call    WriteProfileString
  272.  
  273.  
  274.     ;        is the button for restoring connections set?
  275.     push    hDlg
  276.     mov     ax, IDD_STARTUPRESTORE
  277.     push    ax
  278.     call    IsDlgButtonChecked
  279.     mov     bx, '0'
  280.     or        ax, ax
  281.     jz        @F
  282.     inc     bx
  283. @@:
  284.  
  285.     mov     wNoWarn, bx         ; put in memory
  286.  
  287.     lea     bx, szNetSection
  288.     push    ds
  289.     push    bx
  290.  
  291.     lea     bx, szRestore
  292.     push    ds
  293.     push    bx
  294.  
  295.     lea     bx, wNoWarn
  296.     push    ss
  297.     push    bx
  298.  
  299.     call    WriteProfileString
  300.  
  301.     cCall   UnlockSegment, <ds>
  302.  
  303.     ; FALL THRU
  304.  
  305. ;---------------------------------------------------------------
  306. ; Process WM_COMMAND IDCANCEL
  307. ;---------------------------------------------------------------
  308. WMIDCANCEL:
  309.     sub     ax,ax
  310.     Arg     hDlg
  311.     Arg     ax
  312.     cCall   EndDialog
  313.  
  314.     jmp     short Processed
  315.  
  316. ;---------------------------------------------------------------
  317. ; Put up the about dialog box
  318. ;---------------------------------------------------------------
  319.  
  320. AboutDialog:
  321.     RegPtr  lpszDialog, dx, ax
  322.  
  323.     mov     ax, IDD_ABOUT
  324.     cwd
  325.  
  326.     Arg     hLibraryModule
  327.     Arg     lpszDialog
  328.     Arg     hDlg
  329.     Arg     lpfnAbout
  330.     cCall   DialogBox
  331.  
  332.     jmp     short Processed
  333.  
  334. ;---------------------------------------------------------------
  335. ; Put up help for this dialog box
  336. ;---------------------------------------------------------------
  337.  
  338. InvokeHelp:
  339.     lea     bx, szHelpFile
  340.     RegPtr  lpszHelpFile,ds,bx
  341.     cCall   WinHelp,<hDlg,lpszHelpFile,HELP_CONTEXT,0,IDH_CHILD_NETWORK>
  342.     jmp     short Processed
  343.  
  344. ;---------------------------------------------------------------
  345. ; Exit without having processed message
  346. ;---------------------------------------------------------------
  347.  
  348. NotProcessed:
  349.     sub     ax,ax
  350.     jmp     short DeviceModeDialogExit
  351.  
  352. ;---------------------------------------------------------------
  353. ; Exit after processing message
  354. ;---------------------------------------------------------------
  355.  
  356. Processed:
  357.     mov     ax, TRUE
  358.  
  359. ;---------------------------------------------------------------
  360. ; Exit one way or another
  361. ;---------------------------------------------------------------
  362.  
  363. DeviceModeDialogExit:
  364.  
  365. cEnd
  366.  
  367. ;===============================================================================
  368. subttl        WNetDeviceMode
  369. page
  370. ;===============================================================================
  371. ;
  372. ; DESCRIPTION . Allow access to network functions not supported by WinNet
  373. ;        Display version / copyright messages
  374. ; ENTRY ....... hWnd is a handle to the window for dialog boxes etc
  375. ; EXIT ........
  376. ; COMMENTS ....
  377. ;
  378. ;===============================================================================
  379.  
  380. cProc        WNetDeviceMode, <FAR, PUBLIC>
  381.  
  382.         parmW    hWnd
  383. cBegin
  384.  
  385. ;---------------------------------------------------------------
  386. ; Display / process dialog box
  387. ;---------------------------------------------------------------
  388.  
  389.     RegPtr  lpszDialog, dx, ax
  390.  
  391.     mov     ax,IDDEVMODE
  392.     cwd
  393.  
  394.     Arg     hLibraryModule                ; hInst
  395.     Arg     lpszDialog
  396.     Arg     hWnd                    ; hWndParent
  397.     Arg     lpfnDevmode
  398.     cCall   DialogBox                    ; Modal Dialog Box
  399.  
  400. ;---------------------------------------------------------------
  401. ; Return to caller
  402. ;---------------------------------------------------------------
  403.  
  404.      or      ax,ax
  405.      jz      WnetDeviceModeExit
  406.  
  407.      mov     ax,WN_WINDOWS_ERROR
  408.  
  409. WNetDeviceModeExit:
  410.  
  411. cEnd
  412.  
  413. ;===============================================================================
  414. subttl        PostWarning
  415. page
  416. ;===============================================================================
  417. ;
  418. ; DESCRIPTION . If the NetWarn flag is enabled, warn the user that his net
  419. ;        software is not running.
  420. ; ENTRY .......
  421. ; EXIT ........
  422. ; COMMENTS .... Using same dlg function as device mode for now
  423. ;
  424. ;===============================================================================
  425.  
  426. cProc        PostWarning, <FAR, PUBLIC>
  427. cBegin
  428.  
  429. ;---------------------------------------------------------------
  430. ; Display / process dialog box
  431. ;---------------------------------------------------------------
  432.  
  433.     call    IsWarningEnabled
  434.     or        ax,ax
  435.     jz        PW_Exit
  436.  
  437.     RegPtr  lpszDialog, dx, ax
  438.  
  439.     mov     ax,IDWARNING
  440.     cwd
  441.     sub     cx, cx
  442.  
  443.     Arg     hLibraryModule                ; hInst
  444.     Arg     lpszDialog
  445.     Arg     cx                        ; hWndParent
  446.     Arg     lpfnDevmode
  447.     cCall   DialogBox                    ; Modal Dialog Box
  448.  
  449. PW_Exit:
  450.  
  451. cEnd
  452.  
  453. ;===============================================================================
  454. ; ============= END OF MSNETDEV ================================================
  455. ;===============================================================================
  456.  
  457. sEnd        DEVCODE
  458.         end
  459. 
  460.