Customizing Dialog Boxes and Message Boxes for Headless Systems 1/2


The MSDN documentation explains how to customize dialog boxes and message boxes for headless systems here http://msdn.microsoft.com/en-us/library/ee504353(v=winembedded.60).aspx.

What they say there is that you can instruct the build system to create the coredll DLL linking to the messagedialogboxcustomize component library rather than to the messagedialogboxthunk one:

  • messagedialogboxthunk is what you get if you include some kind of GWES support in your OS and it is a small layer which will forward the call to the actual implementation of MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam in GWES. 
  • messagedialogboxcustomize is built from the code in %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\MESSAGEDIALOGBOXCUSTOMIZE. As you see the MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam functions are basically stubs.

Following the above link, the first thing I did is modifying  %_PROJECTROOT%\oak\misc\cesysgen.bat so it looks like:

@echo off
call %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat %*
set COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT=messagedialogboxcustomize
goto :EOF

When you sysgen coredll you’ll see some warnings complaining about the fact that MessageBox/DialogBoxIndirectParam/CreateDialogIndirectParam are defined in both messagedialogboxthunk and messagedialogboxcustomize:

messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4006: MessageBoxW already defined in messagedialogboxcustomize.lib(messagedialogboxcustomize.obj); second definition ignored
messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4006: DialogBoxIndirectParamW already defined in messagedialogboxcustomize.lib(messagedialogboxcustomize.obj); second definition ignored
messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4006: CreateDialogIndirectParamW already defined in messagedialogboxcustomize.lib(messagedialogboxcustomize.obj); second definition ignored
messagedialogboxthunk.lib(messagedialogboxthunk.obj) : warning LNK4221: no public symbols found; archive member will be inaccessible

(Notice that we’re lucky enough that the we’re ignoring the definition we *want* to ignore)

Reading better the link I noticed the “Ensure that the Messagedialogboxthunk component is removed from the COREDLL_COMPONENTS environment variable” part. Of course we won’t modify the build .bat files so we do it in our %_PROJECTROOT%\oak\misc\cesysgen.bat which finally looks like:

@echo off
call %_PUBLICROOT%\cebase\oak\misc\cesysgen.bat %*
set COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT=messagedialogboxcustomize
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

Notice that if you create an OS based on the small footprint device template you already have messagedialogboxcustomize in place: since no GWES support is included you’re running the following lines in %_WINCEROOT%\PUBLIC\CEBASE\OAK\MISC\winceos.bat

   if "%GWES_COMPONENTS%"=="" set __SYSGEN_MSGDLGBOXCUSTOMIZE=1
    if "%__SYSGEN_MSGDLGBOXCUSTOMIZE%"=="1" set COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT=messagedialogboxcustomize

If you like how messagedialogboxcustomize works, you’re done, but what if you want to link coredll to your own customized messagedialogboxcustomizedbyme code without modifying %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\MESSAGEDIALOGBOXCUSTOMIZE?

To be continued…

Advertisements
This entry was posted in Windows Embedded CE. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s