home *** CD-ROM | disk | FTP | other *** search
- //*************************************************************
- // File name: init.c
- //
- // Description:
- //
- // Routines which initialize the application and instance.
- //
- // Development Team:
- //
- // Mike Brehm
- // Irfan Gowani
- //
- // Written by Microsoft Product Support Services, Windows Developer Support
- // Copyright (c) 1992 Microsoft Corporation. All rights reserved.
- //*************************************************************
-
- #include "global.h"
-
- //*************************************************************
- //
- // InitApplication()
- //
- // Purpose:
- //
- // Initializes the application (window classes)
- //
- //
- // Parameters:
- //
- // HANDLE hInstance - Instance handle from WinMain.
- //
- //
- // Return: (BOOL)
- //
- // TRUE - Window class was initialized and registered.
- // FALSE - Window class not initialized and registered.
- //
- //
- // Comments:
- //
- //
- // History: Date Author Comment
- // 12/12/91 Mike Brehm Created
- //
- //*************************************************************
-
- BOOL InitApplication (HANDLE hInstance)
- {
- WNDCLASS wc; // Window class
-
- wc.style = CS_HREDRAW | CS_VREDRAW;;
- wc.lpfnWndProc = (WNDPROC)MainWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(hInstance, "DRAGDROPICON");
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
- wc.lpszMenuName = szMainMenu;
- wc.lpszClassName = szMainClass;
-
- if (!RegisterClass(&wc))
- return (FALSE);
-
- return (TRUE);
- } /* InitApplication() */
-
- //*************************************************************
- //
- // InitInstance()
- //
- // Purpose:
- //
- // Initializes each instance (window creation)
- // Registers main window for Drag Drop messages
- //
- //
- // Parameters:
- //
- // HANDLE hInstance - Instance handle of application.
- // int nCmdShow - How window is initially displayed.
- //
- //
- // Return: (BOOL)
- //
- // TRUE - Window created and displayed.
- // FALSE - Window not created.
- //
- //
- // Comments:
- //
- //
- // History: Date Author Comment
- // 12/12/91 Mike Brehm Created
- //
- //*************************************************************
-
- BOOL InitInstance (HINSTANCE hInstance, int nCmdShow)
- {
- RECT rect; // Client area of main window
-
- //
- // Save this instance and create our main window if we can.
- //
-
- ghInst = hInstance;
- ghWndMain = CreateWindow(szMainClass, "RFC to HTML Converter",
- WS_OVERLAPPEDWINDOW, 50, 50, 600, 250,
- NULL, NULL, hInstance, NULL); // CreateWindowA
-
- if (!ghWndMain)
- return (FALSE);
-
- //
- // Create a list box the size of the main window if we can.
- // The list box will be used to show the file names of the
- // dragged and dropped files.
- GetClientRect(ghWndMain, &rect);
-
- ghListBox = CreateWindow("ListBox", NULL, WS_CHILD | WS_VSCROLL |
- LBS_NOINTEGRALHEIGHT | LBS_SORT | WS_VISIBLE,
- 0, 0,
- rect.right - rect.left, rect.bottom - rect.top,
- ghWndMain, NULL, hInstance, NULL);
-
- if (!ghListBox)
- return (FALSE);
-
- //
- // Register the application's window for Drag/Drop messages.
- //
- DragAcceptFiles(ghWndMain, TRUE);
-
- ShowWindow(ghWndMain, nCmdShow);
- UpdateWindow(ghWndMain);
-
- return (TRUE);
- } /* InitInstance() */
-
-
- /*** EOF: init.c ***/
-