Registry file created by Class Wizard for MFC MDI Application not creating entry.

technoway 241 Reputation points
2022-09-15T05:53:30.987+00:00

Shown below are the contents of the registry file created by Visual Studio Wizard. The registry file has the file extension, ".reg". I renamed the application name to MyAppName, and changed the file extension to ".ext"; otherwise it's identical to the original file.

When I click on the registry file on the latest version of Windows 11, and respond by clicking "Yes" on the message box asking me if I want to run as administrator, registry entries are created.

However, while a ".ext" entry is created at "HKEY_CLASSES_ROOT.ext", I don't see "MyAppName.Document" anywhere under the key. I just see "Default".

Is this correct? If so, where is the file extension connected to the document type?

REGEDIT
; This .REG file may be used by your SETUP program.
; If a SETUP program is not available, the entries below will be
; registered in your InitInstance automatically with a call to
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.

REGEDIT
; This .REG file may be used by your SETUP program.
; If a SETUP program is not available, the entries below will be
; registered in your InitInstance automatically with a call to
; CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.

HKEY_CLASSES_ROOT.ext = MyAppName.Document
HKEY_CLASSES_ROOT\MyAppName.Document\shell\open\command = MyAppName.EXE %1
HKEY_CLASSES_ROOT\MyAppName.Document\shell\open\ddeexec = [open("%1")]
HKEY_CLASSES_ROOT\MyAppName.Document\shell\open\ddeexec\application = MyAppName
; note: the application is optional
; (it defaults to the app name in "command")

HKEY_CLASSES_ROOT\MyAppName.Document = MyAppName.Document

Developer technologies | C++
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,636 Reputation points
    2022-09-15T08:58:09.053+00:00

    First of all, before you select a file extension (.ext) you should check to make sure that the extension is not already in use and owned by another application.

    The .reg file created by MFC is not expected to create any keys under the file extension entry in HKCR.

    The .reg file for an MFC MDI application created to use the .tvb extension looks like this -

    REGEDIT  
    ; This .REG file may be used by your SETUP program.  
    ;   If a SETUP program is not available, the entries below will be  
    ;   registered in your InitInstance automatically with a call to  
    ;   CWinApp::RegisterShellFileTypes and COleObjectFactory::UpdateRegistryAll.  
      
    HKEY_CLASSES_ROOT\.tvb = MFCApplication10.Document  
    HKEY_CLASSES_ROOT\MFCApplication10.Document\shell\open\command = MFCApplication10.EXE %1  
    HKEY_CLASSES_ROOT\MFCApplication10.Document\shell\open\ddeexec = [open("%1")]  
    HKEY_CLASSES_ROOT\MFCApplication10.Document\shell\open\ddeexec\application = MFCApplication10  
        ; note: the application is optional  
        ;  (it defaults to the app name in "command")  
      
    HKEY_CLASSES_ROOT\MFCApplication10.Document = MFCApplication10.Document  
      
      
    

    The registry entries created look like these -

    241393-tvb.png

    and

    241413-tvbprogid.png

    Notice that the default value for the .tvb extension identifies the related progid for the document type.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.