summaryrefslogblamecommitdiffstats
path: root/private/net/otnboot/mainwnd.c
blob: 571fc96b5d9b8210c90304f9acb9814b0b88d155 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877












































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                  
/*++

    Copyright (c) 1994  Microsoft Corporation

Module Name:

    MAINWND.H

Abstract:

    Main Window Procedure

Author:

    Bob Watson (a-robw)

Revision History:

    17 Feb 94    Written

--*/
//
//  Windows Include Files
//

#include <windows.h>
#include <stdio.h>
#include <malloc.h>
#include <tchar.h>      // unicode macros
//
//  app include files
//
#include "otnboot.h"
#include "otnbtdlg.h"
//
//
#define     HELP_USE_STRING 0   // use context strings, not id #'s for help
//
//
extern POINT    ptWndPos;   // top left corner of window for placement
static  HWND    hwndDisplay = NULL; // dialog to be/being displayed
static  HWND    hwndMain = NULL;    // window handle for Help interface
static  DWORD   dwHelpContextId = 0; //  id to send to help for context sens.
//
typedef struct _DLG_DATA {
    HWND    hWnd;       // handle of parent window
    HINSTANCE   hInst;  // instance containing resources
    LPTSTR  szIdDlg;    // ID of Dialog to start
    DLGPROC ProcName;   // dialog Procedure to call
    LPARAM    lArg;     // optional argument  (0 if not used);
} DLG_DATA, *PDLG_DATA;

BOOL
ShowAppHelp (
    IN  HWND    hwndDlg,
    IN  WORD    wContext
)
/*++

Routine Description:

    Generic routine to call WinHelp engine for displaying application
        help. wContext parameter is used for context.

Arguments:

    IN  HWND    hwndDlg
        window handle of dialog calling function

    IN  WORD    wContext
        help context:
            id of a string resource that is used as help context string

Return Value:

    TRUE if help called successfully

--*/
{
    LPTSTR  szKeyString;
    UINT    nHelpCmd;
    DWORD   dwHelpParam;

    szKeyString = (LPTSTR)GlobalAlloc(GPTR, MAX_PATH_BYTES);

    if (szKeyString == NULL) return FALSE;

#if HELP_USE_STRING
    if (wContext != 0) {
        if (LoadString (
            (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE),
            wContext,
            szKeyString,
            MAX_PATH) > 0) {
            nHelpCmd = HELP_KEY;
            dwHelpParam = (DWORD)szKeyString;
        } else {
            nHelpCmd = HELP_CONTENTS;
            dwHelpParam = 0;
        }
    } else {
        nHelpCmd = HELP_CONTENTS;
        dwHelpParam = 0;
    }
#else
    nHelpCmd = HELP_CONTEXT;
    dwHelpParam = wContext;
#endif

    WinHelp (hwndMain,
        cszHelpFile,
        nHelpCmd,
        dwHelpParam);

    FREE_IF_ALLOC (szKeyString);
    return TRUE;
}

static
LRESULT
MainWnd_UPDATE_WINDOW_POS (
    IN  HWND    hWnd,
    IN  WPARAM  wParam, // x Pos of top left corner
    IN  LPARAM  lParam  // y Pos of top left corner
)
/*++

Routine Description:

    External window message used to register location of a dialog box
        window so the next dialo can be placed in the same spot.
        Dialog box sends this message whenever it's moved and the top
        left corner is stored in a global variable by this message.

Arguments:

    IN  HWND    hWnd,
    IN  WPARAM  wParam, // x Pos of top left corner
    IN  LPARAM  lParam  // y Pos of top left corner
        location coordinates are in SCREEN pixels

Return Value:

    ERROR_SUCCESS

--*/
{
    ptWndPos.x = (LONG)wParam;
    ptWndPos.y = (LONG)lParam;

    return (ERROR_SUCCESS);
}

static
LRESULT
MainWnd_CLEAR_DLG (
    IN  HWND    hWnd,
    IN  WPARAM  wParam,
    IN  LPARAM  lParam  // dlg exit value
)
/*++

Routine Description:

    Called by a dialog box to clear the previous dialog.

Arguments:

    IN  HWND    hWnd
        main window handle
    IN  WPARAM  wParam,
        mot used
    IN  LPARAM  lParam
        dlg box exit value

Return Value:

    ERROR_SUCCESS

--*/
{
    if (hwndDisplay != NULL) {
        EndDialog (hwndDisplay, lParam);
        hwndDisplay = NULL;
    }
    return ERROR_SUCCESS;
}

static
LRESULT
MainWnd_REGISTER_DLG (
    IN  HWND    hWnd,
    IN  WPARAM  wParam, // help context ID
    IN  LPARAM  lParam  // handle to dialog to register
)
/*++

Routine Description:

    external message sent by dialog boxes when they initialize.
        This message and the CLEAR_DLG message above are used to
        overlap dialog boxes to prevent "dead" space between dialogs

Arguments:

    IN  HWND    hWnd
        main window handle
    IN  WPARAM  wParam
        help context ID for dialog
    IN  LPARAM  lParam
        handle to dialog box window to register

Return Value:

    ERROR_SUCCESS

--*/
{
    hwndDisplay = (HWND)lParam;
    dwHelpContextId = (DWORD)wParam;
    UpdateWindow (hwndDisplay);
    return ERROR_SUCCESS;
}

BOOL
RegisterMainWindowClass(
    IN  HINSTANCE   hInstance
)
/*++

Routine Description:

    Exported function called by main routine to register the
        window class used by this module.

Arguments:

    IN  HINSTANCE   hInstance of application

Return Value:

    Boolean Status of RegisterClass function

--*/
{
    WNDCLASS    wc;
    LOGBRUSH    lbBackBrush;

    lbBackBrush.lbStyle = BS_SOLID;
    lbBackBrush.lbColor = RGB(0,0,255);
    lbBackBrush.lbHatch = 0;


    // Fill in window class structure with parameters that describe the
    // main window.

    wc.style         = CS_HREDRAW | CS_VREDRAW;// Class style(s).
    wc.lpfnWndProc   = (WNDPROC)MainWndProc;   // Window Procedure
    wc.cbClsExtra    = 0;                      // No per-class extra data.
    wc.cbWndExtra    = MAINWND_EXTRA_BYTES;    // amount of Window extra data.
    wc.hInstance     = hInstance;              // Owner of this class
    wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(NCDU_APP_ICON));  // Icon name
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);// Cursor
    wc.hbrBackground = CreateBrushIndirect(&lbBackBrush);// Default back color
    wc.lpszMenuName  = NULL;                   // Menu name from .RC
    wc.lpszClassName = szAppName;              // Name to register as

    // Register the window class and return success/failure code.
    return (BOOL)RegisterClass(&wc);
}

static
LRESULT
MainWnd_WM_NCCREATE(
    IN  HWND    hWnd
)
/*++

Routine Description:

    Processes the WM_NCCREATE message to the main window

Arguments:
    IN  HWND    hWnd

Return Value:
    TRUE if all went OK
    FALSE if not (which will cause the window creation to fail

--*/
{
    hwndMain = hWnd;        // load static data
    return (LRESULT)TRUE;
}

static
LRESULT
MainWnd_WM_CREATE (
    IN  HWND    hWnd
)
/*++

Routine Description:
    Processes the WM_CREATE message to the main window

Arguments:

    IN  HWND handle to main window

Return Value:

    Win32 Status Value:
        ERROR_SUCCESS

--*/
{
    RECT    rDesktop;

    // position window off desktop so it can't be seen
    GetWindowRect (GetDesktopWindow(), &rDesktop);
    SetWindowPos (hWnd,
        NULL,
        rDesktop.right+1,   // locate it off the bottom-rt. corner of screen
        rDesktop.bottom+1,
        1,                  // and make it 1 x 1
        1,
        SWP_NOZORDER);

    // show first dialog box
    PostMessage (hWnd, NCDU_SHOW_SW_CONFIG_DLG, 0, 0);

    // display wait cursor until dialog appears
    SetCursor(LoadCursor(NULL, IDC_WAIT));


    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_SW_CONFIG_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Initial Configuration dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_SW_CONFIG_DLG),
        hWnd,
        SwConfigDlgProc);

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_TARGET_WS_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Target Workstation Config. dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_TARGET_WS_DLG),
        hWnd,
        TargetWsDlgProc);

//    PostMessage (hWnd, nNextMessage, 0, 0); called by dialog box

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_SERVER_CFG_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Server Configuration dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_SERVER_CFG_DLG),
        hWnd,
        ServerConnDlgProc);

//    PostMessage (hWnd, nNextMessage, 0, 0); called by dialog box

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_CONFIRM_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Configuration Confirmation dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_CONFIRM_BOOTDISK_DLG),
        hWnd,
        ConfirmSettingsDlgProc);

//    PostMessage (hWnd, nNextMessage, 0, 0);   called by dialog proc

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_CREATE_DISKS_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Create Floppy Disk dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_CREATE_INSTALL_DISKS_DLG),
        hWnd,
        CopyFlopDlgProc);

//    PostMessage (hWnd, nNextMessage, 0, 0); called by dialog proc

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_SHARE_NET_SW_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Copy Dist files and Share dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_SHARE_NET_SW_DLG),
        hWnd,
        ShareNetSwDlgProc);

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_COPYING_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the  Making Boot Floppy dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    if (DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_COPYING_FILES_DLG),
        hWnd,
        MakeFlopDlgProc) == IDOK) {
        // operation completed successfully so return to main menu
        PostMessage (hWnd, NCDU_SHOW_SW_CONFIG_DLG, 0, 0);
    } else {
    	// an error ocurred so go back to configuration dialog to see
    	// if there's something to fix and retry.
        PostMessage (hWnd, NCDU_SHOW_CONFIRM_DLG, 0, 0);
    }

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_EXIT_MESSAGE_DLG (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Called to display the Exit Messages dialog box. The value
        returned by the dialog box is the ID of then next message to
        post to the main window.

Arguments:

    IN  HWND    hwnd
        Handle to main window

Return Value:

    ERROR_SUCCESS

--*/
{
    UINT    nNextMessage;

    nNextMessage = (UINT)DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_EXIT_MESSAGE_DLG),
        hWnd,
        ExitMessDlgProc);

    PostMessage (hWnd, nNextMessage, 0, 0);

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_SHOW_COPY_ADMIN_UTILS (
    IN  HWND    hWnd
)
{
    int nNextMessage;

    nNextMessage = DialogBox (
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        MAKEINTRESOURCE(NCDU_COPY_NET_UTILS_DLG),
        hWnd,
        CopyNetUtilsDlgProc);


//    PostMessage (hWnd, nNextMessage, 0, 0);

    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_WM_ACTIVATEAPP (
    IN  HWND    hWnd,
    IN  WPARAM  wParam,
    IN  LPARAM  lParam
)
/*++

Routine Description:

    enables and disables the F1 hot key to be active only
        when the app is active (i.e. has focus)


Arguments:

    IN  HWND    hWnd
        window handle

    IN  WPARAM  wParam
        TRUE when app is being activated
        FALSE when app is being deactivated

    IN  LPARAM  lParam
        Thread getting focus (if wParam = FALSE)

Return Value:

    ERROR_SUCCESS

--*/
{
    if ((BOOL)wParam) {
        // getting focus so enable hot key
        RegisterHotKey (
            hWnd,
            NCDU_HELP_HOT_KEY,
            0,
            VK_F1);
    } else {
        UnregisterHotKey (
            hWnd,
            NCDU_HELP_HOT_KEY);
    }
    return ERROR_SUCCESS;
}

static
LRESULT
MainWnd_WM_HOTKEY (
    IN  HWND    hWnd,
    IN  WPARAM  wParam,
    IN  LPARAM  lParam
)
/*++

Routine Description:

    processes hot key messages to call help when f1 is pressed

Arguments:

    IN  HWND    hWnd
        window handle

    IN  WPARAM  wParam
        id of hotkey pressed

    IN  LPARAM  lParam
        Not Used

Return Value:

    ERROR_SUCCESS

--*/
{
    switch ((int)wParam) {
        case NCDU_HELP_HOT_KEY:
            ShowAppHelp (
                hWnd,
                (WORD)(dwHelpContextId & 0x0000FFFF));
            return ERROR_SUCCESS;

        default:
            return DefWindowProc (hWnd, WM_HOTKEY, wParam, lParam);
    }
}

static
LRESULT
MainWnd_WM_CLOSE (
    IN  HWND    hWnd
)
/*++

Routine Description:

    Processes the WM_CLOSE message to the main window. Closes the key
        to the registry if it's open and destroys the window.

Arguments:

    IN HWND hWnd
        handle to the main window


Return Value:

    ERROR_SUCCESS

--*/
{
    SetCursor(LoadCursor(NULL, IDC_ARROW)); // reset cursor
    if (pAppInfo->hkeyMachine != NULL) RegCloseKey (pAppInfo->hkeyMachine);
    SendMessage (hWnd, NCDU_CLEAR_DLG, (WPARAM)hWnd, IDOK);
    DestroyWindow (hWnd);
    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_WM_DESTROY (
    IN  HWND    hWnd
)
/*++

Routine Description:
    Processes WM_DESTROY windows message;
        Posts Quit message to app.

Arguments:
    IN  HWND    hWnd
        Handle to main window


Return Value:

    Always 0

--*/
{
    WinHelp (hWnd, cszHelpFile, HELP_QUIT, 0L);
    PostQuitMessage (ERROR_SUCCESS);
    return (LRESULT)ERROR_SUCCESS;
}

static
LRESULT
MainWnd_WM_NCDESTROY (
    HWND    hWnd
)
/*++

Routine Description:
    Processes WM_NCDESTROY windows message
        free's global memory

Arguments:
    IN  HWND    hWnd
        Handle to window being destroyed

Return Value:


    always ERROR_SUCCESS

--*/
{
    return (LRESULT)ERROR_SUCCESS;
}

LRESULT CALLBACK
MainWndProc (
    IN	HWND hWnd,         // window handle
    IN	UINT message,      // type of message
    IN	WPARAM uParam,     // additional information
    IN  LPARAM lParam      // additional information
)
/*++

Routine Description:

    Windows Message processing routine for CPS Util application.
        Dispatches messages that are processed by this app and
        all others are passed to DefWindowProc

Arguments:

    Standard WNDPROC api arguments

ReturnValue:

    value returned by dispatched function

--*/
{
    switch (message) {
        case WM_NCCREATE:   return (MainWnd_WM_NCCREATE(hWnd));
        case WM_CREATE:     return (MainWnd_WM_CREATE(hWnd));
        case WM_ACTIVATEAPP:    return (MainWnd_WM_ACTIVATEAPP(hWnd, uParam, lParam));
        case WM_HOTKEY:     return (MainWnd_WM_HOTKEY(hWnd, uParam, lParam));

        case NCDU_SHOW_SW_CONFIG_DLG:   return (MainWnd_SHOW_SW_CONFIG_DLG (hWnd));
        case NCDU_SHOW_TARGET_WS_DLG:   return (MainWnd_SHOW_TARGET_WS_DLG (hWnd));
        case NCDU_SHOW_SERVER_CFG_DLG:  return (MainWnd_SHOW_SERVER_CFG_DLG (hWnd));
        case NCDU_SHOW_CONFIRM_DLG:     return (MainWnd_SHOW_CONFIRM_DLG (hWnd));
        case NCDU_SHOW_CREATE_DISKS_DLG: return (MainWnd_SHOW_CREATE_DISKS_DLG (hWnd));
        case NCDU_SHOW_SHARE_NET_SW_DLG: return (MainWnd_SHOW_SHARE_NET_SW_DLG (hWnd));
        case NCDU_SHOW_COPYING_DLG:     return (MainWnd_SHOW_COPYING_DLG (hWnd));
        case NCDU_SHOW_EXIT_MESSAGE_DLG: return (MainWnd_SHOW_EXIT_MESSAGE_DLG (hWnd));
        case NCDU_SHOW_COPY_ADMIN_UTILS: return (MainWnd_SHOW_COPY_ADMIN_UTILS (hWnd));
        case NCDU_CLEAR_DLG:            return (MainWnd_CLEAR_DLG (hWnd, uParam, lParam));
        case NCDU_REGISTER_DLG:         return (MainWnd_REGISTER_DLG (hWnd, uParam, lParam));
        case NCDU_UPDATE_WINDOW_POS:    return (MainWnd_UPDATE_WINDOW_POS (hWnd, uParam, lParam));

        case WM_CLOSE:      return (MainWnd_WM_CLOSE(hWnd));
        case WM_DESTROY:    return (MainWnd_WM_DESTROY(hWnd));
        case WM_NCDESTROY:  return (MainWnd_WM_NCDESTROY(hWnd));
        default:            return (DefWindowProc(hWnd, message, uParam, lParam));
    }
}