{"id":1748,"date":"2011-03-31T10:50:19","date_gmt":"2011-03-31T05:20:19","guid":{"rendered":"http:\/\/e-consystems.com\/blog\/?p=617"},"modified":"2023-08-15T12:34:41","modified_gmt":"2023-08-15T07:04:41","slug":"wec7-silverlight-shell-with-activesync","status":"publish","type":"post","link":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wec7-silverlight-shell-with-activesync\/","title":{"rendered":"WinCE 7: Silverlight Shell with ActiveSync"},"content":{"rendered":"<p>As usual I started looking enthusiastically on new version of WinCE named Windows Embedded Compact 7 and especially the new features of the OS. I took our reference platform Alioth (A Marvel PXA 300 based reference design) BSP to explore the features of WEC7. I took the important feature of WEC7 (ie) Silverlight Shell. Wow!!! Microsoft introduces a new GUI for WEC7. I have created the new OSDesign for my platform. I have included the \u201csample Home Screen Silverlight for Windows Embedded (SYSGEN_XRSHELL)\u201d component, other necessary components and successfully build the OS image.<\/p>\n<p>After downloading the image, I was bit disappointed as I couldn\u2019t see XRShell, instead a grey blank screen appeared as shown below.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" title=\"Blank_screen\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/blank-screen.jpg\" alt=\"Blank_screen\" width=\"420\" height=\"322\" \/><\/p>\n<p>At the same time, my manager and some other Windows CE team member got success in this. Again my brain got heated up. I started collecting the OSDesign of them, compared it and I found the difference in the list of components in the OSDesign. I tried adding and removing some components in my OSDesign and finally found the culprit component. The component which is not allowing the XRShell to run is\u201cActiveSync\u201d. I got a pointer to catch this issue.<\/p>\n<p>I looked the source code of XRShell available in the WINCE700\\public\\ shell\\ oak\\ XRshell\\ src\\ CXRShell.cpp. At the same time I was looking the activities of ActiveSync during the booting. Initially I suspect that the SH_Shell API used in ActiveSync may not be implemented. I checked the CXRShell.cpp file and found that they have not implemented the API but they have given a place holder for all the SH_Shell API by filling a single API named \u201cMissingAPI()\u201d and they have initialize the API placeholder in CXRShell::Execute() method. CXRShell::Execute () is the method where the shell creates desktop, scenes etc&#8230;including the Initialization of SH_Shell APIs. Using this API placeholder API, XRshell allow other applications which are waiting for SH_Shell APIs to start. But our case is different.Here XRShell is blocked by ActiveSync. So the SH_ShellAPI placeholder is not an issue.<\/p>\n<p>Again the next suspected activity is, ActiveSync will show notification icon on the task bar but unfortunately there is no taskbar currently implemented in XRShell. Finally I found that ActiveSync is looking for taskbar and it blocked the XRShell to launch.<\/p>\n<p><strong>Solution<\/strong><\/p>\n<p>I created a blank taskbar like a place holder and attach with the XRShell. Great!!! Now XRShell is launched along with the ActiveSync.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" title=\"Silver Light\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/Silverlight-Shell.JPG\" alt=\"ActiveSync\" width=\"598\" height=\"374\" \/><\/p>\n<p>Now I have explained you \u2013 How to create a taskbar placeholder. We can easily create a taskbar from the existing source code given for Standard shell. If you explore the following source code, you can easily create a taskbar place holder.<\/p>\n<p>\u2022 \\Wince700\\public\\shell\\oak\\hpc\\explorer\\inc\\taskbar.hxx<br \/>\n\u2022 \\Wince700\\public\\shell\\oak\\hpc\\explorer \\taskbar.cpp<br \/>\n\u2022 \\Wince700\\public\\shell\\oak\\hpc\\explorer \\main.cpp<\/p>\n<p>Here is the source code I have done for creating a taskbar.<br \/>\n\/\/Below macro definitions are taken from taskbar.hxx file.<br \/>\n#define HHTASKBARDATA 8<br \/>\n#define HHTASKBARCLASSNAME TEXT(&#8220;HHTaskBar&#8221;)<br \/>\n#define HHTASKBARID 0<br \/>\n#define HHTASKBARSTATE 4<br \/>\n\/\/A dummy WndProc for taskbar<br \/>\nLRESULT CALLBACK XRshellTaskBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br \/>\n{<br \/>\nreturn 0;<br \/>\n}<br \/>\n\/\/Referred the CTaskBar::Register() method in taskbar.cpp to create the below given code.<br \/>\n\/\/Function XShellTaskBar() \u2013 Used to create a taskbar placeholder.<br \/>\nvoid XShellTaskBar(HINSTANCE hInstance)<br \/>\n{<br \/>\nRETAILMSG(1,(TEXT(&#8220;XRshell TaskBar ++\\r\\n&#8221;)));<br \/>\nHWND hwndTaskBar;<br \/>\nWNDCLASS wc;<br \/>\nwc.style = \/*CS_HREDRAW | CS_VREDRAW | *\/CS_DBLCLKS;<br \/>\nwc.lpfnWndProc = (WNDPROC)XRshellTaskBarWndProc;<br \/>\nwc.cbClsExtra = 0;<br \/>\nwc.cbWndExtra = HHTASKBARDATA;<br \/>\nwc.hInstance = hInstance;<br \/>\nwc.hIcon = NULL;<br \/>\nwc.hCursor = 0;<br \/>\nwc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);<br \/>\nwc.lpszMenuName = NULL;<br \/>\nwc.lpszClassName = HHTASKBARCLASSNAME;<br \/>\nRegisterClass(&amp;wc);<br \/>\n\/\/Create a Window for the taskbar. Referred the CtaskBar::Create() in taskbar.cpp.<br \/>\nhwndTaskBar= CreateWindowEx(0,HHTASKBARCLASSNAME, L&#8221;&#8221;, WS_POPUP, 0, 0,<br \/>\n10, 10, NULL, NULL, hInstance, NULL);<br \/>\n\/\/After the success of window creation, Register the window as a Taskbar using RegisterTaskbar() \/\/API. Referred the Method WINAPI CreateTaskBar()in explorer.cpp. This function calls the \/\/CTaskbar::Register and RegisterTaskBar() API.<br \/>\nif( hwndTaskBar)<br \/>\n{<br \/>\nif (RegisterTaskBar(hwndTaskBar))<br \/>\n{<br \/>\nRETAILMSG(1,(TEXT(&#8220;XRShellTaskBar: RegisterTaskBar success\\r\\n&#8221;)));<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nRETAILMSG(1,(TEXT(&#8220;XRShellTaskBar: RegisterTaskBar failed\\r\\n&#8221;)));<br \/>\n}<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nRETAILMSG(1,(TEXT(&#8220;XRShellTaskBar: Unable to create Taskbar window\\r\\n&#8221;)));<br \/>\n}<br \/>\nRETAILMSG(1,(TEXT(&#8220;Xshell TaskBar &#8211;\\r\\n&#8221;)));<br \/>\n}<br \/>\nTaskbar placeholder is ready, Now we have to add this with XRShell. It is simple, you can add this code in CXRShell.cpp file beginning and call the XShellTaskBar() function in the CXRShell::Execute() method as shown below.<br \/>\nunsigned long CXRShell::Execute(int nCmdShow)<br \/>\n{<br \/>\n\/*Existing Code *\/<br \/>\n\u2026..<br \/>\nInitializeAPI();<br \/>\nXShellTaskbar(m_hInstance); \/\/Our Black Taskbar for XRShell<br \/>\nCHR( ShowShell()); \/\/This is a blocking call<br \/>\n\u2026..<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As usual I started looking enthusiastically on new version of WinCE named Windows Embedded Compact&#8230;<\/p>\n","protected":false},"author":12,"featured_media":1369,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[213,215],"tags":[72,83,94,99],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/1748"}],"collection":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/comments?post=1748"}],"version-history":[{"count":1,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/1748\/revisions"}],"predecessor-version":[{"id":2849,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/1748\/revisions\/2849"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media\/1369"}],"wp:attachment":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media?parent=1748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/categories?post=1748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/tags?post=1748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}