<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Windows CE Graphics : CE vs. XP</title><link>http://blogs.msdn.com/jsirois/archive/tags/CE+vs.+XP/default.aspx</link><description>Tags: CE vs. XP</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Using GetObject to find out the pixel format of a bitmap.</title><link>http://blogs.msdn.com/jsirois/archive/2004/04/25/119997.aspx</link><pubDate>Mon, 26 Apr 2004 00:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:119997</guid><dc:creator>jsirois</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jsirois/comments/119997.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jsirois/commentrss.aspx?PostID=119997</wfw:commentRss><description>&lt;P&gt;GDI has a method call &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefgetobject.asp"&gt;GetObject&lt;/A&gt; which can be used to get information about a GDI object. On Windows CE you can use GetObject to get the pixel format for any bitmap by passing in a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefdibsection.asp"&gt;DIBSECTION&lt;/A&gt; instead of a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefbitmap.asp"&gt;BITMAP&lt;/A&gt;. Here's an example:&lt;/P&gt;
&lt;P&gt;&lt;PRE&gt;   DIBSECTION ds;
   HDC        hdc = GetDC(NULL);
   HGDIOBJ    bmp = GetCurrentObject(hdc, OBJ_BITMAP);

   GetObject(bmp, sizeof (ds), &amp;amp;ds);
&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Obviously, in production code you'd want to actually check return values, but this is the general idea. If (ds.dsBm.bmBitsPixel &amp;gt; 8) and (ds.dsBmih.biCompression == BI_BITFILEDS), ds.dsBitfields will&amp;nbsp;contain the bit&amp;nbsp;masks for the three color channels. If ds.dsBmih.biCompression is BI_RGB, the bitmap is either an RGB surface, or a palettized surface and ds.dsBitfields will be 0.&lt;/P&gt;
&lt;P&gt;This behavior makes it relatively easy to create a DIB section that has the same pixel format as another bitmap.&lt;/P&gt;
&lt;P&gt;FYI: I don't believe this works on the desktop.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=119997" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jsirois/archive/tags/WinCE/default.aspx">WinCE</category><category domain="http://blogs.msdn.com/jsirois/archive/tags/CE+vs.+XP/default.aspx">CE vs. XP</category></item><item><title>When WinMain just isn't the same...</title><link>http://blogs.msdn.com/jsirois/archive/2004/01/21/61447.aspx</link><pubDate>Thu, 22 Jan 2004 04:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:61447</guid><dc:creator>jsirois</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/jsirois/comments/61447.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jsirois/commentrss.aspx?PostID=61447</wfw:commentRss><description>&lt;P&gt;If I'm going to ever talk about writing code on Windows CE, I'll need to get started. Probably the most obvious place to start is &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/WinMain.asp"&gt;WinMain&lt;/A&gt;. Wait, that's the desktop's version of WinMain, since I'm writing code on Windows CE, I'll want to look at the Windows CE version of &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefwinmain.asp"&gt;WinMain&lt;/A&gt;. Why would CE have a different prototype for WinMain than XP? Well the answer to that is simple: Windows CE uses UNICODE.&amp;nbsp;Most (maybe all?)&amp;nbsp;of the Win32 functions that have ASCII or wide chacarcter variants on XP, only have the wide character variant on CE. This cuts down on the number of entries in coredll, and helps to promote writing international-safe apps.&lt;/P&gt;
&lt;P&gt;The prototype for XP's version of WinMain is:&lt;/P&gt;
&lt;P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;B&gt;int&lt;/B&gt; &lt;B&gt;WINAPI&lt;/B&gt; &lt;B&gt;WinMain(&lt;/B&gt;
  &lt;B&gt;HINSTANCE&lt;/B&gt; &lt;I&gt;hInstance&lt;/I&gt;&lt;B&gt;, &lt;/B&gt;
  &lt;B&gt;HINSTANCE&lt;/B&gt; &lt;I&gt;hPrevInstance&lt;/I&gt;&lt;B&gt;, &lt;/B&gt;
  &lt;B&gt;LPSTR&lt;/B&gt; &lt;I&gt;lpCmdLine&lt;/I&gt;&lt;B&gt;, &lt;/B&gt;
  &lt;B&gt;int&lt;/B&gt; &lt;I&gt;nShowCmd &lt;/I&gt;
&lt;B&gt;);&lt;/B&gt; &lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The prototype for CE's version of WinMain is:&lt;/P&gt;
&lt;P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;PRE&gt;&lt;B&gt;int&lt;/B&gt; &lt;B&gt;WINAPI&lt;/B&gt; &lt;B&gt;WinMain(&lt;/B&gt;
  &lt;B&gt;HINSTANCE&lt;/B&gt; &lt;I&gt;hInstance&lt;/I&gt;&lt;B&gt;, &lt;/B&gt;
  &lt;B&gt;HINSTANCE&lt;/B&gt; &lt;I&gt;hPrevInstance&lt;/I&gt;&lt;B&gt;, &lt;/B&gt;
  &lt;B&gt;LPWSTR&lt;/B&gt; &lt;I&gt;lpCmdLine&lt;/I&gt;&lt;B&gt;, &lt;/B&gt;
  &lt;B&gt;int&lt;/B&gt; &lt;I&gt;nShowCmd &lt;/I&gt;
&lt;B&gt;);&lt;/B&gt; &lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The only difference is with the &lt;EM&gt;lpCmdLine&lt;/EM&gt; parameter. On CE it's always of type &lt;STRONG&gt;LPWSTR&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Well, that's the first difference I wanted to point out. It's probably obvious to most people, but I think it's a decent place to start.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=61447" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jsirois/archive/tags/code/default.aspx">code</category><category domain="http://blogs.msdn.com/jsirois/archive/tags/CE+vs.+XP/default.aspx">CE vs. XP</category></item></channel></rss>