Demo Plugin Docking not working with MinGW build
-
I cloned the demo plugin (https://github.com/npp-plugins/plugindemo) and I’m using MinGW to compile it. I create a Makefile and all works OK - dll builds and Notepad++ runs it. All aspects of the plugin seem to work fine … except the “Dockable Dialog Demo”. When selecting the “Dockable Dialog Demo” from the plugin’s submenu, I get the error from DockingFeature\StaticDialog.cpp:
CreateDialogParam() return NULL
GetLastError() == 1814Looking at (https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1700-3999-) this is for ERROR_RESOURCE_NAME_NOT_FOUND. I compiled in both the NppPluginDemo.rc and DockingFeature\goLine.rc resource files before linking the DLL so not sure why this is happening.
Some Google-ing led me to believe the CreateDialogParam() call was using the handle of the Notepad++ EXE rather than the plugin DLL, so I tried a few things:
-
Changing the IDD_PLUGINGOLINE_DEMO value to 25000 (from 2500) and compiling works. When clicking the “Dockable Dialog Demo” now, I get the window for “Styler Dialog” working fine. This however is a resource from Notepad++, not the Plugin Demo DLL, confirming that the CreateDialogParam() call may indeed not be getting the correct handle passed as the first argument.
-
Some research led me to change in :
_hSelf = ::CreateDialogParam(_hInst, …
to
_hSelf = ::CreateDialogParam(GetModuleHandle(TEXT(“NppPluginDemo.dll”)), …
and that results in DockingFeature\StaticDialog.cpp:
CreateDialogParam() return NULL
GetLastError() == 1813which is ERROR_RESOURCE_TYPE_NOT_FOUND.
- I noticed in goLine.rc the resource type is DIALOGEX and we’re using CreateDialogParam and there seems to be no CreateDialogExParam, so I made necessary changes in goLine.rc to use just DIALOG (comment out the FONT line) and that also results in after compiling, installing and running:
…GetLastError() == 1813
I have VS Community edition, but I’m not familiar with it and I get all sorts of errors - Platform Toolset is wrong (wants to reset to v141 / v141_xp) and the SDK version is not found (wants 7.something, I have 10.something and the “Retarget” option in Build is just not in the menu as it should be according to Google searches). I’ve built 2 other plugins successfully with MinGW, neither using the docking feature however.
WHAT AM I DOING WRONG!?!?
Thanks in advance.
-
-
I haven’t used MinGW for windows builds so can’t say for sure what your problem is.
But I have described here what I have done to build npp and scintilla with VS2017 community edition.
The steps for plugins should be quite similar.
A more detailed version include a lot of screenshots can be downloaded or viewed from hereIf something is unclear, let us know. (together with the name of the plugin you tried to build)
Cheers
Claudia