In the previous post we left the following question open: what if you want to link coredll to your own library with customized message and dialog boxes instead of the ‘standard’ messagedialogboxcustomize? Here’s the answer (or at least one of the possible ones):
- Create an empty subproject in your OS design using the ‘WCE static library’ template: we’ll call the project ‘mymessageboxcustomize’
- Modify the sources file changing RELEASETYPE to OAK
- Copy the _WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\MESSAGEDIALOGBOXCUSTOMIZE\messagedialogboxcustomize.cpp file to the subproject folder and add it to the subproject itself
- Build it and verify that you get mymessageboxcustomize.lib in $(_PROJECTROOT)\oak\lib
- Modify the %_PROJECTROOT%\oak\misc\cesysgen.bat file so it looks like
@echo off call %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat %* REM Add our custom message box implementation if not "%COREDLL_REPLACE_COMPONENTS%" == "" set COREDLL_REPLACE_COMPONENTS=mymessageboxcustomize %COREDLL_REPLACE_COMPONENTS% if "%COREDLL_REPLACE_COMPONENTS%" == "" set COREDLL_REPLACE_COMPONENTS=mymessageboxcustomize REM Remove "messagedialogboxthunk" from %COREDLL_COMPONENTS% for %%f in (%COREDLL_COMPONENTS%) do call :RemoveMessagedialogboxthunk %%f set COREDLL_COMPONENTS=%TEMP_COREDLL_COMPONENTS% goto :EOF :RemoveMessagedialogboxthunk if /i "%1"=="messagedialogboxthunk" goto :EOF if not "%TEMP_COREDLL_COMPONENTS%" == "" set TEMP_COREDLL_COMPONENTS=%1 %TEMP_COREDLL_COMPONENTS% if "%TEMP_COREDLL_COMPONENTS%" == "" set TEMP_COREDLL_COMPONENTS=%1 goto :EOF
The second part of the file is the same as the previous post: it removes the standard messagedialogboxthunk library to avoid multiple definitions for MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam.
The first part takes advantage of the COREDLL_REPLACE_COMPONENTS environment variable which is handled in %_WINCEROOT%\PUBLIC\COMMON\CESYSGEN\makefile.
Now, ‘all’ you have to do is filling the stubs in messagedialogboxcustomize.cpp with your desired implementation of MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam.