<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Windows CE Programming</title>
	<atom:link href="http://www.hjgode.de/wp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hjgode.de/wp</link>
	<description>Windows Mobile Development and usage</description>
	<lastBuildDate>Tue, 18 Jun 2013 08:25:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<!--CodeProjectFeeder channel--><category>CodeProject</category><generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Mobile Development: manage the event db, what wakes up your device</title>
		<link>http://www.hjgode.de/wp/2013/05/13/mobile-development-manage-the-event-db-what-wakes-up-your-device/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-manage-the-event-db-what-wakes-up-your-device</link>
		<comments>http://www.hjgode.de/wp/2013/05/13/mobile-development-manage-the-event-db-what-wakes-up-your-device/#comments</comments>
		<pubDate>Mon, 13 May 2013 14:36:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[tasker]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1737</guid>
		<description><![CDATA[The event db (it is my naming) holds all events and actions that can be invoked to launch an app or fire some events. NotificationList The tool shows all known notifications on a WM device. You can browse the event db and examine the defined events. Additionally the tool shows power change notifications.       [...]]]></description>
				<content:encoded><![CDATA[<p>The event db (it is my naming) holds all events and actions that can be invoked to launch an app or fire some events.</p>
<h2>NotificationList</h2>
<p>The tool shows all known notifications on a WM device. You can browse the event db and examine the defined events. Additionally the tool shows power change notifications.</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/05/noti_01.jpg"><img class="alignnone size-medium wp-image-1786" alt="noti_01" src="http://www.hjgode.de/wp/wp-content/uploads/2013/05/noti_01-225x300.jpg" width="225" height="300" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/05/noti_02.jpg"><img class="alignnone size-medium wp-image-1787" alt="noti_02" src="http://www.hjgode.de/wp/wp-content/uploads/2013/05/noti_02-225x300.jpg" width="225" height="300" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/05/noti_03.jpg"><img class="alignnone size-medium wp-image-1788" alt="noti_03" src="http://www.hjgode.de/wp/wp-content/uploads/2013/05/noti_03-225x300.jpg" width="225" height="300" /></a></p>
<p>In the mid window above you can see there is a timed event that will occur at 0:00 and start \windows\calupd.exe. This will wake your device all night and update the calendar entries for re-occurring schedules etc.</p>
<p>The right window shows the power notifications on a suspend/resume cycle.</p>
<p>Using the options menu you can save a list of the defined notification events.</p>
<p><span id="more-1737"></span><br />
<span style="text-decoration: underline;"><strong>Example file:</strong></span></p>
<table>
<tbody>
<tr>
<td><strong>App</strong></td>
<td>Args</td>
<td>Event</td>
<td>Start</td>
<td>End</td>
<td>Type</td>
</tr>
<tr>
<td>sqmevent.exe</td>
<td>&#8216;AppRunAtTime&#8217;</td>
<td>None</td>
<td>14052013 07:33</td>
<td>01010001 00:00</td>
<td>Time</td>
</tr>
<tr>
<td>\windows\enrollnot.exe</td>
<td>&#8216;AppRunAtTime&#8217;</td>
<td>None</td>
<td>14052013 12:00</td>
<td>01010001 00:00</td>
<td>Time</td>
</tr>
<tr>
<td>\Windows\calupd.exe</td>
<td>&#8216;AppRunAtTime&#8217;</td>
<td>None</td>
<td>15052013 00:00</td>
<td>01010001 00:00</td>
<td>Time</td>
</tr>
<tr>
<td>CALNOT.EXE</td>
<td>&#8216;AppRunAtTime&#8217;</td>
<td>None</td>
<td>20052013 00:00</td>
<td>01010001 00:00</td>
<td>Time</td>
</tr>
<tr>
<td>ceipui.exe</td>
<td>&#8216;AppRunAtTime&#8217;</td>
<td>None</td>
<td>27052013 23:48</td>
<td>01010001 00:00</td>
<td>Time</td>
</tr>
<tr>
<td>clocknot.exe</td>
<td>&#8216;AppRunAtTime&#8217;</td>
<td>None</td>
<td>03112013 02:00</td>
<td>01010001 00:00</td>
<td>Time</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\MSPPDUGateway_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\WLMScheduler_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeZoneChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>\\.\Notifications\NamedEvents\WLMScheduler_TimeChangeEvent</td>
<td>&#8221;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>calnot.exe</td>
<td>&#8216;AppRunAfterRestore&#8217;</td>
<td>RestoreEnd</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>calnot.exe</td>
<td>&#8216;AppRunAfterTimeChange&#8217;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>ceipui.exe</td>
<td>&#8216;AppRunAfterTzChange&#8217;</td>
<td>TimeZoneChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>ceipui.exe</td>
<td>&#8216;AppRunAfterTimeChange&#8217;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>clocknot.exe</td>
<td>&#8216;AppRunAfterTimeChange&#8217;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>clocknot.exe</td>
<td>&#8216;AppRunAfterRestore&#8217;</td>
<td>RestoreEnd</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>repllog.exe</td>
<td>&#8216;AppRunAfterRndisFnDetected&#8217;</td>
<td>RndisFNDetected</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>repllog.exe</td>
<td>&#8216;AppRunAfterTimeChange&#8217;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>repllog.exe</td>
<td>&#8216;AppRunAtRs232Detect&#8217;</td>
<td>RS232Detected</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>Tskschedule.exe</td>
<td>&#8216;-Time&#8217;</td>
<td>TimeZoneChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
<tr>
<td>Tskschedule.exe</td>
<td>&#8216;-Time&#8217;</td>
<td>TimeChange</td>
<td>01010001 00:00</td>
<td>01010001 00:00</td>
<td>Event</td>
</tr>
</tbody>
</table>
<p>You can see the applications or named events that are issued. Then there are arguments that are provided to the application. You can also see the event type.</p>
<p>There are different notification types:</p>
<pre>        public enum CeNotificationType
        {
            CNT_EVENT = 1,          //@flag CNT_EVENT  | System event notification
            CNT_TIME,               //@flag CNT_TIME   | Time-based notification
            CNT_PERIOD,             //@flag CNT_PERIOD | Time-based notification is active for
                                    // time period between stStart and stEnd
            CNT_CLASSICTIME         //@flag CNT_CLASSICTIME | equivalent to using (obsolete)
            // CeSetUserNotification function - standard command line is
            // supplied. lpszArguments must be NULL
        }</pre>
<p>CeSetUserNotification is spared here. This structure is used to display user notification bubbles on the screen.</p>
<p>The notification API enables you to setup notification for different events:</p>
<pre>        public enum CeNotificationEvent
        {
            NOTIFICATION_EVENT_NONE,
            NOTIFICATION_EVENT_TIME_CHANGE,
            NOTIFICATION_EVENT_SYNC_END,
            NOTIFICATION_EVENT_ON_AC_POWER,
            NOTIFICATION_EVENT_OFF_AC_POWER,
            NOTIFICATION_EVENT_NET_CONNECT,
            NOTIFICATION_EVENT_NET_DISCONNECT,
            NOTIFICATION_EVENT_DEVICE_CHANGE,
            NOTIFICATION_EVENT_IR_DISCOVERED,
            NOTIFICATION_EVENT_RS232_DETECTED,
            NOTIFICATION_EVENT_RESTORE_END,
            NOTIFICATION_EVENT_WAKEUP,
            NOTIFICATION_EVENT_TZ_CHANGE,
            NOTIFICATION_EVENT_MACHINE_NAME_CHANGE,
            NOTIFICATION_EVENT_RNDIS_FN_DETECTED,
            NOTIFICATION_EVENT_INTERNET_PROXY_CHANGE, 
            NOTIFICATION_EVENT_LAST = NOTIFICATION_EVENT_INTERNET_PROXY_CHANGE
        };</pre>
<p>Please note that not all devices support all these types. As the names are more less speaking names I do not explain these event types any further.</p>
<p>If you want to add your own periodic, timed, application, you should look at my Tasker application.</p>
<p>PowerNotifications</p>
<p>Although not directly related to the above events db, it may also good to know how you can subscribe to power notifications. The sample uses the MS PowerNotifications Message queue. When registering for the power messages, you can define a filter to get only power notification messages you are interested in.</p>
<pre>        const uint POWER_NOTIFY_ALL = 0xFFFFFFFF;
        const uint PBT_TRANSITION          =  0x00000001;  // broadcast specifying system power state transition        
        const uint PBT_RESUME = 0x00000002;  // broadcast notifying a resume, specifies previous state
        const uint PBT_POWERSTATUSCHANGE = 0x00000004;  // power supply switched to/from AC/DC
        const uint PBT_POWERINFOCHANGE = 0x00000008;</pre>
<p>Every message comes with a data structure:</p>
<pre>        [StructLayout(LayoutKind.Sequential)]
        struct POWER_BROADCAST
        {
            UInt32 dwMsg;
            UInt32 dwFlags;
            UInt32 dwLength;
            string sSystemPowerState; //WCHAR SystemPowerState[1];
        }

And we have a lot of flags to lookup:</pre>
<pre>        //
        // System Power (Source/State/Option) Flags
        //
        [Flags]
        enum PowerState:uint
        {
            // upper bytes: common power state bits
            //#define POWER_STATE(f)           ((f) &amp;  0xFFFF0000);        // power state mask
            POWER_STATE_NA              = 0x00,
            POWER_STATE_ON              = 0x00010000,        // on state
            POWER_STATE_OFF             = 0x00020000,        // no power, full off
            POWER_STATE_CRITICAL        = 0x00040000,        // critical off
            POWER_STATE_BOOT            = 0x00080000,        // boot state
            POWER_STATE_IDLE            = 0x00100000,        // idle state
            POWER_STATE_SUSPEND         = 0x00200000,        // suspend state
            POWER_STATE_UNATTENDED      = 0x00400000,        // Unattended state.
            POWER_STATE_RESET           = 0x00800000,        // reset state
            POWER_STATE_USERIDLE        = 0x01000000,        // user idle state
            POWER_STATE_BACKLIGHTON     = 0x02000000,        // device scree backlight on
            POWER_STATE_PASSWORD        = 0x10000000,        // This state is password protected.
        }
        [Flags]
        enum PowerEventType
        {
            PBT_TRANSITION = 0x00000001,
            PBT_RESUME = 0x00000002,
            PBT_POWERSTATUSCHANGE = 0x00000004,
            PBT_POWERINFOCHANGE = 0x00000008,
        }

        [Flags]
        enum PowerState1
        {
            POWER_STATE_ON = (0x00010000),
            POWER_STATE_OFF = (0x00020000),

            POWER_STATE_CRITICAL = (0x00040000),
            POWER_STATE_BOOT = (0x00080000),
            POWER_STATE_IDLE = (0x00100000),
            POWER_STATE_SUSPEND = (0x00200000),
            POWER_STATE_RESET = (0x00800000),
        }</pre>
<p>And, of course, we need some P/Invoke:</p>
<pre>        #region DllImports
        [DllImport("coredll.dll")]
        private static extern IntPtr RequestPowerNotifications(IntPtr hMsgQ, uint Flags);
        [DllImport("coredll.dll")]
        private static extern uint WaitForSingleObject(IntPtr hHandle, int wait);
        [DllImport("coredll.dll")]
        private static extern IntPtr CreateMsgQueue(string name, ref MsgQOptions options);
        [DllImport("coredll.dll")]
        private static extern bool ReadMsgQueue(IntPtr hMsgQ, byte[] lpBuffer, uint cbBufSize, ref uint lpNumRead, int dwTimeout, ref uint pdwFlags);
        #endregion</pre>
<p>The main work is done inside a thread function:</p>
<pre>        private void DoWork()
        {
            byte[] buf = new byte[10000];
            uint nRead = 0, flags = 0, res = 0;

            System.Diagnostics.Debug.WriteLine("starting loop");
            try
            {
                while (!done)
                {
                    res = WaitForSingleObject(ptr, 2500);
                    if (res == 0)
                    {
                        ReadMsgQueue(ptr, buf, (uint)buf.Length, ref nRead, -1, ref flags);
                        //System.Diagnostics.Debug.WriteLine("message: " + ConvertByteArray(buf, 0) + " flag: " + ConvertByteArray(buf, 4));
                        uint flag = ConvertByteArray(buf, 4);
                        string msg = "";
                        msg += ((PowerState)flag).ToString();
                        if (msg=="")
                            msg = "Unknown Flag: " + flag.ToString();
                        if (msg=="0")
                            msg = "POWER_STATE_NA";

                        if (msg != "")
                        {
                            if(OnMsg!=null)
                                OnMsg(this, new PwrEventArgs(msg, flag));
                            System.Diagnostics.Debug.WriteLine(msg);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (!done)
                {
                    System.Diagnostics.Debug.WriteLine("Got exception: " + ex);
                }
            }
            System.Diagnostics.Debug.WriteLine("loop ended");
        }</pre>
<p>The sample code implements some event and delegates that you can subscribe to to get power notification messages.</p>
<p>Source code available via https://win-mobile-code.googlecode.com/svn/trunk/NotificationList/NotificationsList</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F05%2F13%2Fmobile-development-manage-the-event-db-what-wakes-up-your-device%2F&amp;title=Mobile+Development%3A+manage+the+event+db%2C+what+wakes+up+your+device" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F05%2F13%2Fmobile-development-manage-the-event-db-what-wakes-up-your-device%2F&amp;title=Mobile+Development%3A+manage+the+event+db%2C+what+wakes+up+your+device" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F05%2F13%2Fmobile-development-manage-the-event-db-what-wakes-up-your-device%2F&amp;title=Mobile+Development%3A+manage+the+event+db%2C+what+wakes+up+your+device" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F05%2F13%2Fmobile-development-manage-the-event-db-what-wakes-up-your-device%2F&amp;T=Mobile+Development%3A+manage+the+event+db%2C+what+wakes+up+your+device" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F05%2F13%2Fmobile-development-manage-the-event-db-what-wakes-up-your-device%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F05%2F13%2Fmobile-development-manage-the-event-db-what-wakes-up-your-device%2F&amp;t=Mobile+Development%3A+manage+the+event+db%2C+what+wakes+up+your+device" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/05/13/mobile-development-manage-the-event-db-what-wakes-up-your-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Mobile 6.5: Changed Screen Geometry</title>
		<link>http://www.hjgode.de/wp/2013/04/19/windows-mobile-6-5-changed-screen-geometry/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-mobile-6-5-changed-screen-geometry</link>
		<comments>http://www.hjgode.de/wp/2013/04/19/windows-mobile-6-5-changed-screen-geometry/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 19:30:41 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[autoscale mode]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[form factor]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[QVGA]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[VGA]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1753</guid>
		<description><![CDATA[Screen layout changes from Windows Mobile 6.1 to Windows Mobile Embedded Handheld 6.5 The Windows Mobile screen geometry changed from Windows Mobile 6.1 and before to the actual Windows Mobile 6.5 (also called Windows Embedded Handheld). Not only the geometry changed, the layout also changed. The Start icon is now moved to the bottom whereas [...]]]></description>
				<content:encoded><![CDATA[<h2>Screen layout changes from Windows Mobile 6.1 to Windows Mobile Embedded Handheld 6.5</h2>
<p>The Windows Mobile screen geometry changed from Windows Mobile 6.1 and before to the actual Windows Mobile 6.5 (also called Windows Embedded Handheld). Not only the geometry changed, the layout also changed. The Start icon is now moved to the bottom whereas before WM65 the start icon was on the left in the taskbar.</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/Clipboard01.gif"><img class="alignnone size-medium wp-image-1754" alt="wm61screen" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/Clipboard01-227x300.gif" width="227" height="300" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/Clipboard02.gif"><img class="alignnone size-medium wp-image-1755" alt="wm65screen" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/Clipboard02-228x300.gif" width="228" height="300" /></a></p>
<p>The taskbar and the menubar was about 26 pixels in height. With WM65 the taskbar is about 18 pixels in height and the menu bar occupies 34 pixels in height.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="206"><b>QVGA screen geometry</b></td>
<td valign="top" width="206">
<p align="center"><b>Windows Mobile 6.1</b></p>
</td>
<td valign="top" width="206">
<p align="center"><b>Windows Mobile 6.5</b></p>
</td>
</tr>
<tr>
<td valign="top" width="206"><b>taskbar</b></td>
<td valign="top" width="206">
<p align="center">26</p>
</td>
<td valign="top" width="206">
<p align="center">18</p>
</td>
</tr>
<tr>
<td valign="top" width="206"><b>menubar</b></td>
<td valign="top" width="206">
<p align="center">26</p>
</td>
<td valign="top" width="206">
<p align="center">34</p>
</td>
</tr>
<tr>
<td valign="top" width="206"><b>client size</b></td>
<td valign="top" width="206">
<p align="center">240;268</p>
</td>
<td valign="top" width="206">
<p align="center">240;268</p>
</td>
</tr>
<tr>
<td valign="top" width="206"><b>client size height no taskbar</b></td>
<td valign="top" width="206">
<p align="center">240;294</p>
</td>
<td valign="top" width="206">
<p align="center">240;302</p>
</td>
</tr>
<tr>
<td valign="top" width="206"><b>client size height no menubar</b></td>
<td valign="top" width="206">
<p align="center">240;294</p>
</td>
<td valign="top" width="206">
<p align="center">240;286</p>
</td>
</tr>
</tbody>
</table>
<p>You can see that assuming a fixed client size will give problems with the layout of the application, especially if menubar and taskbar height are assumed as being 26 pixels all the time.</p>
<p>Applications that only use the client size with the taskbar and menubar visible, will show normally, as the resulting client size does not differ between WM61 and WM65.</p>
<h3><span id="more-1753"></span>Application geometry</h3>
<p>Applications that use any code to make there window more or less fullscreen have to adopt for the new layout of the screen. Applications that do not use code to adopt there screen to the new layout may look like this:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm61_QVGA_sample1.gif"><img class="alignnone size-full wp-image-1757" alt="geometry_wm61_QVGA_sample1" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm61_QVGA_sample1.gif" width="144" height="192" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_QVGA_sample1.gif"><img class="alignnone size-full wp-image-1758" alt="geometry_wm65_QVGA_sample1" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_QVGA_sample1.gif" width="143" height="194" /></a></p>
<p>The screen moves slightly outside top assuming 26 pixels for taskbar and menubar and so the &#8216;fullscreen&#8217; app does not not cover the bottom menu bar completely.</p>
<p>If an app has used correct coding it would display better on WM65 (wrong coded Citrix 11.5 here):</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__sample5.gif"><img class="alignnone size-medium wp-image-1759" alt="geometry_wm65_VGA__sample5" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__sample5-225x300.gif" width="225" height="300" /></a>    <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__sample5_showfullscreen.gif"><img class="alignnone size-medium wp-image-1760" alt="geometry_wm65_VGA__sample5_showfullscreen" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__sample5_showfullscreen-225x300.gif" width="225" height="300" /></a></p>
<h2>High Resolution awareness</h2>
<h3>Applications</h3>
<p>A long time nearly all Windows Mobile device came with a QVGA screen resolution only. Now you may be faced by a Windows Mobile VGA screen resolution, whereas consumer smartphones come with many different screen resolutions.</p>
<p>Windows Mobile 6 will adopt non-hires aware applications automatically to the screen resolution. The OS looks for a resource named HIRES_AWARE in the application executable and for the major subsystem version number being less than 5.</p>
<p>If an app does not have the HIRES_AWARE and the major version number is less than 5, the Windows Mobile OS automatically scales the app to the screen size.</p>
<p>The &#8216;auto-scale&#8217; uses the dpi values for scaling. The screen sizes (the screen diagonal) is mostly similar. So a VGA screen has more pixels per inch (ie 192dpi, dots-per-inch). Whereas a QVGA screen has about 96 pixels per inch (96dpi).</p>
<p>Dotnet AutoscaleMode</p>
<p>In Visual Studio you can set the FormFactor and Autscale-Mode (auto, none) for a form:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_dpi_auto.gif"><img class="alignnone size-medium wp-image-1771" alt="dotnet_dpi_auto" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_dpi_auto-300x203.gif" width="300" height="203" /></a>  <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_formfactor.gif"><img class="alignnone size-medium wp-image-1774" alt="dotnet_formfactor" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_formfactor-300x288.gif" width="300" height="288" /></a></p>
<p>If AutoScale is set to dpi, everything is OK, the form &#8216;scales&#8217; automatically. If set to None, the form content is not scaled:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_form_dpi_auto.gif"><img class="alignnone size-medium wp-image-1772" alt="dotnet_form_dpi_auto" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_form_dpi_auto-225x300.gif" width="225" height="300" /></a><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_form_dpi_none.gif">   <img class="alignnone size-medium wp-image-1773" alt="dotnet_form_dpi_none" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_form_dpi_none-225x300.gif" width="225" height="300" /></a></p>
<p>If you start desiging the form with QVGA form factor and switch then to VGA form factor, you can see the change directly:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_formfactor_vga.gif"><img class="alignnone size-full wp-image-1779" alt="dotnet_formfactor_vga" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/dotnet_formfactor_vga.gif" width="239" height="165" /></a></p>
<h3>Browser applications and VGA screen</h3>
<p>Internet browser applications must avoid using fixed pixel count for there screen layout. You can imagine what happens if a element like a table is specified for 240 pixels wide on a VGA screen supporting 480 pixels:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__sample3.gif"><img class="alignnone size-medium wp-image-1769" alt="geometry_wm65_VGA__sample3" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__sample3-225x300.gif" width="225" height="300" /></a></p>
<h2>More Sample screens</h2>
<h3>Windows Mobile 6.1 QVGA</h3>
<p>without and with menubar/taskbar:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm61_QVGA_noMenu.gif"><img class="alignnone size-medium wp-image-1762" alt="geometry_wm61_QVGA_noMenu" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm61_QVGA_noMenu-225x300.gif" width="225" height="300" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm61_QVGA_noTaskbar.gif"><img class="alignnone size-medium wp-image-1764" alt="geometry_wm61_QVGA_noTaskbar" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm61_QVGA_noTaskbar-225x300.gif" width="225" height="300" /></a></p>
<p>Windows Mobile 6.5 QVGA</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_QVGA_noMenu.gif"><img alt="geometry_wm65_QVGA_noMenu" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_QVGA_noMenu-225x300.gif" width="225" height="300" />   </a><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_QVGA_noTaskbar.gif"><img alt="geometry_wm65_QVGA_noTaskbar" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_QVGA_noTaskbar-225x300.gif" width="225" height="300" /></a></p>
<p>Windows Mobile 6.5 VGA</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__noMenu1.gif"><img class="alignnone size-medium wp-image-1765" alt="geometry_wm65_VGA__noMenu" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__noMenu1-225x300.gif" width="225" height="300" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__noTaskbar.gif"><img class="alignnone size-medium wp-image-1766" alt="geometry_wm65_VGA__noTaskbar" src="http://www.hjgode.de/wp/wp-content/uploads/2013/04/geometry_wm65_VGA__noTaskbar-225x300.gif" width="225" height="300" /></a></p>
<p>&nbsp;</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F04%2F19%2Fwindows-mobile-6-5-changed-screen-geometry%2F&amp;title=Windows+Mobile+6.5%3A+Changed+Screen+Geometry" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F04%2F19%2Fwindows-mobile-6-5-changed-screen-geometry%2F&amp;title=Windows+Mobile+6.5%3A+Changed+Screen+Geometry" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F04%2F19%2Fwindows-mobile-6-5-changed-screen-geometry%2F&amp;title=Windows+Mobile+6.5%3A+Changed+Screen+Geometry" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F04%2F19%2Fwindows-mobile-6-5-changed-screen-geometry%2F&amp;T=Windows+Mobile+6.5%3A+Changed+Screen+Geometry" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F04%2F19%2Fwindows-mobile-6-5-changed-screen-geometry%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F04%2F19%2Fwindows-mobile-6-5-changed-screen-geometry%2F&amp;t=Windows+Mobile+6.5%3A+Changed+Screen+Geometry" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/04/19/windows-mobile-6-5-changed-screen-geometry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Download Monitor upload/insert into post broken</title>
		<link>http://www.hjgode.de/wp/2013/03/11/worpress-download-monitor-uploadinsert-into-post-broken/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=worpress-download-monitor-uploadinsert-into-post-broken</link>
		<comments>http://www.hjgode.de/wp/2013/03/11/worpress-download-monitor-uploadinsert-into-post-broken/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 19:14:47 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[download monitor]]></category>
		<category><![CDATA[insert into post]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1741</guid>
		<description><![CDATA[With the latest update of download monitor plugin for wordpress I got a problem.  The download code was not any more inserted into the post. I place the cursor in my new post and the clicked the download monitor symbol (the arrow down) to upload and insert a new file. After entering a title and [...]]]></description>
				<content:encoded><![CDATA[<p>With the latest update of download monitor plugin for wordpress I got a problem.  The download code was not any more inserted into the post.</p>
<p>I place the cursor in my new post and the clicked the download monitor symbol (the arrow down) to upload and insert a new file. After entering a title and selecting the file to upload using the browse button to upload a local file, I click [Save Download].</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox.png"><img class="alignnone size-medium wp-image-1742" alt="Screenshot-Edit Post ‹ Windows CE Programming — WordPress - Mozilla Firefox" src="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-300x186.png" width="300" height="186" /></a></p>
<p>Then at the bottom of the &#8220;Add Download&#8221; click on Save new download.</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-1.png"><img class="alignnone size-medium wp-image-1743" alt="Screenshot-Edit Post ‹ Windows CE Programming — WordPress - Mozilla Firefox-1" src="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-1-300x187.png" width="300" height="187" /></a></p>
<p>A new dialog pops up and I click [Insert into post]</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-2.png"><img class="alignnone size-medium wp-image-1744" alt="Screenshot-Edit Post ‹ Windows CE Programming — WordPress - Mozilla Firefox-2" src="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-2-300x191.png" width="300" height="191" /></a></p>
<p>Now nothing happens, the dialog remains on screen.</p>
<p><span id="more-1741"></span></p>
<p>Unfortunately the developer (<a href="https://github.com/mikejolley/download-monitor" target="_blank">mikejoley</a>) of  this usefull plugin stopped further development of the plugin. This is a shame and a bang against the head of all users of the plugin.</p>
<p>I decided to take a look at the code and setup a test xampp system with eclipse, xdebug and wordpress 3.5.1. Then installed the Donwload Monitor plugin and start to understand jQuery and all the code (not all, but the upload).</p>
<p>Then in Google Chrome&#8217;s developer console window I saw the problem and fixed it.</p>
<p>In uploader.php:</p>
<pre id="LC752">if (closed != '') {
  var ed = win.tinyMCE.activeEditor;
  var caret = ed.dom.select('span#caret_pos_holder')[0];
  ed.dom.setAttrib(caret, 'id', '')
  ed.selection.select(caret);
  // ed.dom.remove(caret);
});
}</pre>
<div id="LC753">exchange the last two line here (lines 751/752) and add a semicolon at end of ed.dom.setAttrib(caret, &#8216;id&#8217;, &#8221;) / Line 748</div>
<pre>if (closed != '') {
  var ed = win.tinyMCE.activeEditor;
  var caret = ed.dom.select('span#caret_pos_holder')[0];
  ed.dom.setAttrib(caret, 'id', '')<strong>;</strong>
  ed.selection.select(caret);
  // ed.dom.remove(caret);
<strong>}</strong>
<strong>});</strong></pre>
<p>Now uploading and insert into post work:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-3.png"><img class="alignnone size-medium wp-image-1745" alt="Screenshot-Edit Post ‹ Windows CE Programming — WordPress - Mozilla Firefox-3" src="http://www.hjgode.de/wp/wp-content/uploads/2013/03/Screenshot-Edit-Post-‹-Windows-CE-Programming-—-WordPress-Mozilla-Firefox-3-300x159.png" width="300" height="159" /></a></p>
<p>And you get the markup [Download id not defined] into your edited post.</p>
<p>I <a href="https://github.com/hjgode/download-monitor-1.git" target="_blank">forked</a> the github sources of download monitor and send a <a href="https://github.com/mikejolley/download-monitor/pulls" target="_blank">pull request</a> to mikejolley.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F11%2Fworpress-download-monitor-uploadinsert-into-post-broken%2F&amp;title=WordPress%3A+Download+Monitor+upload%2Finsert+into+post+broken" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F11%2Fworpress-download-monitor-uploadinsert-into-post-broken%2F&amp;title=WordPress%3A+Download+Monitor+upload%2Finsert+into+post+broken" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F11%2Fworpress-download-monitor-uploadinsert-into-post-broken%2F&amp;title=WordPress%3A+Download+Monitor+upload%2Finsert+into+post+broken" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F11%2Fworpress-download-monitor-uploadinsert-into-post-broken%2F&amp;T=WordPress%3A+Download+Monitor+upload%2Finsert+into+post+broken" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F11%2Fworpress-download-monitor-uploadinsert-into-post-broken%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F11%2Fworpress-download-monitor-uploadinsert-into-post-broken%2F&amp;t=WordPress%3A+Download+Monitor+upload%2Finsert+into+post+broken" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/03/11/worpress-download-monitor-uploadinsert-into-post-broken/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mobile Development: showFullScreen, a tool to change foreign windows attributes</title>
		<link>http://www.hjgode.de/wp/2013/03/07/mobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes</link>
		<comments>http://www.hjgode.de/wp/2013/03/07/mobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 14:09:08 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[taskbar]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1731</guid>
		<description><![CDATA[Hello attached is a small tool to alter foreign windows. You can show/hide, enable/disable and resize windows. One example is to disable the taskbar window: showFullScreen -disable -class &#8220;HHTASKBAR&#8221; How to launch Here is a list of possible arguments: Arguments:                default          meaning -class                    ""           [...]]]></description>
				<content:encoded><![CDATA[<p>Hello</p>
<p>attached is a small tool to alter foreign windows. You can show/hide, enable/disable and resize windows.</p>
<p>One example is to disable the taskbar window: showFullScreen -disable -class &#8220;HHTASKBAR&#8221;</p>
<h2>How to launch</h2>
<p>Here is a list of possible arguments:</p>
<pre>Arguments:                default          meaning
-class                    ""               class name of window to change, optional
-title                    ""               title of window to change, optional
            at least -class or -title must be used to change a window

-fullscreen               false            make window fullscreen
-maximized                false            make window normal size

-show                     no change        make window visible
-hide                     no change        make window invisible

-enable                   no change        enable window
-disable                  no change        disable window

-list                    -                 list windows into file</pre>
<h2>Examples</h2>
<p>And here some more examples for usage:</p>
<pre>Enable IE6 soft menu button:    -class "IE6on6SoftKeyBar" -enable
Disable IE6 soft menu button:    -class "IE6on6SoftKeyBar" -disable

Enable taskbar:        -class "HHTASKBAR" -enable
Disable taskbar:    -class "HHTASKBAR" -disable

make win fullscreen: -class "WFIcaClient" -fullscreen</pre>
<h2>List windows (like remote spy does)</h2>
<p>Please use -list argument, to get a list of running windows:</p>
<p><span id="more-1731"></span></p>
<pre>0x55889c2a: showFullScreen utility v 1.0 * Date and Time: 07.03.2013 14:55:36
0x55889c2a: Window List
this    nr    hwnd    procID    procName    class    title    pos/size    state
0x55889c2a: 1    0x7c072d30    0x5aaef4a6    ('gwes.exe')    '@MSSCOPE'    'SCOPE'    0;0/480;640 (480x640)    [hidden]
0x55889c2a: 2    0x7c070bb0    0x5aaef4a6    ('gwes.exe')    'static'    'CursorWindow'    200;280/280;360 (80x80)    [hidden]
0x55889c2a: 3    0x7c073680    0x7a451c12    ('shell32.exe')    'HHTaskBar'    ''    0;0/480;36 (480x36)    [visible]
0x55889c2a: 4    0x7c071880    0x3c8a25d2    ('device.exe')    'SipBackDropWndClass'    ''    0;412/480;572 (480x160)    [hidden]
0x55889c2a: 5    0x7c071780    0x3c8a25d2    ('device.exe')    'SipWndClass'    ''    0;412/480;572 (480x160)    [hidden]
0x55889c2a: 6    0x7c073880    0x7a451c12    ('shell32.exe')    'MS_SIPBUTTON'    'MS_SIPBUTTON'    206;572/274;640 (68x68)    [hidden]
0x55889c2a: 7    0x7c076b80    0xdc8eb29a    ('filesys.exe')    'ms_sqlce_se_notify_wndproc'    'ms_sqlce_se_notify_wndproc'    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 8    0x7c075ae0    0x7a451c12    ('shell32.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 9    0x7c0758f0    0x7a451c12    ('shell32.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 10    0x7c08e930    0x7a451c12    ('shell32.exe')    'WimData'    'WimData'    10;10/20;20 (10x10)    [hidden]
0x55889c2a: 11    0x7c084bf0    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 12    0x7c0842d0    0xd9528c2a    ('cprog.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [hidden]
0x55889c2a: 13    0x7c07db60    0xd9528c2a    ('cprog.exe')    'CEStockWnd-17e492c'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 14    0x7c07da20    0xd9528c2a    ('cprog.exe')    'CE_UTILWND-17e0908'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 15    0x7c07ae80    0xd9528c2a    ('cprog.exe')    'XME Notify Window 98B84234'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 16    0x7c084060    0xd9528c2a    ('cprog.exe')    'Dialog'    'Phone - Incoming'    -4;214/484;572 (488x358)    [hidden]
0x55889c2a: 17    0x7c075670    0x7a451c12    ('shell32.exe')    'DesktopExplorerWindow'    'Desktop'    0;36/480;640 (480x604)    [visible]
0x55889c2a: 18    0x7c0d1c90    0x77404a5a    ('Notes.exe')    'COMPIMEUI'    'COMPIMEUI'    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 19    0x7c09eb80    0x77404a5a    ('Notes.exe')    'Ime'    'Default Ime'    0;0/1;1 (1x1)    [hidden]
0x55889c2a: 20    0x7c0d05a0    0x77404a5a    ('Notes.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 21    0x7c0d0030    0x77404a5a    ('Notes.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 22    0x7c0d1d80    0x77404a5a    ('Notes.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 23    0x7c09e850    0x77404a5a    ('Notes.exe')    'Notes'    'Notes'    0;36/480;572 (480x536)    [visible]
0x55889c2a: 24    0x7c0d1680    0xbb46d6ba    ('remote.exe')    'MyMobiler'    'MyMobiler'    0;36/480;640 (480x604)    [hidden]
0x55889c2a: 25    0x7c07f010    0x7a451c12    ('shell32.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 26    0x7c07ac20    0x7a451c12    ('shell32.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 27    0x7c07b850    0x7a451c12    ('shell32.exe')    'MSSTARTMENU'    'System'    0;36/480;640 (480x604)    [visible]
0x55889c2a: 28    0x7c09d610    0x3aceae5a    ('rapiclnt')    'OLEAUT32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 29    0x7c08dd50    0x96a75c96    ('tmail.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 30    0x7c08d900    0x96a75c96    ('tmail.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [hidden]
0x55889c2a: 31    0x7c09cd70    0x96a75c96    ('tmail.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 32    0x7c09c700    0x96a75c96    ('tmail.exe')    'Mapi.MainWnd'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 33    0x7c09c5b0    0x96a75c96    ('tmail.exe')    'Inbox.MainWnd'    'Messaging'    0;36/480;572 (480x536)    [hidden]
0x55889c2a: 34    0x7c09b9d0    0x3aceae5a    ('rapiclnt')    'RapiClnt'    'Remote API Client'    0;0/1;1 (1x1)    [hidden]
0x55889c2a: 35    0x7c089d10    0x16abe79e    ('IntermecSettings.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 36    0x7c07d860    0x16abe79e    ('IntermecSettings.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 37    0x7c089ee0    0x16abe79e    ('IntermecSettings.exe')    '#NETCF_AGL_BASE_'    'Intermec Settings'    0;36/480;572 (480x536)    [visible]
0x55889c2a: 38    0x7c08b5b0    0x16abe79e    ('IntermecSettings.exe')    'COMPIMEUI'    'COMPIMEUI'    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 39    0x7c08b4a0    0x16abe79e    ('IntermecSettings.exe')    'Ime'    'Default Ime'    0;0/1;1 (1x1)    [hidden]
0x55889c2a: 40    0x7c089600    0x16abe79e    ('IntermecSettings.exe')    '#NETCF_AGL_PARK_\Windows\IntermecSettings.exe'    ''    -2000;-2000/-2000;-2000 (0x0)    [hidden]
0x55889c2a: 41    0x7c087a60    0xf6b37482    ('repllog.exe')    'PolApp Window'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 42    0x7c0875e0    0xf6b37482    ('repllog.exe')    'Mapi.MainWnd'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 43    0x7c084780    0x7a451c12    ('shell32.exe')    'SSUpdate.MainWnd'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 44    0x7c0873a0    0xf6b37482    ('repllog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 45    0x7c0871b0    0xf6b37482    ('repllog.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 46    0x7c087080    0xf6b37482    ('repllog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 47    0x7c086d80    0xf6b37482    ('repllog.exe')    'ActiveSync'    'ActiveSync'    0;36/480;572 (480x536)    [visible]
0x55889c2a: 48    0x7c084880    0xd9528c2a    ('cprog.exe')    'PolApp Window'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 49    0x7c07f200    0xd9528c2a    ('cprog.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 50    0x7c07dca0    0xd9528c2a    ('cprog.exe')    'XMEThreadPlayer Wnd Class'    ''    0;36/480;640 (480x604)    [hidden]
0x55889c2a: 51    0x7c07d640    0x7a451c12    ('shell32.exe')    'SIMInit'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 52    0x7c07cf60    0x7a451c12    ('shell32.exe')    'Mapi.MainWnd'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 53    0x7c07cb30    0x7a451c12    ('shell32.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 54    0x7c07ca40    0x7a451c12    ('shell32.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 55    0x7c07c610    0x7a451c12    ('shell32.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 56    0x7c07c950    0x1a2de4a6    ('services.exe')    'WLMContactsPlugin.WndClass'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 57    0x7c07a9b0    0xd9528c2a    ('cprog.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 58    0x7c07a380    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 59    0x7c079940    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 60    0x7c079750    0xd9528c2a    ('cprog.exe')    'menu_worker'    ''    0;-100/0;-100 (0x0)    [visible]
0x55889c2a: 61    0x7c079530    0xd9528c2a    ('cprog.exe')    'PolApp Window'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 62    0x7c0790d0    0xd9528c2a    ('cprog.exe')    'CallPol'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 63    0x7c078fe0    0xd9528c2a    ('cprog.exe')    'MSCprog'    'Phone '    0;36/480;572 (480x536)    [hidden]
0x55889c2a: 64    0x7c078280    0xb93a2eea    ('connmgr.exe')    'ConnMgrWndClass'    'SchedConnNotify'    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 65    0x7c077fc0    0xb93a2eea    ('connmgr.exe')    'StatStore Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 66    0x7c077cc0    0xb93a2eea    ('connmgr.exe')    'StatStore Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 67    0x7c077bc0    0xb93a2eea    ('connmgr.exe')    'ConnMgrWndClass'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 68    0x7c072950    0xb93a2eea    ('connmgr.exe')    'StatStore Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 69    0x7c072300    0xb93a2eea    ('connmgr.exe')    'ConnMgrWndClass'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 70    0x7c0721f0    0xb93a2eea    ('connmgr.exe')    'ConnMgrWndClass'    'ConnMgrSink'    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 71    0x7c076e30    0x5aaef4a6    ('gwes.exe')    'TOUCHSTUBWND_CLASS'    ''    0;0/1;1 (1x1)    [hidden]
0x55889c2a: 72    0x7c076530    0x1a2de4a6    ('services.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 73    0x7c0761b0    0x395a84c2    ('AAM.exe')    ''    ''    0;36/480;640 (480x604)    [hidden]
0x55889c2a: 74    0x7c074d40    0x1a2de4a6    ('services.exe')    'Worker'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 75    0x7c0744b0    0x1a2de4a6    ('services.exe')    'WinCENotify'    'WinCENotify'    0;36/480;640 (480x604)    [hidden]
0x55889c2a: 76    0x7c074100    0x3c8a25d2    ('device.exe')    'SinkWiredNetUI'    ''    -10;-10/-5;-5 (5x5)    [hidden]
0x55889c2a: 77    0x7c079e80    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 78    0x7c079c90    0xd9528c2a    ('cprog.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 79    0x7c079b80    0xd9528c2a    ('cprog.exe')    'MSClog'    'Phone '    0;36/480;572 (480x536)    [hidden]
0x55889c2a: 80    0x7c07b5a0    0x98ffa152    ('poutlook.exe')    'MSPOutlook'    ''    100000;0/100000;0 (0x0)    [visible]
0x55889c2a: 81    0x7c07f980    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 82    0x7c07f790    0xd9528c2a    ('cprog.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 83    0x7c07f6a0    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 84    0x7c07e4a0    0xd9528c2a    ('cprog.exe')    'Dialog'    'Phone '    0;36/480;572 (480x536)    [hidden]
0x55889c2a: 85    0x7c081b60    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 86    0x7c081970    0xd9528c2a    ('cprog.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 87    0x7c07fce0    0xd9528c2a    ('cprog.exe')    'Dialog'    'Phone '    0;36/480;572 (480x536)    [hidden]
0x55889c2a: 88    0x7c083c90    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 89    0x7c083aa0    0xd9528c2a    ('cprog.exe')    'menu_worker'    ''    0;572/480;640 (480x68)    [visible]
0x55889c2a: 90    0x7c082f40    0xd9528c2a    ('cprog.exe')    'tooltips_class32'    ''    0;0/0;0 (0x0)    [hidden]
0x55889c2a: 91    0x7c082120    0xd9528c2a    ('cprog.exe')    'Dialog'    'Phone '    0;36/480;572 (480x536)    [hidden]</pre>
<p>Download Visual Studio 2008 sources (Mobile 5 SDK, C/C++):<br />
<a href="http://www.hjgode.de/wp/wp-content/uploads/2013/03/showFullScreen_v1.zip">showFullScreen_v1</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes%2F&amp;title=Mobile+Development%3A+showFullScreen%2C+a+tool+to+change+foreign+windows+attributes" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes%2F&amp;title=Mobile+Development%3A+showFullScreen%2C+a+tool+to+change+foreign+windows+attributes" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes%2F&amp;title=Mobile+Development%3A+showFullScreen%2C+a+tool+to+change+foreign+windows+attributes" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes%2F&amp;T=Mobile+Development%3A+showFullScreen%2C+a+tool+to+change+foreign+windows+attributes" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes%2F&amp;t=Mobile+Development%3A+showFullScreen%2C+a+tool+to+change+foreign+windows+attributes" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/03/07/mobile-development-showfullscreen-a-tool-to-change-foreign-windows-attributes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mobile Development: rdesktop-ce is now Win2008 R2 compatible</title>
		<link>http://www.hjgode.de/wp/2013/03/07/mobile-development-rdesktop-ce-is-now-win2008-r2-compatible/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-rdesktop-ce-is-now-win2008-r2-compatible</link>
		<comments>http://www.hjgode.de/wp/2013/03/07/mobile-development-rdesktop-ce-is-now-win2008-r2-compatible/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 05:25:11 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[function keys]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[terminal service client]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1729</guid>
		<description><![CDATA[Just a short note: rdesktop-ce is now RDP5 capable and can connect to Win2008 R2 Terminal Services. With the help of bradh I now have a Windows CE fork of rdesktop that does not show modulo 0&#215;108 error any more when run against windows 2008 R2 server. Bookmark It]]></description>
				<content:encoded><![CDATA[<p>Just a short note: <a href="http://www.hjgode.de/wp/2010/11/20/mobile-development-a-native-remote-desktop-client-rdesktop-port-win32/">rdesktop-ce</a> is now RDP5 capable and can connect to Win2008 R2 Terminal Services.</p>
<p>With the help of bradh I now have a Windows CE fork of rdesktop that does not show modulo 0&#215;108 error any more when run against windows 2008 R2 server.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-rdesktop-ce-is-now-win2008-r2-compatible%2F&amp;title=Mobile+Development%3A+rdesktop-ce+is+now+Win2008+R2+compatible" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-rdesktop-ce-is-now-win2008-r2-compatible%2F&amp;title=Mobile+Development%3A+rdesktop-ce+is+now+Win2008+R2+compatible" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-rdesktop-ce-is-now-win2008-r2-compatible%2F&amp;title=Mobile+Development%3A+rdesktop-ce+is+now+Win2008+R2+compatible" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-rdesktop-ce-is-now-win2008-r2-compatible%2F&amp;T=Mobile+Development%3A+rdesktop-ce+is+now+Win2008+R2+compatible" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-rdesktop-ce-is-now-win2008-r2-compatible%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F03%2F07%2Fmobile-development-rdesktop-ce-is-now-win2008-r2-compatible%2F&amp;t=Mobile+Development%3A+rdesktop-ce+is+now+Win2008+R2+compatible" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/03/07/mobile-development-rdesktop-ce-is-now-win2008-r2-compatible/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mobile development: show a small information window using WIN32 API</title>
		<link>http://www.hjgode.de/wp/2013/02/22/mobile-development-show-a-small-information-window-using-win32-api/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mobile-development-show-a-small-information-window-using-win32-api</link>
		<comments>http://www.hjgode.de/wp/2013/02/22/mobile-development-show-a-small-information-window-using-win32-api/#comments</comments>
		<pubDate>Fri, 22 Feb 2013 14:10:34 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1724</guid>
		<description><![CDATA[ShowWin Sometimes you may need to display a small window to inform the user about what is going on. Although the scripting tools MortScript and nScript provide functions to show dialogs they can not show simple information windows. ShowWin is nothing special but a nearly full configurable window to be used from cmd line tools. [...]]]></description>
				<content:encoded><![CDATA[<h1>ShowWin</h1>
<p>Sometimes you may need to display a small window to inform the user about what is going on. Although the scripting tools MortScript and nScript provide functions to show dialogs they can not show simple information windows.</p>
<table>
<tbody>
<tr>
<td>
<p><div id="attachment_1725" class="wp-caption alignnone" style="width: 250px"><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/showwin1.gif"><img class="size-full wp-image-1725" alt="ShowWin default colors" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/showwin1.gif" width="240" height="320" /></a><p class="wp-caption-text">ShowWin default colors</p></div></td>
<td>
<p><div id="attachment_1726" class="wp-caption alignnone" style="width: 250px"><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/showwin2.gif"><img class="size-full wp-image-1726" alt="ShowWin with a progress bar" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/showwin2.gif" width="240" height="320" /></a><p class="wp-caption-text">ShowWin with a progress bar</p></div></td>
</tr>
</tbody>
</table>
<p>ShowWin is nothing special but a nearly full configurable window to be used from cmd line tools. It just uses Win32 API calls, constants and structures as FindWindow, PostMessage, SendMessage, WM_COPYDATA, COPYDATASTRUCT, GetSystemMetrics, GetDesktopWindow, GetWindowRect, CreateWindowEx, ShowWindow, UpdateWindow, INITCOMMONCONTROLSEX, GetDeviceCaps, CreateFontIndirect, GetWindowDC, ReleaseDC, PROGRESS_CLASS, InvalidateRect, BeginPaint, CreatePen, SelectObject, Rectangle, SetBkMode, DrawText, EndPaint, SetTextColor, DeleteObject, GetKeyState and PostQuitMessage.</p>
<h2>Basic WIN32 programming</h2>
<p>Possibly you never wrote a native C windows application. Come on and dive into the basics. It is always good to know the basics even if one writes DotNet or JAVA code.</p>
<h2>Supported arguments</h2>
<pre> showWin -t "Text zum Anzeigen" -r 90 -g 80 -b 70 -s 8 -w 200 -h 50 -x 0 -y 0 -rt 200 -gt 20 -bt 20 -ti 10 -progr 30 -align left

 ARGS: 
 option/parameter:                meaning:                default:            limitations:
 -t "Text zum Anzeigen"           text to show            "Installing"        255 chars, no " inside, no line breaks, no tabs
 -r 90                            background color RED    255                    0-255
 -g 80                            background color GREEN    207                    0-255
 -b 70                            background color BLUE    0                    0-255
 -s 8                             font size in points        10                    7-24 points
 -w 200                           window width pixels        460                    100-screenwidth
 -h 50                            window height pixels    40                    menu bar height (ie 26pixels)
 -x 60                            window pos X            12                    0 + system window bordersize
 -y 60                            window pos Y            48                    0 + system taskbar bar height. Using 0;0 does not work nice on WM, win may be below taskbar
 -rt 200                          text color RED            0                    0-255
 -gt 20                           text color GREEN        0                    0-255
 -bt 20                           text color BLUE            0                    0-255

 -align center                    text alignment            left                center|left|right

 -ti 10                           timeout to autoclose    0                    no autoclose, min: 1 (second), max: 3600 = one hour

 -progr 10                        show with progress val    0                    no progressbar, max: 100
                                  the progressbar is appended at bottom of textwindow
 -prval                           update progress bar value                    no default, min=1, max=100

 -kill                            kill existing window, exit app

 -m "new message text"            replace text in window                        see -t</pre>
<p><span id="more-1724"></span></p>
<h2>Argument parsing</h2>
<p>Fortunately I found some code to split arguments supplied to <em>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)</em>. But i had to adopt the class to be unicode compatible. Windows CE and Windows Mobile uses Unicode for strings.</p>
<p>You know, that the WinMain is the first function called by the OS when you start an application.</p>
<pre>int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_SHOWWIN, szWindowClass, MAX_LOADSTRING);

    HWND hwndOld=FindWindow(szWindowClass,NULL);
    // kill request?
    if(hwndOld!=NULL){
        if(wcsicmp(lpCmdLine, L"-kill")==0){
            PostMessage(hwndOld, WM_QUIT, 0, 0);
            return 11;
        }
    }

    DEBUGMSG(1, (L"CmdLine parsing #1: \r\n"));
    //command parsing
    struct cmdList *Liste;
    Liste=NULL;
    CmdLineArgs args;
    for (UINT i = 0; i &lt; args.size(); i++){
        DEBUGMSG(1, (L"%20i: '%s'\r\n", i, args[i]));
        append(&amp;Liste, args[i]);
    }
    getOptions(Liste);
    args.~CmdLineArgs();</pre>
<p>First the code uses LoadString to load the title and window class from its resources. Then FindWindow is used to look for a previous instance and checks if the only argument is -kill. If so, the previous instance is sent a quit using PostMessage and then the application exits itself.</p>
<p>Now we define a structure (<em>Liste</em>) to hold the arguments. Then we start command line parsing by creating a chained list of arguments. The list is created by using the class CmdLineArgs. We then walk thru the argument list and append each argument to our <em>Liste</em> structure. Using getOptions(Liste) we scan the list for known optional arguments and apply optional values to global variables.</p>
<pre>class CmdLineArgs : public std::vector&lt;TCHAR*&gt;
{
public:
    CmdLineArgs ()
    {
        // Save local copy of the command line string, because
        // ParseCmdLine() modifies this string while parsing it.
        TCHAR* cmdline = GetCommandLine();
        m_cmdline = new TCHAR [_tcslen (cmdline) + 1];
        if (m_cmdline)
        {
            _tcscpy (m_cmdline, cmdline);
            ParseCmdLine(); 
        }
    }
    ~CmdLineArgs()
    {
        delete []m_cmdline;
    }
...</pre>
<p>getOptions is a chain of if/else if blocks that tests for known options and applies values to global variables:</p>
<pre>void getOptions(struct cmdList *l){
    struct cmdList *liste;
    liste=l;
    if(l==NULL)
        return;
    int iVal;
    do{
        DEBUGMSG(1, (L"%s\r\n", liste-&gt;value));
        if(wcsicmp(liste-&gt;value, L"-t")==0){        // message text
            if(liste-&gt;next != NULL){
                liste=liste-&gt;next;
                wsprintf(szMessageText, L"%s", liste-&gt;value);
            }
        }
        else if(wcsicmp(liste-&gt;value, L"-m")==0){        // message text
            if(liste-&gt;next != NULL){
                liste=liste-&gt;next;
                wsprintf(szMessageTextNew, L"%s", liste-&gt;value);
            }
        }
        else if(wcsicmp(liste-&gt;value, L"-r")==0){    // rgb r value
            if(liste-&gt;next != NULL){
                liste=liste-&gt;next;
                iVal=_wtoi(liste-&gt;value);
                if(iVal!=0)
                    backcolorRed=iVal;
            }
        }
...
        liste=liste-&gt;next;
    }while(liste != NULL);
}</pre>
<h3>Inter process communication</h3>
<p>Now that we have read all arguments, we can test if we need to update the text or progress value of an existing instance:</p>
<pre>    // already running?
    if(hwndOld!=NULL){
        //check if new message text?
        if(wcslen(szMessageTextNew) &gt; 0){
            myMsg _mymsg;
            memset(&amp;_mymsg,0,sizeof(myMsg));
            wsprintf( _mymsg.szText, L"%s", szMessageTextNew );
            _mymsg.iVal=0;    //the text message identifier
            //prepare WM_COPYDATA
            COPYDATASTRUCT copyData;
            copyData.dwData=1234;
            copyData.cbData=sizeof(myMsg);
            copyData.lpData=&amp;_mymsg;
            SendMessage(hwndOld, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&amp;copyData);
        }
        if(iProgressValNew!=-1){
            myMsg _mymsg;
            memset(&amp;_mymsg,0,sizeof(myMsg));
            wsprintf( _mymsg.szText, L"%i", iProgressValNew );
            _mymsg.iVal=1;    //the progress message identifier
            //prepare WM_COPYDATA
            COPYDATASTRUCT copyData;
            copyData.dwData=1234;
            copyData.cbData=sizeof(myMsg);
            copyData.lpData=&amp;_mymsg;
            SendMessage(hwndOld, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&amp;copyData);
        }
        ShowWindow(hwndOld, SW_SHOWNORMAL);
        return -1;
    }</pre>
<p>To let the &#8216;old&#8217; window update its text or progress bar we need to use inter-process communication. The simplest one supporting custom data (text, progress value) I found was using the WM_COPYDATA message. To use that, we have to define a structure that holds our data (here myMsg is used) and then assign the filled data structure to lpData of a COPYDATASTRUCT variable. Then we send the data to the windows handle of the existing instance using SendMessage. The asynchronous PostMessage does not work, the data must be available on the sender side when the message is received by the target window. SendMessage will block until the message has been delivered and so the data can be transfered between sender and target. Finally the previous instance will be shown and the actual launched will quit (<em>return -1;</em>).</p>
<p>On the receiver side (same application but second instance) we have to decode the WM_COPYDATA message.</p>
<pre>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
...
    switch (message) 
    {
...
        case WM_COPYDATA:
            copyData=(COPYDATASTRUCT*)lParam;
            myMsg _mymsg;
            if(copyData-&gt;dwData==1234)    //that's right
            {
                memcpy(&amp;_mymsg, copyData-&gt;lpData, sizeof(myMsg));
            }
            if(_mymsg.iVal==0){        //text message
                if(wcslen(_mymsg.szText)&gt;0)
                    wcscpy(szMessageText, _mymsg.szText);
                GetClientRect(hWnd, &amp;rect);
                InvalidateRect(hWnd, &amp;rect, TRUE);
            }
            else if(_mymsg.iVal==1){        //progress message
                if(wcslen(_mymsg.szText)&gt;0)
                    wcscpy(szTemp, _mymsg.szText);
                iProgressVal=_wtoi(szTemp);
                SendMessage(hProgress, PBM_SETPOS, iProgressVal, 0);
            }
            break;</pre>
<p>The above code shows how we get the data back from the message lParam parameter. The structure myMsg knows actually two types of data: a progress value or a new text. Depending on the message type we either update the global variable <em>szMessageText</em> or <em>iProgressVal.</em> After changing the text we inform the OS that our window needs to be updated (painted again). If a new progress value has been received we just need to send the progress bar the new value using SendMessage(hProgress, PBM_SETPOS, iProgressVal, 0);.</p>
<h3>Adopt to available screen size</h3>
<p>Back to our application winMain startup code. The next code lines query the device for screen size and xxx</p>
<pre>    //client size
    int maxX = GetSystemMetrics(SM_CXSCREEN);
    int maxY = GetSystemMetrics(SM_CYSCREEN);        //640 ??
    int borderSize = GetSystemMetrics(SM_CXBORDER);
    int minSize = GetSystemMetrics(SM_CYMENU);
    RECT rectMax;
    GetWindowRect(GetDesktopWindow(), &amp;rectMax);
    if(xWidth&lt;100 || xWidth&gt;maxX)    // secure width setting
        xWidth=maxX-2*borderSize;
    if(yHeight&lt;minSize)
        yHeight=minSize+2*borderSize;

    if(xPos&lt;borderSize)    //secure x pos
        xPos=borderSize;
    if(yPos&lt;rectMax.top)    //secure y pos
        yPos=rectMax.top;

    //progressBar is attached to bottom of window
    if(bUseProgress){
        //extend window
        xProgressWidth=xWidth;
        yHeight+=yProgressHeight;
        yProgress=yHeight-yProgressHeight;

    }</pre>
<p>SM_CXSCREEN and SM_CYSCREEN let us know the width and height of the screen in pixels. As we want to limit the window creation to usual values, I also query the system value of border width (SM_CXBORDER) and the menu height (SM_CYMENU).<br />
Using GetWindowRect we query for the maximum client area of the &#8216;desktop&#8217; window. Then we adjust the given width and height value to usable values. We do the same for the x and y position of the window.</p>
<p>If a progressbar is to be used (determined by parsing the command line arguments), we need to extend the specified window at the bottom to reserve place for the bar.<br />
The remainder of winMain is standard and initializes the window and starts the message loop.</p>
<pre>    // Perform application initialization:
    if (!InitInstance(hInstance, nCmdShow)) 
    {
        return FALSE;
    }

    HACCEL hAccelTable;
    hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SHOWWIN));

    // Main message loop:
    MSG msg;
    while (GetMessage(&amp;msg, NULL, 0, 0)) 
    {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &amp;msg)) 
        {
            TranslateMessage(&amp;msg);
            DispatchMessage(&amp;msg);
        }
    }

    return (int) msg.wParam;</pre>
<p>Inside InitInstance() there is a call to myRegisterClass(). As I like to have a &#8216;backdoor&#8217; to quit the ShowWin app, I added CS_DBLCLKS. Without that style attribute the window will otherwise not get double click messages!:</p>
<pre>ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass)
{
    WNDCLASS wc;

    hBackcolor = CreateSolidBrush(RGB(backcolorRed,backcolorGreen,backcolorBlue));

    wc.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHOWWIN));
    wc.hCursor       = 0;
    wc.hbrBackground = (HBRUSH) hBackcolor;// GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName  = 0;
    wc.lpszClassName = szWindowClass;

    return RegisterClass(&amp;wc);
}</pre>
<p>In InitInstance we apply some special wishes for the window z-order: WS_EX_ABOVESTARTUP and WS_EX_TOPMOST. The code also does not use window defaults for size and position as these would result in a maximized window but we want to show only a small window.</p>
<pre>    hWnd = CreateWindowEx( 
        WS_EX_TOPMOST | WS_EX_ABOVESTARTUP,    //exStyle
        szWindowClass,    //wndClass
        NULL, //L"Installer",    //title
        WS_VISIBLE, //dwStyle
        xPos,    // CW_USEDEFAULT,  //x
        yPos,    //CW_USEDEFAULT,  //y    
        xWidth,  //CW_USEDEFAULT,  //width
        yHeight, //CW_USEDEFAULT,  //height
        NULL,    //hParent
        NULL,    //hMenu
        hInstance,
        NULL
        );</pre>
<p>After all this stuff the window class is registered and the window will be created using our settings. Now the magic starts and the windows message proc is called by the message loop. The first message we will see is WM_CREATE.</p>
<pre>        case WM_CREATE:
            //do font calculation
            hdc=GetWindowDC(hWnd);
            iDevCap=GetDeviceCaps(hdc, LOGPIXELSY);    //pixels per inch
            lfHeight = -((long)fontHeight * (long)iDevCap) / 72L;
            GetObject (GetStockObject (SYSTEM_FONT), sizeof (LOGFONT), (PTSTR) &amp;logfont) ;
            //    HFONT hf = CreateFontIndirect(&amp;logfont);
            logfont.lfHeight=lfHeight;
            hFont=CreateFontIndirect(&amp;logfont);
            ReleaseDC(NULL,hdc);

            DEBUGMSG(1, (L"Create hWnd=%i\r\n", hWnd));
            if(iTimeOut&gt;0)
                startThread(hWnd);

            if(bUseProgress){
                //progressBar
                hProgress = CreateWindowEx(0, PROGRESS_CLASS, NULL,
                                WS_CHILD | WS_VISIBLE,
                                xProgress, yProgress, xProgressWidth, yProgressHeight,
                                hWnd, NULL, g_hInst, NULL);
                SendMessage(hProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
                SendMessage(hProgress, PBM_SETPOS, iProgressVal, 0);
            }
            break;</pre>
<p>The above tries to calculate the right size for a LOGFONT structure for the text drwan in the window. We need to know the number of pixels per inch of the screen &#8211; the dots-per-inch resolution. The font size argument you can use on the command line is to be given in points. A point is a 1/72 of an inch (or given at 72 dpi). We calculate the logical font height by relating the screen dpi and the font size dpi. Then the code gets the LOGFONT structure of the system font and applies the new logical font size. Finally the global variable hFont is initialized with the logfont structure.</p>
<p>If an optional timeout value was supplied via the cmd line, the line startThread() will be executed. That starts a background thread that will post a quit message to the message loop when the timeout value is reached:</p>
<pre>DWORD myThread(LPVOID lpParam){
    BOOL bExit=FALSE;
    HWND hwndMain=(HWND)lpParam;
    DWORD dwWaitResult=0;
    int iCountSeconds=0;
    DEBUGMSG(1, (L"myThread hWndMain=%i\r\n", hwndMain));
    do{
        dwWaitResult = WaitForSingleObject(hStopThread, 1000);
        switch(dwWaitResult){
            case WAIT_OBJECT_0:
                bExit=TRUE;
                break;
            case WAIT_TIMEOUT:
                iCountSeconds++;
                if(iCountSeconds&gt;=iTimeOut)
                {
                    PostMessage(hwndMain, WM_QUIT, 99, iTimeOut);
                    bExit=TRUE;
                }
                break;
        }
    }while(!bExit);
    return 0;
}</pre>
<p>I am using WaitForSingleObject() here to be able to stop the thread by setting a named event.</p>
<p>Back in WM_CREATE the last lines are to create a progressBar, if the optional argument for a progress bar was used.</p>
<p>The next message of importance is WM_PAINT. All drawing of the window is done within the WM_PAINT handler.</p>
<pre>        case WM_PAINT:
            hdc = BeginPaint(hWnd, &amp;ps);

            // TODO: Add any drawing code here...
            GetClientRect(hWnd, &amp;rect);
            //shrink text area if progressbar is there
            if(bUseProgress &amp;&amp; hProgress!=NULL){
                rect.bottom-=yProgressHeight;
            }</pre>
<p>the above resized the drawing rectangle for text if a progress bar is used.</p>
<p>Next we draw some black rectangles to give the window a simple drop shadow effect.</p>
<pre>            //draw rectangle
            myPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
            oldPen = (HPEN)SelectObject(hdc,myPen);
            SelectObject(hdc, hBackcolor);
            Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
            //shrinkRect(&amp;rect, 1);
            //Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
            //a drop shadow
            rect.right-=1;rect.bottom-=1;
            Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
            rect.right-=1;rect.bottom-=1;
            Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
            SelectObject(hdc, oldPen);</pre>
<p>Then we set the background mode to transparent and draw the text and finally restore font and text color.</p>
<pre>            SetBkMode(hdc, TRANSPARENT);
            oldTextColor = SetTextColor(hdc, RGB(fontColorRed, fontColorGreen, fontColorBlue));
            hfOld=(HFONT)SelectObject(hdc, hFont);
            DrawText(hdc, 
                szMessageText,    //text to draw
                -1,                //length of text
                &amp;rect, 
                dwTextalign | DT_END_ELLIPSIS | DT_EXTERNALLEADING | DT_VCENTER // | DT_SINGLELINE        //text formatting
                );

            EndPaint(hWnd, &amp;ps);
            SelectObject(hdc, hfOld);
            SetTextColor(hdc, oldTextColor);

            DeleteObject(hFont);
            break;</pre>
<h3>the backdoor to quit</h3>
<p>You can quit ShowWin by calling it with &#8216;-kill&#8217;. You can also end ShowWin by double clicking inside the window with the CAPS Lock key being toggled:</p>
<pre>        case WM_LBUTTONDBLCLK:
            vkShift=GetKeyState(VK_CAPITAL);
            if( (vkShift &amp; 0x80) == 0x80 || (vkShift &amp; 0x01) == 0x01 ){
                if(MessageBox(hWnd, L"Exit?", L"showWin", MB_OKCANCEL)==IDOK)
                    DestroyWindow(hWnd);
            }
            break;</pre>
<p>MessageBox shows a verification dialog and DestroyWindow exits the application.</p>
<h3>The End</h3>
<p>As we are running a background thread it is a good idea to stop the thread before the application ends. The below code shows the SetEvent call that releases the background thread&#8217;s WaitForSingleObject() call.</p>
<pre>void stopThread(){
    if(hStopThread==NULL)
        SetEvent(hStopThread);
}
.......
        case WM_DESTROY:
            stopThread();
            PostQuitMessage(0);
            break;
...</pre>
<h2>Source code download</h2>
<p>Full source code available at <a href="https://github.com/hjgode/showwin" target="_blank">GitHub</a>.</p>
<p>&nbsp;</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F22%2Fmobile-development-show-a-small-information-window-using-win32-api%2F&amp;title=Mobile+development%3A+show+a+small+information+window+using+WIN32+API" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F22%2Fmobile-development-show-a-small-information-window-using-win32-api%2F&amp;title=Mobile+development%3A+show+a+small+information+window+using+WIN32+API" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F22%2Fmobile-development-show-a-small-information-window-using-win32-api%2F&amp;title=Mobile+development%3A+show+a+small+information+window+using+WIN32+API" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F22%2Fmobile-development-show-a-small-information-window-using-win32-api%2F&amp;T=Mobile+development%3A+show+a+small+information+window+using+WIN32+API" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F22%2Fmobile-development-show-a-small-information-window-using-win32-api%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F22%2Fmobile-development-show-a-small-information-window-using-win32-api%2F&amp;t=Mobile+development%3A+show+a+small+information+window+using+WIN32+API" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/02/22/mobile-development-show-a-small-information-window-using-win32-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Mobile: watch the memory footstep of running processes</title>
		<link>http://www.hjgode.de/wp/2013/02/21/windows-mobile-watch-the-memory-footstep-of-running-processes/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-mobile-watch-the-memory-footstep-of-running-processes</link>
		<comments>http://www.hjgode.de/wp/2013/02/21/windows-mobile-watch-the-memory-footstep-of-running-processes/#comments</comments>
		<pubDate>Thu, 21 Feb 2013 15:37:33 +0000</pubDate>
		<dc:creator>josef</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[IOCTL_KLIB_GETPROCMEMINFO]]></category>
		<category><![CDATA[UDP]]></category>
		<category><![CDATA[virtual memory]]></category>
		<category><![CDATA[VirtualQuery]]></category>
		<category><![CDATA[vmUsage]]></category>
		<category><![CDATA[windows mobile]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1706</guid>
		<description><![CDATA[Some times ago I posted my remote cpu usage monitor. Now here is a similar tool but for logging the memory. You can now watch the memory usage of processes remotely for example when you test an application. There are two tools: vmUsage and vmUsageRecvr. You may use the mobile vmUsage alone and just use [...]]]></description>
				<content:encoded><![CDATA[<p>Some times ago I posted my remote <a href="http://www.hjgode.de/wp/2012/12/14/mobile-development-a-remote-cpu-monitor-and-cpu-usage-analysis/">cpu usage monitor</a>. Now here is a similar tool but for logging the memory. You can now watch the memory usage of processes remotely for example when you test an application.</p>
<p>There are two tools: vmUsage and vmUsageRecvr. You may use the mobile vmUsage alone and just use its logging. The other tool receives the memory status information on a PC and enables long time logging and export to a csv text.</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/vmusage.gif"><img class="alignnone size-full wp-image-1715" alt="vmusage" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/vmusage.gif" width="240" height="320" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/memeater-vm.gif"><img class="alignnone size-medium wp-image-1711" alt="memeater-vm" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/memeater-vm-300x253.gif" width="379" height="319" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/excel-linechart.gif"><img class="alignnone size-medium wp-image-1707" alt="excel-linechart" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/excel-linechart-300x275.gif" width="348" height="318" /></a></p>
<p><span id="more-1706"></span></p>
<p>vmUsage is the mobile application that shows you a list of bars, one bar for each of the 32 possible process slots. It also shows the process name running in a slot and the memory usage. The memory usage is queried using a KernelIOCtl (IOCTL_KLIB_GETPROCMEMINFO). I found that API call at <a href="http://www.codeproject.com/Tips/123149/How-to-get-individual-process-memory-usage-statist" target="_blank">CodeProject</a>. I first tried with the approach made in <a href="http://www.codeproject.com/Articles/32297/Visualizing-the-Windows-Mobile-Virtual-Memory-Mons" target="_blank">VirtualMemory </a>at codeproject. But using VirtualQuery for every 4K block inside 32 pieces of 32MB takes a lot of time (256000 blocks!). The following shows a process memEater that is gaining more and more memory:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/memeater-vmusage.gif"><img class="alignnone size-medium wp-image-1712" alt="memeater-vmusage" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/memeater-vmusage-225x300.gif" width="225" height="300" /></a>   <a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/memeater-vmusage2.gif"><img class="alignnone size-medium wp-image-1713" alt="memeater-vmusage2" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/memeater-vmusage2-225x300.gif" width="225" height="300" /></a></p>
<p>You can also see the total physical and available memory in the first bar and you will recognize irregular memory changes too.</p>
<p>The small tool sends all data using UDP to possible receivers. My receiver is called vmUsageRecvr and receives the data and saves every virtual memory status set it to a SQLite database. The data can then be exported and is re-arranged by known processes. The live view of vmUsageRecvr shows the latest receive memory status and a small line graphic showing how the total used memory changed over time.</p>
<p>You can use the exported data in excel and again produce nice graphics.</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/excel-vmusage.gif"><img class="alignnone size-large wp-image-1708" alt="excel-vmusage" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/excel-vmusage-1024x632.gif" width="838" height="517" /></a></p>
<p>In the above graph you can see memeater is consuming memory in 1MB steps until it crashes. The other memory peek is produced by pimg.exe, the camera dialog, when I made a photo.</p>
<p>Processes may start and go and so there process ID will be zero when they are not running. If a process is gone, vmUsage will not record it in its log:</p>
<pre>20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    15175680    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    323395584    vtotal    33554432tvfree    26476544    load    35    
20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    16228352    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    322342912    vtotal    33554432tvfree    26476544    load    35    
20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    17281024    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    322342912    vtotal    33554432tvfree    26476544    load    35    
20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    17281024    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    321282048    vtotal    33554432tvfree    26476544    load    35    
20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    18337792    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    320163840    vtotal    33554432tvfree    26476544    load    36    
20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    19456000    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    320163840    vtotal    33554432tvfree    26476544    load    36    
20130221 06:17 pimg    569344    VMusage.exe    2105344    MemEater.exe    19456000    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    319111168    vtotal    33554432tvfree    26476544    load    36    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    20508672    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    318054400    vtotal    33554432tvfree    26476544    load    36    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    21561344    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    317001728    vtotal    33554432tvfree    26476544    load    36    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    22614016    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    317001728    vtotal    33554432tvfree    26476544    load    36    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    22614016    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    315949056    vtotal    33554432tvfree    26476544    load    37    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    23666688    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    314896384    vtotal    33554432tvfree    26476544    load    37    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    24719360    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    314896384    vtotal    33554432tvfree    26476544    load    37    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    24719360    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    313843712    vtotal    33554432tvfree    26476544    load    37    
20130221 06:17 pimg    569344    VMusage.exe    2109440    MemEater.exe    25772032    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    314822656    vtotal    33554432tvfree    27459584    load    37    
20130221 06:18 pimg    569344    VMusage.exe    1191936    MemEater.exe    25772032    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    340561920    vtotal    33554432tvfree    27328512    load    32    
20130221 06:18 pimg    569344    VMusage.exe    1323008    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    340430848    vtotal    33554432tvfree    27197440    load    32    
20130221 06:18 pimg    569344    VMusage.exe    1388544    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    340365312    vtotal    33554432tvfree    27131904    load    32    
20130221 06:18 pimg    569344    VMusage.exe    1519616    tmail.exe    303104    IQueue.exe    679936    total    493723648    free    340234240    vtotal    33554432tvfree    27000832    load    32</pre>
<p>&nbsp;</p>
<p>When a process is gone in vmUsageRecr, the process data is still there. In the following export viewed in excel you can see pimg is first not running. After pimg is started it consumes about 368KB. Then I took a photo and the memory increased to 1.1MB:</p>
<p><a href="http://www.hjgode.de/wp/wp-content/uploads/2013/02/excel_process_0.gif"><img class="alignnone size-full wp-image-1717" alt="excel_process_0" src="http://www.hjgode.de/wp/wp-content/uploads/2013/02/excel_process_0.gif" width="343" height="380" /></a></p>
<h2>Notes about the code</h2>
<p>As said, the code is similar to my cpuMon tool.</p>
<h3>A costum panel to simulate a bar graph</h3>
<p>vmUsage uses a large panel and places 32 smaller custom panels inside to display a bar graphic. The custom panel&#8217;s background is just green and I draw a rectangle on top to visualize the current value. Alternatively I could have used 32  progress bars but I liked to also have text inside the graphic. Here is the OnPaint override code:</p>
<pre>        protected override void OnPaint(PaintEventArgs e)
        {
            //draw the background rectangle
            e.Graphics.FillRectangle(new SolidBrush(BackColor), 0, 0, (int)((float)(this.Width / _Maximum) * _Maximum), this.Height);
            //draw foreground rectangle
            if (scaleMode == scaleModeValue.relative)
            {
                e.Graphics.FillRectangle(new SolidBrush(ForeColor), 0, 0, (int)((float)(this.Width / _Maximum) * @Value), this.Height);
            }
            else
            {
                e.Graphics.FillRectangle(new SolidBrush(ForeColor), 0, 0, (int)@Value, this.Height);
            }
            //draw text
            if (Text.Length &gt; 0)
            {
                StringFormat sf = new StringFormat();
                sf.Alignment=StringAlignment.Center;
                RectangleF rect = new RectangleF(0f, 0f, this.Width, this.Height);
                e.Graphics.DrawString(Text, base.Font, new SolidBrush(Color.Black), rect, sf);
            }
            base.OnPaint(e);
        }</pre>
<p>When vmUsage is started it starts a background thread that captures the current memory usage data:</p>
<pre>            //start the background tasks
            vmiThread = new vmInfoThread();
            vmiThread._iTimeOut = iTimeout*1000;
            vmiThread.updateEvent += new vmInfoThread.updateEventHandler(vmiThread_updateEvent);</pre>
<p>In the background thread I am using two events and a queue to sync foreground and background working:</p>
<pre>        public vmInfoThread()
        {
            _fileLogger = new Logging.fileLogger(Logging.utils.appPath + "vmusage.log.txt");

            eventEnableCapture = new AutoResetEvent(true);
            eventEnableSend = new AutoResetEvent(false);

            //procStatsQueue = new Queue&lt;ProcessStatistics.process_statistics&gt;();
            procStatsQueueBytes = new Queue&lt;byte[]&gt;();

            myThreadSocket = new Thread(socketThread);
            myThreadSocket.Start();

            myThread = new Thread(usageThread);
            myThread.Start();
        }</pre>
<p>The queue is used to decouple the data capture and the data send functions. One thread captures the data into a queue and then releases the socket thread which reads the queued data and releases the data capture thread:</p>
<pre>        /// &lt;summary&gt;
        /// build thread and process list periodically and fire update event and enqueue results for the socket thread
        /// &lt;/summary&gt;
        void usageThread()
        {
            try
            {
                int interval = 3000;
                //rebuild a new mem usage info
                VMusage.CeGetProcVMusage vmInfo = new CeGetProcVMusage();

                while (!bStopMainThread)
                {
                    eventEnableCapture.WaitOne();
                    List&lt;VMusage.procVMinfo&gt; myList = vmInfo._procVMinfo; //get a list of processes and the VM usage
                    StringBuilder sbLogInfo = new StringBuilder();  //needed to merge infos for log

                    System.Threading.Thread.Sleep(interval);
                    uint _totalMemUse = 0;
                    long lTimeStamp = DateTime.Now.ToFileTimeUtc();

                    //send all data in one block
                    List&lt;byte&gt; buffer = new List&lt;byte&gt;();
                    buffer.AddRange(ByteHelper.LargePacketBytes);
                    foreach (VMusage.procVMinfo pvmi in myList)
                    {
                        pvmi.Time = lTimeStamp;
                        buffer.AddRange(pvmi.toByte());

                        _totalMemUse += pvmi.memusage;

                        if (!pvmi.name.StartsWith("Slot", StringComparison.InvariantCultureIgnoreCase))
                        {
                            //_fileLogger.addLog(pvmi.ToString());    //adds one row for each VM info
                            sbLogInfo.Append(pvmi.name + "\t" + pvmi.memusage.ToString() + "\t");
                        }
                    }                    
                    procStatsQueueBytes.Enqueue(buffer.ToArray());

                    onUpdateHandler(new procVMinfoEventArgs(myList, _totalMemUse));

                    //send MemoryStatusInfo
                    memorystatus.MemoryInfo.MEMORYSTATUS mstat = new memorystatus.MemoryInfo.MEMORYSTATUS();
                    if (memorystatus.MemoryInfo.GetMemoryStatus(ref mstat))
                    {
                        MemoryInfoHelper memoryInfoStat= new MemoryInfoHelper(mstat);

                        //send header
                        procStatsQueueBytes.Enqueue(ByteHelper.meminfostatusBytes);
                        //send data
                        procStatsQueueBytes.Enqueue(memoryInfoStat.toByte());

                        //log global memstatus
                        sbLogInfo.Append(
                            "total\t" + memoryInfoStat.totalPhysical.ToString() +
                            "\tfree\t" + memoryInfoStat.availPhysical.ToString() +
                            "\tvtotal\t" + memoryInfoStat.totalVirtual.ToString() +
                            "tvfree\t" + memoryInfoStat.availVirtual.ToString() +
                            "\tload\t" + memoryInfoStat.memoryLoad + "\t");
                    }

                    //write a log line
                    _fileLogger.addLog(sbLogInfo.ToString()+"\r\n");
                    procStatsQueueBytes.Enqueue(ByteHelper.endOfTransferBytes);
                    ((AutoResetEvent)eventEnableSend).Set();
                }//while true
            }
            catch (ThreadAbortException ex)
            {
                System.Diagnostics.Debug.WriteLine("ThreadAbortException: usageThread(): " + ex.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception: usageThread(): " + ex.Message);
            }
            System.Diagnostics.Debug.WriteLine("Thread ENDED");
        }</pre>
<p>The call eventEnableCapture.WaitOne(); waits until the event is set by the socket thread. Immediately after this call a new memory usage dataset is loaded. The rest of the code converts the data to bytes and adds the byte buffer to a queue. Then another event is set to release the socketThread.</p>
<pre>        /// &lt;summary&gt;
        /// send enqueued objects via UDP broadcast
        /// &lt;/summary&gt;
        void socketThread()
        {
            System.Diagnostics.Debug.WriteLine("Entering socketThread ...");
            try
            {
                const int ProtocolPort = 3002;
                sendSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                sendSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
                sendSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 32768);

                IPAddress sendTo = IPAddress.Broadcast;// IPAddress.Parse("192.168.128.255");  //local broadcast
                EndPoint sendEndPoint = new IPEndPoint(sendTo, ProtocolPort);

                //UdpClient udpC = new UdpClient("255.255.255.255", 1111);
                System.Diagnostics.Debug.WriteLine("Socket ready to send");

                while (!bStopSocketThread)
                {
                    //block until released by capture
                    eventEnableSend.WaitOne();
                    lock (lockQueue)
                    {
                        //if (procStatsQueue.Count &gt; 0)
                        while (procStatsQueueBytes.Count &gt; 0)
                        {
                            byte[] buf = procStatsQueueBytes.Dequeue();
                            if (ByteHelper.isEndOfTransfer(buf))
                                System.Diagnostics.Debug.WriteLine("sending &lt;EOT&gt;");

                            sendSocket.SendTo(buf, buf.Length, SocketFlags.None, sendEndPoint);
                            System.Diagnostics.Debug.WriteLine("Socket send " + buf.Length.ToString() + " bytes");
                            System.Threading.Thread.Sleep(2);
                        }
                    }
                    ((AutoResetEvent)eventEnableCapture).Set();
                }

            }
            catch (ThreadAbortException ex)
            {
                System.Diagnostics.Debug.WriteLine("ThreadAbortException: socketThread(): " + ex.Message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception: socketThread(): " + ex.Message);
            }
            System.Diagnostics.Debug.WriteLine("socketThread ENDED");
        }</pre>
<p>The first call after eventEnableSend.WaitOne(); inside the socket thread locks the queue, so no other code is able to access it. This is not necessary here as we sync the access using the events but I left the lock to show an alternative for async queue access. The rest of the code inside socket thread just sends the bytes of the queue using UDP.</p>
<h3>Minor protocol between sender and receiver</h3>
<p>During the development of the code I found it better to send a large block of bytes instead of small packets sending each memory info separately. After some time I added some special packets to mark the end-of-transfer. These are usefull to let the receiver know about which packets will come. So I added a memoryStatusInfo packet that informs the receiver when a memory status packet is attached in contrast to the virtual memory information block.</p>
<pre>    void MessageReceivedCallback(IAsyncResult result)
    {
        EndPoint remoteEndPoint = new IPEndPoint(0, 0);
        try
        {
            //all data should fit in one package!
            int bytesRead = receiveSocket.EndReceiveFrom(result, ref remoteEndPoint);
            //System.Diagnostics.Debug.WriteLine("Remote IP: " + ((IPEndPoint)(remoteEndPoint)).Address.ToString());

            byte[] bData = new byte[bytesRead];
            Array.Copy(recBuffer, bData, bytesRead);
            if (ByteHelper.isEndOfTransfer(bData))
            {
                System.Diagnostics.Debug.WriteLine("isEndOfTransfer");
                updateEndOfTransfer();// end of transfer
            }
            else if (ByteHelper.isMemInfoPacket(bData))
            {
                System.Diagnostics.Debug.WriteLine("isMemInfoPacket");
                try
                {
                    VMusage.MemoryInfoHelper mstat = new VMusage.MemoryInfoHelper();
                    mstat.fromByte(bData);

                    //System.Diagnostics.Debug.WriteLine(mstat.ToString());

                    updateMem(mstat);
                }
                catch (Exception) { }
            }
            else if(ByteHelper.isLargePacket(bData)){
                System.Diagnostics.Debug.WriteLine("isLargePacket");
                try
                {
                    List&lt;procVMinfo&gt; lStats = new List&lt;procVMinfo&gt;();
                    VMusage.procVMinfo stats = new VMusage.procVMinfo();
                    lStats = stats.getprocVmList(bData, ((IPEndPoint)(remoteEndPoint)).Address.ToString());
                    updateStatusBulk(lStats);
                    //foreach (procVMinfo pvmi in lStats)
                    //{
                    //    pvmi.remoteIP = ((IPEndPoint)(remoteEndPoint)).Address.ToString();
                    //    //System.Diagnostics.Debug.WriteLine( stats.dumpStatistics() );
                    //}
                }
                catch (Exception) { }

            }
            else
            {
                System.Diagnostics.Debug.WriteLine("trying vmUsagePacket...");
                try
                {
                    VMusage.procVMinfo stats = new VMusage.procVMinfo(bData);
                    stats.remoteIP = ((IPEndPoint)(remoteEndPoint)).Address.ToString();
                    //System.Diagnostics.Debug.WriteLine( stats.dumpStatistics() );
                    if (stats.Time == 0)
                        stats.Time = DateTime.Now.ToFileTimeUtc();
                    updateStatus(stats);
                }
                catch (Exception) { }
            }
        }
        catch (SocketException e)
        ...</pre>
<p>In the above vmUsage Recvr code you can see the different branches for different packet types: EndOfTransfer, MemInfoPacket and isLargePacket.</p>
<h3>Network only knows bytes</h3>
<p>Using TCP/IP you can only transfer bytes and so my memory info classes all contain code to convert from to bytes &#8211; a basic serialization and de-serialization. The class files are shared between the Windows Mobile vmUsage and the Windows vmUsageRecvr code. Following is an example of the VMInfo class.</p>
<pre>    /// &lt;summary&gt;
    /// holds the VM data of one process
    /// &lt;/summary&gt;
    public class procVMinfo
    {
        public string remoteIP;
        public string name;
        public UInt32 memusage;
        public byte slot;
        public UInt32 procID;
        public long Time;
...
        public byte[] toByte()
        {
            List&lt;byte&gt; buf = new List&lt;byte&gt;();
            //slot
            buf.AddRange(BitConverter.GetBytes((Int16)slot));
            //memusage
            buf.AddRange(BitConverter.GetBytes((UInt32)memusage));
            //name length
            Int16 len = (Int16)name.Length;
            buf.AddRange(BitConverter.GetBytes(len));
            //name string
            buf.AddRange(Encoding.UTF8.GetBytes(name));
            //procID
            buf.AddRange(BitConverter.GetBytes((UInt32)procID));
            //timestamp
            buf.AddRange(BitConverter.GetBytes((UInt64)Time));

            return buf.ToArray();
        }
        public procVMinfo fromBytes(byte[] buf)
        {
            int offset = 0;

            //is magic packet?
            if (ByteHelper.isLargePacket(buf))
                offset += sizeof(UInt64);   //cut first bytes

            //read slot
            this.slot = (byte)BitConverter.ToInt16(buf, offset);
            offset += sizeof(System.Int16);

            UInt32 _memuse = BitConverter.ToUInt32(buf, offset);
            memusage = _memuse;
            offset += sizeof(System.UInt32);

            Int16 bLen = BitConverter.ToInt16(buf, offset);
            offset += sizeof(System.Int16);
            if (bLen &gt; 0)
            {
                this.name = System.Text.Encoding.UTF8.GetString(buf, offset, bLen);
            }
            offset += bLen;
            this.procID = BitConverter.ToUInt32(buf, offset);

            offset += sizeof(System.UInt32);
            this.Time = (long) BitConverter.ToUInt64(buf, offset);

            return this;
        }</pre>
<p>You see a lot of BitConverter calls. The fromByte function needs to keep track of the offset for reading following data.</p>
<h3>vmUsageRecvr</h3>
<p>The code uses also a queue to transfer data between background thread (RecvBroadcast) and the GUI.</p>
<pre>        public frmMain()
        {
            InitializeComponent();
            //the plot graph
            c2DPushGraph1.AutoAdjustPeek = true;
            c2DPushGraph1.MaxLabel = "32";
            c2DPushGraph1.MaxPeekMagnitude = 32;
            c2DPushGraph1.MinPeekMagnitude = 0;
            c2DPushGraph1.MinLabel = "0";

            dataQueue = new Queue&lt;VMusage.procVMinfo&gt;();

            dataAccess = new DataAccess(this.dataGridView1, ref dataQueue);

            recvr = new RecvBroadcst();
            recvr.onUpdate += new RecvBroadcst.delegateUpdate(recvr_onUpdate);
            recvr.onUpdateBulk += new RecvBroadcst.delegateUpdateBulk(recvr_onUpdateBulk);
            recvr.onEndOfTransfer += new RecvBroadcst.delegateEndOfTransfer(recvr_onEndOfTransfer);

            recvr.onUpdateMem += new RecvBroadcst.delegateUpdateMem(recvr_onUpdateMem);
        }</pre>
<p>As we have different packet types for global memory status, single and bulk virtual memory data, I implemented multiple delegates. One handler of is the bulk updater. It gets its data via the custom event arg which is a list of all virtual memory dat for all &#8216;slots&#8217;:</p>
<pre>        void recvr_onUpdateBulk(object sender, List&lt;VMusage.procVMinfo&gt; data)
        {
            foreach (VMusage.procVMinfo pvmi in data)
                addData(pvmi);
        }</pre>
<p>The data is then feed into the GUI using the addData call:</p>
<pre>        delegate void addDataCallback(VMusage.procVMinfo vmdata);
        void addData(VMusage.procVMinfo vmdata)
        {
            if (this.dataGridView1.InvokeRequired)
            {
                addDataCallback d = new addDataCallback(addData);
                this.Invoke(d, new object[] { vmdata });
            }
            else
            {
                dataGridView1.SuspendLayout();
                //enqueue data to be saved to sqlite
                dataQueue.Enqueue(vmdata);

                if (bAllowGUIupdate)
                {
                    dataAccess.addData(vmdata);
                    //release queue data
                    dataAccess.waitHandle.Set();
                }
                dataGridView1.Refresh();
                dataGridView1.ResumeLayout();
            }
        }</pre>
<p>You see we have to prepare for cross event calling. Then we suspend the refreshing of the datagrid. The sql data is updated using a queue to decouple the GUI and SQL data saving. dataAccess.addData adds the data to the dataset that is bound to the datagrid.</p>
<p>There is lot more of code inside, just take a look if you like.</p>
<h2>Questions?</h2>
<p>Leave me a comment if you have any questions.</p>
<h2>Source Code</h2>
<p>Source code can be loaded from <a href="https://github.com/hjgode/VMusage" target="_blank">github</a></p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F21%2Fwindows-mobile-watch-the-memory-footstep-of-running-processes%2F&amp;title=Windows+Mobile%3A+watch+the+memory+footstep+of+running+processes" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F21%2Fwindows-mobile-watch-the-memory-footstep-of-running-processes%2F&amp;title=Windows+Mobile%3A+watch+the+memory+footstep+of+running+processes" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F21%2Fwindows-mobile-watch-the-memory-footstep-of-running-processes%2F&amp;title=Windows+Mobile%3A+watch+the+memory+footstep+of+running+processes" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F21%2Fwindows-mobile-watch-the-memory-footstep-of-running-processes%2F&amp;T=Windows+Mobile%3A+watch+the+memory+footstep+of+running+processes" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F21%2Fwindows-mobile-watch-the-memory-footstep-of-running-processes%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F02%2F21%2Fwindows-mobile-watch-the-memory-footstep-of-running-processes%2F&amp;t=Windows+Mobile%3A+watch+the+memory+footstep+of+running+processes" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/02/21/windows-mobile-watch-the-memory-footstep-of-running-processes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Explorer Mobile &#8211; QVGA web site do not scale well to VGA screen</title>
		<link>http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen</link>
		<comments>http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 10:00:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CodeProject]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[IEM]]></category>
		<category><![CDATA[Internet Explorer Mobile]]></category>
		<category><![CDATA[ITS mobile]]></category>
		<category><![CDATA[SAP]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1692</guid>
		<description><![CDATA[As described in this post, I was looking for a way to get a proper view of pages designed for QVGA screens on devices with higher resolutions like VGA. The trick is to use the non-standard viewport META tag. As described here, here and here, you can use meta-viewport to define the initial viewport, the [...]]]></description>
				<content:encoded><![CDATA[<p>As described in this <a href="http://www.hjgode.de/wp/2013/01/21/internet-explorer-mobile-to-zoom-or-not-to-zoom/">post</a>, I was looking for a way to get a proper view of pages designed for QVGA screens on devices with higher resolutions like VGA.</p>
<table>
<tbody>
<tr>
<td>
<p><div id="attachment_1693" class="wp-caption alignnone" style="width: 250px"><a href="http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/sap_no_viewport/" rel="attachment wp-att-1693"><img class="size-full wp-image-1693" alt="1) SAP ITS mobile screen on VGA Internet Explorer Mobile" src="http://www.hjgode.de/wp/wp-content/uploads/2013/01/sap_no_viewport.gif" width="240" height="320" /></a><p class="wp-caption-text">1) SAP ITS mobile screen on VGA Internet Explorer Mobile</p></div></td>
<td>
<p><div id="attachment_1694" class="wp-caption alignnone" style="width: 250px"><a href="http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/sap_viewport240_zoom2/" rel="attachment wp-att-1694"><img class="size-full wp-image-1694" alt="2) SAP ITS mobile screen on VGA display with viewport width=240 and zoom=2" src="http://www.hjgode.de/wp/wp-content/uploads/2013/01/sap_viewport240_zoom2.gif" width="240" height="320" /></a><p class="wp-caption-text">2) SAP ITS mobile screen on VGA display with viewport width=240 and zoom=2</p></div></td>
</tr>
</tbody>
</table>
<p><span id="more-1692"></span></p>
<p>The trick is to use the non-standard viewport META tag. As described <a href="https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag" target="_blank">here</a>, <a href="http://www.quirksmode.org/mobile/viewports2.html" target="_blank">here</a> and <a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html#//apple_ref/doc/uid/TP40006509-SW29" target="_blank">here</a>, you can use meta-viewport to define the initial viewport, the part of the page you want to see and a zoom level.</p>
<p>Fortunately the meta tag for viewport works within Internet Explorer Mobile (Windows Embedded Handheld 6.5.3).</p>
<p><a href="http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/weh-version/" rel="attachment wp-att-1695"><img class="alignnone size-full wp-image-1695" alt="weh-version" src="http://www.hjgode.de/wp/wp-content/uploads/2013/01/weh-version.gif" width="240" height="320" /></a></p>
<p>The differences between the html code of image 1) and image 2) is just one additional line in the head section of the code for image 2):</p>
<pre>&lt;meta name="viewport" content="width=240, initial-scale=2, maximum-scale=2, minimum-scale=2"&gt;</pre>
<p>This line makes the viewport equal to the PocketPC QVGA width of 240 pixel and specifies a zoom level of 2 to enlarge the viewport onto the VGA screen with a width of 480.</p>
<p>Now, my final goal is to disable the Zoom bar of Internet Explorer Mobile.</p>
<p>See also this <a href="http://www.hjgode.de/wp/2011/09/05/remote-desktop-mobile-on-vga-devices-qvga-applications-do-not-scale-well/">post </a>about QVGA and VGA scaling.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F23%2Finternet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen%2F&amp;title=Internet+Explorer+Mobile+%26%238211%3B+QVGA+web+site+do+not+scale+well+to+VGA+screen" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F23%2Finternet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen%2F&amp;title=Internet+Explorer+Mobile+%26%238211%3B+QVGA+web+site+do+not+scale+well+to+VGA+screen" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F23%2Finternet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen%2F&amp;title=Internet+Explorer+Mobile+%26%238211%3B+QVGA+web+site+do+not+scale+well+to+VGA+screen" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F23%2Finternet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen%2F&amp;T=Internet+Explorer+Mobile+%26%238211%3B+QVGA+web+site+do+not+scale+well+to+VGA+screen" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F23%2Finternet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F23%2Finternet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen%2F&amp;t=Internet+Explorer+Mobile+%26%238211%3B+QVGA+web+site+do+not+scale+well+to+VGA+screen" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Explorer Mobile &#8211; To zoom or not to zoom</title>
		<link>http://www.hjgode.de/wp/2013/01/21/internet-explorer-mobile-to-zoom-or-not-to-zoom/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=internet-explorer-mobile-to-zoom-or-not-to-zoom</link>
		<comments>http://www.hjgode.de/wp/2013/01/21/internet-explorer-mobile-to-zoom-or-not-to-zoom/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 19:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[kiosk mode]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IEM]]></category>
		<category><![CDATA[Internet Explorer Mobile]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1688</guid>
		<description><![CDATA[With Windows Mobile 6.5.3, sorry, Windows Embedded Handheld 6.5.3 we have the Internet Explorer Mobile 6 engine. Although it may look nice for the one or other, the rendering, especially the zoom in and out is unusable for commercial use. The IT departments of Warehouses and Stores designed there mobile web pages for a fixed [...]]]></description>
				<content:encoded><![CDATA[<p>With Windows Mobile 6.5.3, sorry, Windows Embedded Handheld 6.5.3 we have the Internet Explorer Mobile 6 engine.</p>
<p><a href="http://www.hjgode.de/wp/2013/01/23/internet-explorer-mobile-qvga-web-site-do-not-scale-well-to-vga-screen/weh-version/" rel="attachment wp-att-1695"><img class="alignnone size-full wp-image-1695" alt="weh-version" src="http://www.hjgode.de/wp/wp-content/uploads/2013/01/weh-version.gif" width="240" height="320" /></a></p>
<p>Although it may look nice for the one or other, the rendering, especially the zoom in and out is unusable for commercial use. The IT departments of Warehouses and Stores designed there mobile web pages for a fixed size layout of 240&#215;320 (QVGA). Using IEM (Internet Explorer Mobile) these pages do not show well. Either they are to small to read or, if zoomed in, the user has to scroll here and there. Not very usable. Event the Fit-To-Screen option does not help.</p>
<p>The predefined viewport or 1024&#215;768 may be good for browsing non-mobile web sites but I was unable to find a suitable setting for mobile sites with a fixed QVGA or VGA layout.</p>
<p>Here comes the tipp found at <a href="http://forum.xda-developers.com/showthread.php?p=6237624#post6237624" target="_blank">xda-developers</a>: change the default viewport size to match your needs:</p>
<pre>Default:
HKCU\Software\Microsoft\Internet Explorer\Main
Viewport Height = dword:00000258(600)
Viewport Width = dword:00000320(800)

Landscape optimized (VGA)
HKCU\Software\Microsoft\Internet Explorer\Main
Viewport Height = dword:000001e0(480)
Viewport Width = dword:00000280(640)

Portrait optimized (VGA)
HKCU\Software\Microsoft\Internet Explorer\Main
Viewport Height = dword:00000280(640)
Viewport Width = dword:000001e0(480)</pre>
<p>I assume you will find these better for commercial use than the desktop settings.</p>
<p>Unfortunately these settings are not used on every windows embedded device. So, you may give it a try and if it works for you, fine. I tested one device and iexplore.exe did not care about these entries. I checked with RegLoggerCE and found that iexplore.exe on that device does not query the above settings. For anyone interested, here is the log file of registry access of iexplore.exe captured with regLoggerCE: <b>DOWNLOAD:</b><a href="http://www.hjgode.de/wp/wp-content/plugins/download-monitor/download.php?id=178" title="Downloaded 93 times">regLoggerCE log file for iexplore within WEH653</a> -  (Hits: 93, size: 10.66 kB)</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F21%2Finternet-explorer-mobile-to-zoom-or-not-to-zoom%2F&amp;title=Internet+Explorer+Mobile+%26%238211%3B+To+zoom+or+not+to+zoom" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F21%2Finternet-explorer-mobile-to-zoom-or-not-to-zoom%2F&amp;title=Internet+Explorer+Mobile+%26%238211%3B+To+zoom+or+not+to+zoom" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F21%2Finternet-explorer-mobile-to-zoom-or-not-to-zoom%2F&amp;title=Internet+Explorer+Mobile+%26%238211%3B+To+zoom+or+not+to+zoom" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F21%2Finternet-explorer-mobile-to-zoom-or-not-to-zoom%2F&amp;T=Internet+Explorer+Mobile+%26%238211%3B+To+zoom+or+not+to+zoom" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F21%2Finternet-explorer-mobile-to-zoom-or-not-to-zoom%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F21%2Finternet-explorer-mobile-to-zoom-or-not-to-zoom%2F&amp;t=Internet+Explorer+Mobile+%26%238211%3B+To+zoom+or+not+to+zoom" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/01/21/internet-explorer-mobile-to-zoom-or-not-to-zoom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RDM_Keepbusy has been updated</title>
		<link>http://www.hjgode.de/wp/2013/01/18/rdm_keepbusy-has-been-updated/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rdm_keepbusy-has-been-updated</link>
		<comments>http://www.hjgode.de/wp/2013/01/18/rdm_keepbusy-has-been-updated/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 11:44:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[remote desktop mobile]]></category>
		<category><![CDATA[windows mobile]]></category>
		<category><![CDATA[Windows Mobile 6]]></category>
		<category><![CDATA[wpctsc.exe]]></category>

		<guid isPermaLink="false">http://www.hjgode.de/wp/?p=1685</guid>
		<description><![CDATA[I fixed a bug in RDM_KeepBusy. It worked only for the first session and not after close/open another session. Please always use the subversion code. Bookmark It]]></description>
				<content:encoded><![CDATA[<p>I fixed a bug in <a href="http://www.hjgode.de/wp/2012/07/30/mobile-development-rdp-autologin-v5/">RDM_KeepBusy</a>. It worked only for the first session and not after close/open another session. Please always use the subversion code.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F18%2Frdm_keepbusy-has-been-updated%2F&amp;title=RDM_Keepbusy+has+been+updated" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F18%2Frdm_keepbusy-has-been-updated%2F&amp;title=RDM_Keepbusy+has+been+updated" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F18%2Frdm_keepbusy-has-been-updated%2F&amp;title=RDM_Keepbusy+has+been+updated" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.netscape.com/submit/?U=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F18%2Frdm_keepbusy-has-been-updated%2F&amp;T=RDM_Keepbusy+has+been+updated" rel="nofollow" title="Add to&nbsp;Netscape"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/netscape.png" title="Add to&nbsp;Netscape" alt="Add to&nbsp;Netscape" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F18%2Frdm_keepbusy-has-been-updated%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.hjgode.de%2Fwp%2F2013%2F01%2F18%2Frdm_keepbusy-has-been-updated%2F&amp;t=RDM_Keepbusy+has+been+updated" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.hjgode.de/wp/wp-content/plugins/social-bookmarks0/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.hjgode.de/wp/2013/01/18/rdm_keepbusy-has-been-updated/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
