vendredi 11 septembre 2015

CreateDialog in BHO always fails with error 1813 (resource not found)

I'm working on a BHO written a long time ago in C++, without the use of any of the VS wizards. As a result, this project deviates from the COM conventions and the boilerplate for a COM product. I worked with COM long ago, but never really did any Windows GUI/dialog stuff...

I'm trying to add a dialog box to allow the user to set the values of some new settings:

// serverDialog will be NULL
HWND serverDialog = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PROPPAGE_SETTINGS), NULL, DialogProc);

id (!serverDialog) 
{
    int error = GetLastError(); //1813
    ...
}

....

1813 means that the resource cannot be found. The IDD used there is in resource.h, which I manually included where needed.

DialogProc is defined as:

INT_PTR CALLBACK DialogProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
    return FALSE;
}

Which I know I will have to change later if I want the dialog to actually process messages, but I haven't gotten that far yet. The 1813 error suggests failure before the dialog is even created as does the NULL dialog handle returned.

To add the dialog I used the Add Resource wizard and added a small property page.

I've tried to follow advice here, but to no avail.

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire