-
Notifications
You must be signed in to change notification settings - Fork 23
Adding a new file type
Kevin Routley edited this page Aug 29, 2021
·
1 revision
These are the steps required to add a new file "type" (e.g. EPUB, MOBI, etc).
There are two features provided by the CBXShell: the file icon, and the file tooltip. Steps for each are described; the two features don't have to be implemented together.
The CBXManager controls the activation / deactivation of support for the file type. Under the current model, skipping these changes means CBXShell will not be invoked for the filetype! The primary intent of the CBXManager is to control the registry keys which modify the invocation of the CBXShell.
- Add a new checkbox control id to
resource.h
. E.g. IDC_CB_EPUB. - Add the following
#define
s and code toRegManager.h
:- A CBX_xxxTH_KEY: the registry key based on the extension. E.g. CBX_EPUBTH_KEY.
- A cbx type, E.g. CBX_EPUB.
- In
GetTHKeyName
add acase
for your new cbx type. - For tooltip support, add a CBX_xxxIH_KEY.
- For tooltip support, add a
case
toGetIHKeyName
for your new cbx type.
- Add support for your new file type to the dialog.
- Add a checkbox to the main dialog
IDD_MAINDLG
inCBXManager.rc
, using the id added in step 1 above. Adjust sizes and positions of the dialog and controls as necessary. - Add a
Button_SetCheck
call toCMainDlg::InitUI
[MainDlg.cpp] - Replicate a "thumbnail handlers" block in
OnApplyImpl
for the new type. - Add the control id from step 1 to
CMainDlg::OnAppHelp
.
- Add a checkbox to the main dialog
As of this writing, all the code for supporting the various file types exists in cbxArchive.h.
- Add a new
#define
for the type (e.g. CBXTYPE_EPUB). - In
OnExtract
add a newcase
using the#define
from step 1. Thiscase
invokes the code to get the thumbnail. - Add any required file extension check(s) to
GetCBXType
. - For tooltip support, add a new
case
toOnGetInfoTip
. Thiscase
invokes the code to get the tooltip text. - Write the code to get the thumbnail and/or tooltip text as required for steps 2 and 4.