home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
c
/
cnrbas.zip
/
CNRBASE.DOC
< prev
next >
Wrap
Text File
|
1992-10-14
|
4KB
|
84 lines
CNRBASE.EXE is a sample program that demonstrates setting up a container
control. It takes as a parameter a directory name. If no directory name is
specified on the command line, the current drive/directory is used.
CNRBASE creates a standard window with a container as a child of the client
window. Once created, the files found in the directory are inserted into the
container and any subdirectories are traversed and inserted into the container
in a tree format.
A secondary thread is employed to fill the container since filling it could
take a while depending on what directory was specified. This allows the user
to interact with the container while it is being filled.
This sample is meant to demonstrate the setting up of a container and nothing
more. Drag/drop, Context Menus, Shared records, Deltas, Ownerdraw are just some
of the things *not* covered here. I hope to upload a sample with these features
at a later date.
My coding style uses extensive error-checking. If this is not your style and/or
you feel it gets in the way of your understanding of the container setup, I
uploaded CNREZ.ZIP that covers container setup using a single source module and
no error checking. This may serve as better sample code. I intend to upload a
program that demonstrates more advanced features of a container. That program
will build on CNRBASE.
The following displays the initialization of the container as it relates to
the 4 source modules that make up CNRBASE.EXE. The extern functions in the
source modules are shown.
PRIMARY THREAD SECONDARY THREAD
┌────────────────────┐ ┌─────────────────────────────┐
│ ┌────────┤ │ │
│ CNRBASE.C │ │ (4) │ POPULATE.C │
│ │ │ │ <─UM_CONTAINER_FILLED─────────── │
││ │ │ │WinProc │ │ │
││ │ │ │ │ │ ┌─> PopulateContainer() │
││ │ │ │ │ │ │ │
└│──│──│────┴────────┘ └──│──────────│───────────────┘
│ │ │ │ │
│ │ (1) │ │
│ │ │ │ │
│ (2) │ │ │
│ │ │ │ │
┌│──│──│────────────────────────┐ │ │
││ │ │ │ _beginthread() │
││ │ │ CREATE.C │ │ │
││ │ │ │ │ │
││ │ │ │ │ │
││ │ └─> CreateDirectoryWin() │ │ │
││ │ │ │ │
││ └─> CreateContainer() ────────────(3)────┘ │
││ │ │
└│──────────────────────│───────┘ │
│ │ │
│ ┌──│───────────────────────────────│───┐
│ │ v v │
│ │ │
│ │ COMMON.C │
└──────────────────────> │
│ │
│ SetWindowTitle() │
│ Msg() │
│ │
└──────────────────────────────────────┘
(1) - Create the frame/client window.
(2) - Create the container window as a child of the client.
(3) - Start a thread that will fill the container with records.
(4) - When the thread has filled the container, it posts a UM_CONTAINER_FILLED
message to the client window.
Hope this sample program helps someone.
Rick Fishman
Code Blazers, Inc.
4113 Apricot
Irvine, CA 92720
CIS ID: 72251,750