<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-254517917119511180</id><updated>2024-09-08T05:51:44.286-04:00</updated><category term="C/C++"/><category term="Android"/><category term="Java"/><category term="Win32"/><category term="SDK"/><category term="Windows Mobile"/><category term="Blogs"/><category term="JavaScript"/><category term="WinCE"/><category term="ant"/><category term="eclipse"/><category term="embeded"/><category term="xml"/><category term="API"/><category term="ATL"/><category term="COM"/><category term="Delphi"/><category term="Google"/><category term="Highlighter"/><category term="IPhone"/><category term="ListView"/><category term="NDK"/><category term="PHP"/><category term="STOLL"/><category term="Sintral"/><category term="WTL"/><category term="Yii framework"/><category term="builder"/><category term="camera"/><category term="canon"/><category term="certificates"/><category term="drivers"/><category term="features"/><category term="linux"/><category term="microwindows"/><category term="nano-x"/><category term="optimisation"/><category term="signature"/><category term="theory"/><title type='text'>My working life..</title><subtitle type='html'>It&#39;s about what I&#39;d like to do according to programming</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>28</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-2736641257119791215</id><published>2013-02-18T21:32:00.000-05:00</published><updated>2017-05-18T19:12:31.427-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="certificates"/><category scheme="http://www.blogger.com/atom/ns#" term="signature"/><category scheme="http://www.blogger.com/atom/ns#" term="theory"/><title type='text'>Certificates</title><content type='html'>&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Introduction&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Certificates is a new way to prove identity. Unfortunately this topic sometimes is hidden from publicity and still is a mystery for average Internet user. I would like to share some knowledge about &lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Public_key_certificate&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;certificates&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;, their structure and the way how I understand them. This article covers very basic questions &lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;about certificates&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;that users may have.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;b&gt;Certificate structure (simplified)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;What is certificates for? The main purpose is to verify identity (prove that information written in certificate belongs to certificate owner).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Certificate consists of three main parts:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Information - everything that you can see when open certificate in MMC console or other certificate viewer;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Public key - a unique sequence that belong to certificate owner;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Signature Algorithm - methods that was used to create certificate signature (usually it is built from encryption algorithm and digest algorithm. For example SHA1 with RSA)&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Signature - another unique sequence that represent result of applying encryption and digest.&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;&lt;/ul&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Lets take a closer look to every part&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Information:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Here we can add any information we would like to present and prove.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;According to Internet standard 
&lt;/span&gt;&lt;b&gt;&lt;a href=&quot;http://www.ietf.org/rfc/rfc2459.txt&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;RFC2459&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
 there are mandatory fields&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- issuer - id who created signature&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- subject (owner) - owners name or other owners unique information&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- serial number - issuer certificate serial number. A pair serial/issuer creates an unique certificate id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- not before, not after - expiration date and effective date.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- constrains - main purpose for the certificate. For example if constrains is main exchange - it should not be used for SSL, ets.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Public key:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;This section contains a public key of any asymmetric cryptographic system. The most popular asymmetric system are &lt;/span&gt;&lt;a href=&quot;http://www.google.ca/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDAQFjAA&amp;amp;url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRSA&amp;amp;ei=bb0iUZb1D4rV2QXQ24HwDw&amp;amp;usg=AFQjCNED6qwFrkNQKJqmRCemj43ywCRJUA&amp;amp;sig2=r5W1q4RrZ2jDVkQEqRYPkQ&amp;amp;bvm=bv.42553238,d.b2U&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;RSA &lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;and &lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Diffie–Hellman&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Information + public key also called TBSCertificate.&amp;nbsp;Every&lt;br /&gt;   TBSCertificate contains the names of the subject and issuer, a public&lt;br /&gt;   key associated with the subject, a validity period, a version number,&lt;br /&gt;   and a serial number; some may contain optional unique identifier &amp;nbsp;  fields. (from &lt;a href=&quot;http://www.ietf.org/rfc/rfc2459.txt&quot; target=&quot;_blank&quot;&gt;RFC&lt;/a&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Signature algorithm and Signature:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;In order to verify certificate, a verifier should know how to verify certificate signature. For example, if algorithm is SHA1 with RSA then this means that in order to verify certificate signature we need to get SHA1 from certificate and then it should match with data we have got by decrypting signature with issuers public key. The most popular message digest algorithms are&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; 
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/SHA1&quot; target=&quot;_blank&quot;&gt;SHA1&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/MD5&quot; target=&quot;_blank&quot;&gt;MD5&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/MD4&quot; target=&quot;_blank&quot;&gt;MD4&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/MD6&quot; target=&quot;_blank&quot;&gt;MD6&lt;/a&gt;.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;How to create signature?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Issuer is an authority who sign certificates.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;In order to create issuer signature. Issuer gets a digest of certificate data (for example it can use SHA1 algorithm for this) then using private key encrypts digest. As result you will have an encrypted certificate digest.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;How to verify signature?&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Anyone could verify certificate signature in order to confirm that certificate content belongs to owner.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;In order to verify certificate signature we should:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- Decrypt signature it using issuers public key;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- Get digest of certificate;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;- Compare results. on one hand you have decrypted signature, on other hand digest. They should be the same because issuer created signature in the same way.&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;This verification is based on assumption that no one, except issuer, doesn&#39;t have issuers private key.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Lets have some example:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Root or &lt;a href=&quot;http://en.wikipedia.org/wiki/Root_certificate&quot; target=&quot;_blank&quot;&gt;self signed certificate&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Private key &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 44 33 22 11&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;(Private key stored separately from certificate and it is confidential)&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Certificate &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Root&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Issuer &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Government&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Subject &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: Government&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;PublicKey &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 11 22 33 44&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Signature Algorithm: RSA with SHA1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Signature &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 55 44&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;This is a simplified version of root or self-signed certificate. Issuer and Subject here are the same. Signature in this case is a digest encrypted with issuers private key. Because issuer and owner are the same, there is no way to prove that private/public key belongs to owner.&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;It could be compromised by replacing public key and signature. That is why we have many trusted authorities that could prove each other identities. This is partially solved by distributing root certificates together with firmware or operating system.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Another example:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Private key &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: DD CC BB AA&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;(Private key stored separately from certificate and it is confidential)&amp;nbsp;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Certificate &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Library&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Issuer &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Government&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Subject &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: Computer&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Public Key &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: AA BB CC DD&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Signature Algorithm: RSA with SHA1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Signature &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: EE FF&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;In case if we trust Certificate Root. We can verify and confirm that information in certificate is not compromised and belongs to Library.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Why we can trust &quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Certificate &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Library&quot;?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;Because Root we trust has been verified and proved by its signature that&amp;nbsp;&lt;/b&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Certificate &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Library&quot;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt; &amp;nbsp;&lt;b&gt;b&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;elongs to Library, and because we trust &lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Certificate &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Root&lt;/span&gt;&lt;/span&gt;&quot; &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;w&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;e can say that we trust &quot;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Certificate &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Library&lt;/span&gt;&lt;/span&gt;&lt;/b&gt; &quot;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;.&lt;/b&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Lets find out what is Library certificate signature in this case:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;Signature &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: EE FF&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;This is suppose to be an encrypted digest. Digest we get from &quot;Certificate Library&quot; body and encrypted with issuer (Certificate Root) private key.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;In our example signature EE FF is the result of &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;RSA([issuers private key], SHA1(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Certificate Library&lt;/span&gt;&#39;s &lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;TBSCertificate))&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;[EE FF] = RSA([&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;44 33 22 11&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;], SHA1(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;T&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;BSCertificate&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Library&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Using similar approach we can build a certificate trusted chain. For example you don&#39;t trust issuer and don&#39;t trust issuer&#39;s issuer but you do trust issuer&#39;s issuer&#39;s issuer.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , &amp;quot;helvetica&amp;quot; , sans-serif;&quot;&gt;Why it works?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Signature verification works because we made some assumptions.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;First (the most important) is that for asymmetric encryption systems for key pair (public/private keys) there is no easy way (mathematicians didn&#39;t find one yet) to calculate private key based on public key.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;The nature of asymmetric systems&amp;nbsp;allows to encrypt message with private key and decrypt message using public key. That is true in opposite direction.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Second assumption is related to one way hash functions that are used to create certificate digest. for long enough input data it is possible to generate unique digest and there is no easy way to find out what is input data from digest.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/2736641257119791215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/2736641257119791215' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/2736641257119791215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/2736641257119791215'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2013/02/certificates.html' title='Certificates'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-1441078750707877243</id><published>2011-06-13T23:59:00.003-04:00</published><updated>2017-08-10T01:16:38.836-04:00</updated><title type='text'>Undersranding android gestures</title><content type='html'>Android gestures is another dark horse because it is wrapped into an Android library and it becomes a part of SDK.&lt;br /&gt;
&lt;br /&gt;
From Android SDK it is clear that gesture library should be put in a raw folder in resources or it could be just a separate file in private or public folder, but what is the gesture library format?. You can browse Android SDK &lt;a href=&quot;http://developer.android.com/resources/articles/gestures.html&quot;&gt;here&lt;/a&gt; that describes only high level design.&lt;br /&gt;
&lt;br /&gt;
I still cannot find gesture library format but I saw on the market there are many applications that uses gestures.&lt;br /&gt;
&lt;br /&gt;
My first clue was to use Gesture Builder from Android example SDK.&lt;br /&gt;
It is located under &lt;b&gt;&lt;android-sdk&gt;\samples\android-8\GestureBuilder&lt;/android-sdk&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Lets take a close look:&lt;br /&gt;
&lt;br /&gt;
GestureLibrary lib;&lt;br /&gt;
// create lib instanse from file name pass empty file&lt;br /&gt;
lib = GestureLibraries.fromFile(new File(&quot;gestures&quot;)));&lt;br /&gt;
..&lt;br /&gt;
lib.addGesture(&quot;gesture&#39;s name&quot;, gestureProcessor); // adding&lt;br /&gt;
lib.save();&lt;br /&gt;
&lt;br /&gt;
// We could build gesture object &amp;nbsp;from overlay&lt;br /&gt;
private class GestureProcessor implements GestureOverlayView.OnGestureListener {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void onGestureStarted(GestureOverlayView overlay, MotionEvent event) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void onGesture(GestureOverlayView overlay, MotionEvent event) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mGesture = overlay.getGesture();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (mGesture.getLength() &amp;lt; LENGTH_THRESHOLD) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;overlay.clear(false);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/1441078750707877243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/1441078750707877243' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1441078750707877243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1441078750707877243'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2011/06/undersranding-android-gestures.html' title='Undersranding android gestures'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-1420549466054089217</id><published>2011-01-29T19:18:00.058-05:00</published><updated>2011-01-31T16:47:26.753-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="ListView"/><title type='text'>Multilayout ListView</title><content type='html'>&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;This is a multi Layout view sample. You can &amp;nbsp;use it when you need to display the same amount of data (in sample text and images but it should be located differently&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;You need to build a special ListView adaptor&amp;nbsp;&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_S8lqrI_mZMA/TUTxvER0jRI/AAAAAAAADaw/XhgPJ0QEtrI/s1600/device.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;http://1.bp.blogspot.com/_S8lqrI_mZMA/TUTxvER0jRI/AAAAAAAADaw/XhgPJ0QEtrI/s400/device.png&quot; width=&quot;266&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;Source code for MultiLayout Adapter is bellow&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;script type=&quot;text/javascript&quot;&gt;

function loadjscssfile(filename, filetype){
 if (filetype==&quot;js&quot;){ //if filename is a external JavaScript file
  var fileref=document.createElement(&#39;script&#39;)
  fileref.setAttribute(&quot;type&quot;,&quot;text/javascript&quot;)
  fileref.setAttribute(&quot;src&quot;, filename)
 }
 else if (filetype==&quot;css&quot;){ //if filename is an external CSS file
  var fileref=document.createElement(&quot;link&quot;)
  fileref.setAttribute(&quot;rel&quot;, &quot;stylesheet&quot;)
  fileref.setAttribute(&quot;type&quot;, &quot;text/css&quot;)
  fileref.setAttribute(&quot;href&quot;, filename)
 }
 if (typeof fileref!=&quot;undefined&quot;)
  document.getElementsByTagName(&quot;head&quot;)[0].appendChild(fileref)
}
loadjscssfile(&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot;, &quot;css&quot;);
 loadjscssfile(&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot;, &quot;css&quot;);
 loadjscssfile(&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot;, &quot;js&quot;);
 loadjscssfile(&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&quot;, &quot;js&quot;);

&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script class=&quot;brush: java&quot; type=&quot;syntaxhighlighter&quot;&gt;
&lt;![CDATA[package sss.test;

import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MultiLayoutAdapter extends BaseAdapter {

 /**
  * @author sashaslonmailer
  * @description this class is a data item.move it to separate file
  */
 static class Data {
  public Data(int aIcon, String aName) {
   name = aName;
   icon = aIcon;
  }
  final String name;
  final int icon;
  public String getName() {
   return name;
  }
  public int getIconId() {
   return icon;
  }
 }

 /**
  * @description View Holder pattern implementation. We need it
  *              to boost listview redrawing
  */
 class ViewHolder {
  public ViewHolder(View curr, int imageId, int textId) {
   _text = (TextView) curr.findViewById(textId);
   _image = (ImageView) curr.findViewById(imageId);
  }
  final public ImageView _image;
  final public TextView _text;
  public void fill(Data data) {
   // _image.setImageResource(data.getIcon());
   _text.setText(data.name);
  }
 }

 final ArrayList&lt;data&gt; _data = new ArrayList&lt;data&gt;();
 final Context _context;
 static final int[] LAYOUTS = new int[] { R.layout.center, R.layout.left,
   R.layout.right };

 MultiLayoutAdapter(Context context, ArrayList&lt;data&gt; data) {
  _context = context;
  _data.addAll(data);
 }

 // this functions we need to support multi layout
 @Override
 public int getItemViewType(int position) {  return position % 3; }
 // this functions we need to support multi layout
 @Override
 public int getViewTypeCount() {  return LAYOUTS.length; }

 @Override
 public int getCount() { return _data.size(); }
 @Override
 public Object getItem(int index) {  return _data.get(index); }
 @Override
 public long getItemId(int index) {  return index; }

 @Override
 public View getView(int position, View view, ViewGroup groupView) {
  View curr = view;
  ViewHolder viewHolder;
  if (curr == null) {
   curr = LayoutInflater.from(_context).inflate(
     getLayoutByPosition(position), null);
   // create new veiw
   viewHolder = new ViewHolder(curr, R.id.icon, R.id.text);
   // add view holder
   curr.setTag(viewHolder);
  } else {
   // get view holder
   viewHolder = (ViewHolder) curr.getTag();
  }
  // populate viewHolder with data
  viewHolder.fill((Data) getItem(position));
  return curr;
 }
 /**
  * @param position id s list item index
  * @return layout resource index
  */
 private int getLayoutByPosition(int position) {
  return LAYOUTS[getItemViewType(position)];
 }
}
&lt;/script&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
     SyntaxHighlighter.all()
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a target=&quot;_blank&quot;  href=&quot;http://www.amazon.com/Beginning-Android-2-ebook/dp/B003VPWYCI?ie=UTF8&amp;tag=widgetsamazon-20&amp;link_code=btl&amp;camp=213689&amp;creative=392969&quot;&gt;Beginning Android 2&lt;/a&gt;&lt;img src=&quot;http://www.assoc-amazon.com/e/ir?t=widgetsamazon-20&amp;l=btl&amp;camp=213689&amp;creative=392969&amp;o=1&amp;a=B003VPWYCI&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot; alt=&quot;&quot; style=&quot;border:none !important; margin:0px !important; padding: 0px !important&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/1420549466054089217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/1420549466054089217' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1420549466054089217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1420549466054089217'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2011/01/multilayout-listview.html' title='Multilayout ListView'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_S8lqrI_mZMA/TUTxvER0jRI/AAAAAAAADaw/XhgPJ0QEtrI/s72-c/device.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-2475013664926329570</id><published>2011-01-29T18:30:00.075-05:00</published><updated>2013-02-19T00:53:13.012-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogs"/><category scheme="http://www.blogger.com/atom/ns#" term="Highlighter"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>Code Highlighting</title><content type='html'>&lt;span style=&quot;font-family: inherit;&quot;&gt;Highlighted code in my samples&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
&lt;/span&gt;I found excellent &lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/&quot;&gt;javascript project&lt;/a&gt;. It was written by Alex Gorbatchev, and it is free (Thanks Alex!). I will use it to highlight code samples.
There is no need to host JS and CSS inside your blog system, you can just reference files instead.&lt;br /&gt;
The most popular programming languages are supported &lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;You can download project and use it in your web sites or you can use hosted version of highlighter.
Unfortunately, Google blog system doesn&#39;t allow you to insert link tag, but I have used loadjscssfile function to load script and css files.&lt;br /&gt;
Lets test hosted version: (javascript example)

&lt;script type=&quot;text/javascript&quot;&gt;
    
function loadjscssfile(filename, filetype)
{
if (filetype==&quot;js&quot;){
var fileref=document.createElement(&#39;script&#39;)
fileref.setAttribute(&quot;type&quot;,&quot;text/javascript&quot;)
fileref.setAttribute(&quot;src&quot;, filename)
}
else if (filetype==&quot;css&quot;){
var fileref=document.createElement(&quot;link&quot;) 
fileref.setAttribute(&quot;rel&quot;, &quot;stylesheet&quot;)
fileref.setAttribute(&quot;type&quot;, &quot;text/css&quot;) 
fileref.setAttribute(&quot;href&quot;, filename)
}
if (typeof fileref!=&quot;undefined&quot;){
  document.getElementsByTagName(&quot;head&quot;)[0].appendChild(fileref) 
}
} 
var pathToScript = &quot;http://alexgorbatchev.com/pub/sh/current/&quot;;
loadjscssfile(pathToScript + &quot;styles/shCore.css&quot;, &quot;css&quot;);
loadjscssfile(pathToScript + &quot;styles/shThemeDefault.css&quot;, &quot;css&quot;);
loadjscssfile(pathToScript + &quot;scripts/shCore.js&quot;, &quot;js&quot;);
loadjscssfile(pathToScript + &quot;scripts/shBrushJava.js&quot;, &quot;js&quot;); 
loadjscssfile(pathToScript + &quot;scripts/shBrushJScript.js&quot;,&quot;js&quot;);
&lt;/script&gt;

&lt;span style=&quot;font-family: inherit;&quot;&gt;Here is a function that loads scripts and css.&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:js&quot;&gt;
function loadjscssfile(filename, filetype)
{
&amp;nbsp; &amp;nbsp;if (filetype==&quot;js&quot;){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var fileref=document.createElement(&#39;script&#39;)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fileref.setAttribute(&quot;type&quot;,&quot;text/javascript&quot;)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fileref.setAttribute(&quot;src&quot;, filename)
&amp;nbsp; &amp;nbsp;} 
&amp;nbsp; &amp;nbsp;else if (filetype==&quot;css&quot;){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var fileref=document.createElement(&quot;link&quot;)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fileref.setAttribute(&quot;rel&quot;, &quot;stylesheet&quot;)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fileref.setAttribute(&quot;type&quot;, &quot;text/css&quot;) 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fileref.setAttribute(&quot;href&quot;, filename)
&amp;nbsp; &amp;nbsp;} 
&amp;nbsp; &amp;nbsp;if (typeof fileref!=&quot;undefined&quot;){
&amp;nbsp; &amp;nbsp; &amp;nbsp; document.getElementsByTagName(&quot;head&quot;)[0].appendChild(fileref)
&amp;nbsp; &amp;nbsp;}
} 

var pathToScript = &quot;http://alexgorbatchev.com/pub/sh/current/&quot;; 
loadjscssfile(pathToScript + &quot;styles/shCore.css&quot;, &quot;css&quot;); 
loadjscssfile(pathToScript + &quot;styles/shThemeDefault.css&quot;, &quot;css&quot;); 
loadjscssfile(pathToScript + &quot;scripts/shCore.js&quot;, &quot;js&quot;); 
loadjscssfile(pathToScript + &quot;scripts/shBrushJava.js&quot;, &quot;js&quot;); 
loadjscssfile(pathToScript + &quot;scripts/shBrushJScript.js&quot;,&quot;js&quot;); 

&lt;/pre&gt;
&lt;br /&gt;
Android Java example:

&lt;pre class=&quot;brush:java&quot;&gt;
import android.widget.TextView;
public class TestClass {
&amp;nbsp; &amp;nbsp; private static final int[] LAYOUTS = new int[] {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R.layout.center,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R.layout.left, 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R.layout.right 
&amp;nbsp; &amp;nbsp; private final Context _context;
&amp;nbsp; &amp;nbsp; private final ArrayList _data = new ArrayList();
&amp;nbsp; &amp;nbsp; public TestClass(Context context, ArrayList data){ 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _context = context;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _data.addAll( data );
  
&amp;nbsp; &amp;nbsp; }
}
&amp;nbsp;
&lt;/pre&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
SyntaxHighlighter.all()
&lt;/script&gt;
</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/2475013664926329570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/2475013664926329570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/2475013664926329570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/2475013664926329570'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2011/01/code-highlighting.html' title='Code Highlighting'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-6229624141344754400</id><published>2011-01-11T01:42:00.002-05:00</published><updated>2013-07-11T01:07:06.695-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="builder"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="features"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Java pre-processor</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;How Eclipse works to compile project?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;If we are looking for android project compilation process, it contains from many builders&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;- before resource generator builder;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;- resource builder;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;- Java compiler;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;- package builder;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Next builder will be started after previous one was finished successfully.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Sometimes you may want to use one source for different incompatible platforms &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;(like JavaME MIPS2.0 or Java SE or some other Java specific platform like Android).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;The best approach here to have you project separated from Java SDK by creating wrappers on SDK layer and then refer only wrapped classes in your project. Then when in and script for package builder build your project together with Java specific library wrapper.(recommended)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Another way to dial with this problem is to have a &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;preprocessor like C preprocessor and wrap platform specific code. This approach is less clear and it feels like some comments you cannot remove. (not recommended)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;If you need Java cross platform but it is difficult to separate api in your project - you have to redesign you project.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Custom Java preprocessor (also could be done using ant script as well as using external preprocessor tool (like C preprocessor). To understand how it works I have created my own custom preprocessor using ant&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Eclipse defines 4 targets&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;before clean&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;manual build&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;auto build&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;during clean&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/ul&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;I have created a simple xml file with 4 targets that is shown below:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;lt;project name=&quot;new builder&quot; &amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;lt;target name=&quot;before_clean&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;lt;target name=&quot;manual_build&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;lt;target name=&quot;auto_build&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;lt;target name=&quot;during_clean&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;lt;/project&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Do you have other solution how to build the same app on different Java platforms?&amp;nbsp;&lt;/span&gt;&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/6229624141344754400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/6229624141344754400' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6229624141344754400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6229624141344754400'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2011/01/java-pre-processor.html' title='Java pre-processor'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-1322132554711929641</id><published>2011-01-09T22:36:00.048-05:00</published><updated>2011-01-10T00:59:17.759-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogs"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>Google Translation</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;I would like to share a Google Translate JavaScript plug-in.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;To add a translation to your web pages you can use JavaScript and Google translate services.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
Here is a sample that add a translate combo box to your page:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #783f04;&quot;&gt;// define div tag where translation combobox will be placed&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;div id=&quot;google_translate_element&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;/div&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #783f04;&quot;&gt;// define &quot;new&quot; translate element function &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;script&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt; function googleTranslateElementInit() {&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; new google.translate.TranslateElement({&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; &amp;nbsp; pageLanguage: &#39;uk&#39;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; &amp;nbsp; includedLanguages: &#39;et,tl&#39;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; }, &#39;google_translate_element&#39;);&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #444444;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;/script&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #783f04;&quot;&gt;// add all necessary sources to do the translation&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;script src=&quot;//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;/script&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;pros:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;- easy to use&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;- using it you can create a copy of your blog/site to other languages&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;cons:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;- not all languages supported&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;- engine itself is quite new and translation is not perfect&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;if you need translation to any language remove  &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;includedLanguages &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;parameter&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;There are some useful links that may help you with building your copy:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;Simple and vary helpful generator of &lt;a href=&quot;http://translate.google.com/translate_tools&quot;&gt;Google JavaScript code&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;a href=&quot;http://code.google.com/apis/language/translate/v1/reference.html&quot;&gt;Google Translate API JavaScript Reference&lt;/a&gt; &amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;a href=&quot;http://translate.google.com/toolkit/list?hl=en#translations/active&quot;&gt;Translator Toolket&lt;/a&gt; you are able to translate html pages and correct translations. Interface is similar to &lt;a href=&quot;https://docs.google.com/&quot;&gt;Google Docs&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/1322132554711929641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/1322132554711929641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1322132554711929641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1322132554711929641'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2011/01/google-blogs-translation.html' title='Google Translation'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-276445019149288473</id><published>2011-01-04T08:29:00.010-05:00</published><updated>2011-01-04T20:25:06.785-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="ant"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="xml"/><title type='text'>Android and Ant builder. Part 2</title><content type='html'>About ant commands :&lt;br /&gt;
You can create your own command processor with ant (you are able to create elements and ant is able to process commands in ants way (using xml to join parts )&lt;br /&gt;
&lt;br /&gt;
For example for search and replace there is a command that is mapped to java or to implemented in other language application&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;lt;replaceregexp file=&quot;file&quot;&amp;nbsp;                   &amp;nbsp;match=&quot;pattern&quot; &amp;nbsp;                   &amp;nbsp;replace=&quot;pattern&quot; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;flags=&quot;options&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;byline=&quot;true|false&quot; /&amp;gt; ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&lt;span style=&quot;color: #444444;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp; &lt;/span&gt;    &lt;br /&gt;
it is actually a prepared a java class(s) that do the job&lt;br /&gt;
&lt;br /&gt;
Is Ant depends on Java JRE or it is a separate native application? I think it is...&lt;br /&gt;
Probably that&#39;s why Java and Ant is so close...&lt;br /&gt;
&lt;br /&gt;
I also would like to understand how preprocessor works in Eclipse. It may helps me with my tasks</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/276445019149288473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/276445019149288473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/276445019149288473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/276445019149288473'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2011/01/android-and-ant-builder-part-2.html' title='Android and Ant builder. Part 2'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-642439207112529314</id><published>2010-12-22T01:31:00.003-05:00</published><updated>2017-09-22T17:10:09.560-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="ant"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="xml"/><title type='text'>Android Ant builder</title><content type='html'>Android build process is quite complicated&lt;br /&gt;
First of all it is based on ant script together with sdk tools and java apps aligned to ant.&lt;br /&gt;
&lt;br /&gt;
Lets take a closer look to it&lt;br /&gt;
to create ant script manually just type:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;cmd &amp;lt;enter&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
if you don&#39;t have Android SDK folder in system PATH environmental variable - add it&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;set path=%path%;X:\android\android-sdk-windows-1.5_r3\tools&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
now you can create new or update existent eclipse project&lt;br /&gt;
(I assume that you like me create project in eclipse first and then,&amp;nbsp;for some reason, you need to build your fancy application from command line&lt;br /&gt;
&lt;br /&gt;
set current dir to your android project dir&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;cd c:\apps\myapp &amp;lt;enter&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;android update project &amp;nbsp;&amp;lt;enter&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
now you have &lt;b&gt;build.xml&lt;/b&gt; in your projects root folder&lt;br /&gt;
&lt;br /&gt;
for now you can open them in eclipse but you cannot build (execute) ant script from eclipse&lt;br /&gt;
The problem is in java component that connect you build.xml ant script with platform dependent android ant script that located in SDK&lt;br /&gt;
&lt;br /&gt;
for example for API level 8 it will be android_rules_r3.xml.&lt;br /&gt;
&lt;br /&gt;
File contains a lot of comments about every section&lt;br /&gt;
but I&#39;ll explain some of them just for those who &amp;nbsp;who know nothing about ant engine :)&lt;br /&gt;
&lt;br /&gt;
Ant stuff&lt;br /&gt;
I will explain only things that I need to build android project manually&lt;br /&gt;
&lt;br /&gt;
every project contains&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;project name=&quot;myapps&quot; default=&quot;&amp;lt;default target&amp;gt;&quot; basedir=&amp;lt;path to your android project&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;project&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;nice to see basedir here because you are able to move you Ant script&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
main concept of ant is targets (like &quot;release&quot;, &quot;debug&quot;, &quot;release-signed&quot;, ets.)&lt;br /&gt;
every target could have dependency on other targets&lt;br /&gt;
and targets could be public and private (hidden)&lt;br /&gt;
&lt;br /&gt;
for example simple target:&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;target name=&quot;help&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;echo&amp;gt;This project has extended helpecho&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;target&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
complex target&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;lt;target name=&quot;release&quot; depends=&quot;resources, java_compiler, zip, sign, renameing&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;target&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
you can specify properties ( they are playing the same function as variables in other languages )&lt;br /&gt;
&amp;lt;property name=&quot;app.file.name&quot; value=&quot;${build.prop.name}&quot; /&amp;gt;&lt;br /&gt;
let me explain this&lt;br /&gt;
you can read/ write app.file.name using ${app.file.name} sintax&lt;br /&gt;
in sample you define property and set value for it equal to value of &amp;nbsp;build.prop.name property&lt;br /&gt;
&lt;br /&gt;
you could override this prop value in build.properties file&lt;br /&gt;
lets call it first level of customization&lt;br /&gt;
&lt;br /&gt;
you also &amp;nbsp;able to define properties in build.properties and then load to project&lt;br /&gt;
&amp;lt;property file=&quot;build.properties&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Combination of both &amp;lt;property name.../&amp;gt; and &amp;lt;property file=.../&amp;gt; creates a list of properties that could be redefined in a separate settings file&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;lt;property name=&quot;one&quot; value=&quot;ha-ha&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;lt;property file=&quot;build.properties&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
now we can move to targets and other xml elements&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;taskdef name=&quot;setup&quot; classname=&quot;com.android.ant.SetupTask&quot;&lt;br /&gt;
classpathref=&quot;android.antlibs&quot;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Defines a java class with a starting &quot;main&quot; point in &lt;span style=&quot;font-family: inherit;&quot;&gt;com.android.ant.SetupTask.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;reference android.antlibs - a link to path(s) where SetupTask could be found.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;All android elements (tags) could use (execute) this application&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;using &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;setup&amp;gt;setup&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; tag&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;few more samples&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;lt;taskdef name=&quot;apkbuilder&quot;&lt;br /&gt;
classname=&quot;com.android.ant.ApkBuilderTask&quot;&lt;br /&gt;
classpathref=&quot;android.antlibs&quot; /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;lt;taskdef name=&quot;xpath&quot;&lt;br /&gt;
classname=&quot;com.android.ant.XPathTask&quot;&lt;br /&gt;
classpathref=&quot;android.antlibs&quot; /&amp;gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;usage:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&amp;lt;xpath input=&quot;AndroidManifest.xml&quot; expression=&quot;/manifest/@package&quot;&lt;br /&gt;
output=&quot;manifest.package&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;lt;aaptexec executable=&quot;${aapt}&quot;&lt;br /&gt;
&amp;nbsp;               &amp;nbsp; command=&quot;package&quot;&lt;br /&gt;
&amp;nbsp;               &amp;nbsp; verbose=&quot;${verbose}&quot;&lt;br /&gt;
&amp;nbsp;               &amp;nbsp; manifest=&quot;AndroidManifest.xml&quot;&lt;br /&gt;
&amp;nbsp;               &amp;nbsp; androidjar=&quot;${android.jar}&quot;&lt;br /&gt;
&amp;nbsp;               &amp;nbsp; rfolder=&quot;${gen.absolute.dir}&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;aaptexec&amp;gt;&amp;nbsp;  &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;if you command sequence that you have to use in different targets you could write a macro&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;definition:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;macrodef name=&quot;dex-helper&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;      &amp;nbsp;&amp;lt;element name=&quot;external-libs&quot; optional=&quot;yes&quot; /&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;      &amp;nbsp;&amp;lt;element name=&quot;extra-parameters&quot; optional=&quot;yes&quot; /&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;      &amp;nbsp;&amp;lt;sequential&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;echo&amp;gt;Converting compiled files and external libraries into ${intermediate.dex.file}...echo&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;sequential&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;macrodef&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;usage:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;dex-helper /&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;or&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;       &amp;lt;dex-helper&amp;gt;&lt;br /&gt;
&amp;nbsp;         &amp;nbsp;&amp;lt;extra-parameters&amp;gt;&lt;br /&gt;
&amp;nbsp;           &amp;nbsp;&amp;nbsp; &amp;lt;arg value=&quot;--no-locals&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;         &amp;nbsp;extra-parameters&amp;gt;&lt;br /&gt;
&amp;nbsp;         &amp;nbsp;&amp;lt;external-libs&amp;gt;&lt;br /&gt;
&amp;nbsp;           &amp;nbsp; &amp;nbsp;&amp;lt;fileset file=&quot;${emma.dir}/emma_device.jar&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;         &amp;nbsp;external-libs&amp;gt;&lt;br /&gt;
&amp;nbsp;dex-helper/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;I hope you&#39;ve got the idea.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;b&gt;Now about problem I met&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;for android platform 2.2 (API level 8)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;if you open build script that contains external targets (targets that were defined in android_rules_r3.xml or other external files)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;in eclipse. you&#39;ve get ant compilation errors (unknown target)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;if you run the same script (build.xml) from command promt - it works fine&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;for example in case with auto-generated build.xml&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;this one return error unknown help target if you open it in eclipse&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;after that you are not able to compile you app!!!&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;As a not very good solution is moving &amp;nbsp;build.xml file outside project root dir in this case eclipce will not see it and you can add &lt;project basedir=&quot;your project dir&quot; name=&quot;myapp&quot;&gt; to get it working from command line&lt;/project&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/642439207112529314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/642439207112529314' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/642439207112529314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/642439207112529314'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/12/android-and-ant-builder.html' title='Android Ant builder'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-8238856249090053480</id><published>2010-11-30T00:56:00.011-05:00</published><updated>2011-01-05T01:27:36.455-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="optimisation"/><title type='text'>Java final String optimisation</title><content type='html'>Some times I need a sub string of a string and I noticed that if you add &lt;b&gt;final&lt;/b&gt; keyword, Java compiler makes a small optimization, isn&#39;t it?&lt;br /&gt;
&lt;br /&gt;
For example :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;String name = &quot;this is a simple string&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;String simple = name.substring(0,4);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here Java creates two strings&lt;br /&gt;
but if you write this code in different way you get rid of one extra allocation&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;final String name = &quot;this is a simple string&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;final String simple = name.substring(0,4);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Both objects points to the same memory block and String object itself has a constant context&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Am I right?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;I am not sure about this conclusions, so, I will check it again when I have time.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;If you know something how to use &lt;b&gt;final&lt;/b&gt; for &lt;b&gt;Strings&lt;/b&gt; and what exactly java compiler does,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;I&#39;ll be pleased if someone share his knowledges in this area&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/8238856249090053480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/8238856249090053480' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/8238856249090053480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/8238856249090053480'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/11/java-optimisation.html' title='Java final String optimisation'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-8084049054138787843</id><published>2010-11-30T00:37:00.004-05:00</published><updated>2010-11-30T08:22:50.836-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATL"/><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Win32"/><title type='text'>Bugs aligned to CString</title><content type='html'>Today I noticed a funny thing. Class CString C++ sometimes works like class String in Java&lt;br /&gt;
For example :&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;class Example&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; CString mName;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;public:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; void setName(const CString &amp;amp; name)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;mName = name;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; void modify()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;memset((VPVOID)(LPTSTR) mName,65,mName.GetLength()*sizeof(TCHAR));&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;class Other&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;// we set up this name somewere in code&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;public:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; CString getName() const&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return mName;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;void main()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;std::autoptr&lt;other&gt; o1 = &lt;/other&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;std::autoptr&lt;other&gt;(&lt;/other&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;new&amp;nbsp; Other(_T(&quot;simple string&quot;)));&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;Example ex1;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;ex.setName( o1-&amp;gt;getName() );&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;ex.modyfy();&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;// here you will have empty string for o1 and for ex classes&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;// because it refers to the &lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;same string data in memory&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;// so both &lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;classes will contain modified data&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, &amp;quot;Courier&amp;quot;, monospace;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Conclusion : don&#39;t mix API because you never know about class implementation.&lt;br /&gt;
Fix is simple, just use mText.Empty() or mText[n] to modify string and never (LPTSTR)(mText)[n]</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/8084049054138787843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/8084049054138787843' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/8084049054138787843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/8084049054138787843'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/11/bugs-aligned-to-cstring.html' title='Bugs aligned to CString'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-55175564030347936</id><published>2010-07-24T21:51:00.009-04:00</published><updated>2010-07-24T22:11:29.317-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><category scheme="http://www.blogger.com/atom/ns#" term="embeded"/><category scheme="http://www.blogger.com/atom/ns#" term="Win32"/><category scheme="http://www.blogger.com/atom/ns#" term="WinCE"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Mobile"/><title type='text'>Windows messaging system</title><content type='html'>&lt;b&gt;How I understand windows messaging system&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I have taken a look to MFC, WTL frameworks and desided to explain some moments aligned to window creation and user interaction on Windows API level&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creating &amp;nbsp;a Window&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
To create window in Windows OS you call &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;CreateWindow&lt;/span&gt;(className,...)&lt;br /&gt;
There is a enum of predefined classes&lt;br /&gt;
COMBOBOX,&amp;nbsp;BUTTON,&amp;nbsp;STATIC,&amp;nbsp;LISTBOX and other default classes&lt;br /&gt;
&lt;br /&gt;
As far as thay are already pressent in the system they asosiated with WindowProc. Actually every window class is asociated with windowProc inside OS.&lt;br /&gt;
What is window proc? it is just a function like below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;INT_PTR CALLBACK MyDialog_DialogProc( HWND hwnd,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;UINT messageId,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;WPARAM wParam,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;LPARAM lParam&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
WindowProc is responsible for the window message processing. Thats why BUTTON for example looks like button :) , so to create a dialog not from window resources you need. To understand how OS GUI works lets create a dialog manually and not using resource file for that.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Creating Dialog window not from recources&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;1. register class&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;WNDCLASS wndClass = {0};&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;wndClass.lpfnWndProc = (WNDPROC)MyDialog_DialogProc;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;wndClass.lpszClassName = L&quot;DIALOG&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;ATOM atom = RegisterClass(&amp;amp;wndClass);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;HWND dialogHwnd = CreateWindow(L&quot;DIALOG&quot;, L&quot;MyDlg&quot;, ~WS_DLGFRAME &amp;amp; &amp;nbsp; &amp;nbsp;~WS_CLIPSIBLINGS, 10,10, 200,200, NULL, (HMENU)0, instance, 0);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;2. write a WindowProc&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;INT_PTR CALLBACK MyDialog_DialogProc( HWND hwnd,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;UINT messageId,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;WPARAM wParam,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;LPARAM lParam&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;if (messageId == WM_CREATE)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; // create button&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &amp;nbsp; &amp;nbsp;HINSTANCE hInstance = GetModuleHandle(NULL);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; HWND myButton = CreateWindow(L&quot;BUTTON&quot;, L&quot;ClickMe&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;WS_CHILD, 10,10, 100,20, hwnd&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,(HMENU)1, hInstance,0);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; if (!myButton)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // log error&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ShowWindow(myButton, SW_SHOWNORMAL);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &amp;nbsp; // create othe controls if there is a need!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &amp;nbsp; return TRUE;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;return DefWindowProc( hwnd, &amp;nbsp;messageId, wParam, lParam);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;You can change this default WindowProc and this process is so calling subclassing&lt;br /&gt;
There is a lot of windows messages so if you don&#39;t need (or you don&#39;t want) to process all of them you need to call oldWindowProc to process messages that your new WindowProc doesn&#39;t process&lt;br /&gt;
&lt;br /&gt;
I found that class &quot;DIALOG&quot; is not a default class in windows. This class creates when you are going to create a dialog based on recource file. When you create dialog from recource (using CreateDialog for example) this function register dialog class read resource file read styles inside dialog and raise WM_INITDIALOG and othe windows messages (WM_FONT is GWS_FONT defined) and after that call ShowWindow (if GWS_VISIBLE is defined)&lt;br /&gt;
all this steps is strictly synchronous because SendMessage is sync function.&lt;br /&gt;
How windows looks depends on window class and on windows style&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Message handling&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
As you may know some messages are received in thread queue others processed directly in WindowProc so you will never get WM_SIZE using GetMessage() or similar function&lt;br /&gt;
&lt;br /&gt;
But messages from mouse and keybord will be sent to system queue&lt;br /&gt;
for example for erlier created messages in the same thread we use:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;MSG msg;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;while (GetMessage(&amp;amp;msg,0,0,0))&lt;br /&gt;
{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;TCHAR buffer[MAX_PATH] = {0};&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;TCHAR windowName[MAX_PATH] = {0};&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;GetWindowText( msg.hwnd, windowName, MAX_PATH);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;swprintf(buffer,L&quot;Handle [0x%X] WindowName [%s] Message: [0x%X] \n&quot;,msg.hwnd, windowName , msg.message);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;OutputDebugString(buffer);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;DispatchMessage(&amp;amp;msg);&lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;GetMessage Log:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x0] WindowName [] Message: [0xC0B1]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x0] WindowName [] Message: [0xC0B1]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x60878] WindowName [MyDlg] Message: [0xF] &amp;nbsp;//&amp;nbsp;WM_PAINT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x60870] WindowName [ClickMe] Message: [0xF] &amp;nbsp;//&amp;nbsp;WM_PAINT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B7]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B9]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B9]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B9]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B9]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B9]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Handle [0x6086E] WindowName [CicMarshalWndAJCB] Message: [0xC0B6]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from the log we can see that only WM_PAINT message we receive from GetMessage. Messages with 0 handle are messages not aligned to windows. There is also a&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;CicMarshalWndAJCB&lt;/span&gt;&amp;nbsp;but we didn&#39;t create window with such mane. &lt;b&gt;I created only two windows &quot;ClickMe&quot; and &quot;MyDlg&quot; so what is &quot;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;CicMarshalWndAJCB&quot;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&amp;nbsp;for?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
of cource when I move my mouse to that window I receive all mouse/keyboard input messages like WM_MOUSEMOVE WM_KEYDOWN and othe hardware messages&lt;br /&gt;
&lt;br /&gt;
In &amp;nbsp;the Internet I also could not find any information about that window , so if someone reading this could help, please do&lt;br /&gt;
&lt;br /&gt;
To complete &amp;nbsp;this article I put log in dialog window proc to better understand what messages come &amp;nbsp;first&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;WindowProc Log&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x24] &amp;nbsp;//WM_GETMINMAXINFO&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x81] &amp;nbsp;//WM_NCCREATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x83] &amp;nbsp;//WM_NCCALCSIZE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x1] &amp;nbsp; //WM_CREATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0xD] &amp;nbsp; //WM_GETTEXT my call&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] WindowName [MyDlg] Message: [0x1] //WM_CREATE we receive only one wm create but I put log just to be sure that windowname is MyDlg&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x210] // WM_PARENTNOTIFY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x18] &amp;nbsp;//WM_SHOWWINDOW&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x46] &amp;nbsp;// WM_WINDOWPOSCHANGING&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x46] &amp;nbsp;// WM_WINDOWPOSCHANGING // this call from thread&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x1C] &amp;nbsp;// WM_ACTIVATEAPP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x86] &amp;nbsp;// WM_NCACTIVATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0xD] &amp;nbsp; // WM_GETTEXT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x6] &amp;nbsp; // WM_ACTIVATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x7] &amp;nbsp; // WM_SETFOCUS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x85] &amp;nbsp;// WM_NCPAINT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0xD] &amp;nbsp; // WM_GETTEXT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x14] &amp;nbsp;// WM_ERASEBKGND !! I have handled it&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x47] &amp;nbsp;// WM_WINDOWPOSCHANGED&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x5] &amp;nbsp; // WM_SIZE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x3] &amp;nbsp; // WM_MOVE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x7F] &amp;nbsp;// WM_GETICON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x7F] &amp;nbsp;// WM_GETICON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x7F] &amp;nbsp;// WM_GETICON&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0xF] &amp;nbsp; // WM_PAINT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;Handle [0x3B086A] Message: [0x135] // WM_CTLCOLORBTN ClickMe send this message to parent&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;So this mechanism works very good&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;all other stuff and errors and a lot of complains alligned to higher level of API in user mode. Teoretically it is possible to rewrite user mode API to have very simple and ea sy to use operating system. I think this is might be done by 3rd party vendows that works with Windows CE OS&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/55175564030347936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/55175564030347936' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/55175564030347936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/55175564030347936'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/07/windows-messaging-system.html' title='Windows messaging system'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-6478819326448945169</id><published>2010-07-24T16:44:00.003-04:00</published><updated>2010-07-24T22:07:26.958-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><category scheme="http://www.blogger.com/atom/ns#" term="NDK"/><category scheme="http://www.blogger.com/atom/ns#" term="SDK"/><title type='text'>NDK Android</title><content type='html'>Working in Android in the native level is quite interesting&lt;br /&gt;
&lt;br /&gt;
To start working under Windows platform you need&lt;br /&gt;
&lt;br /&gt;
1. &amp;nbsp;&lt;a href=&quot;http://www.cygwin.com/&quot;&gt;Cygwin&lt;/a&gt; you need version for Windows&lt;br /&gt;
2. Go to &lt;a href=&quot;http://developer.android.com/sdk/index.html&quot;&gt;Android NDK framework&lt;/a&gt; and download NDK, SDK&lt;br /&gt;
3. Install &lt;a href=&quot;http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/heliosr&quot;&gt;Eclipce&lt;/a&gt; and &lt;a href=&quot;http://developer.android.com/sdk/index.html&quot;&gt;ADT&lt;/a&gt; plugin&lt;br /&gt;
&lt;br /&gt;
Also you need JDK 1.5 or 1.6 installed&lt;br /&gt;
To Edit C++ sources you could install &amp;nbsp;&lt;a href=&quot;http://www.eclipse.org/cdt/&quot;&gt;CDT C/C++ plugin Eclipce&lt;/a&gt;&amp;nbsp;or use Microsoft Viusal Studio or &amp;nbsp;&lt;a href=&quot;http://notepad-plus-plus.org/&quot;&gt;Notepad++&lt;/a&gt;&amp;nbsp;with c++ plugin&lt;br /&gt;
&lt;br /&gt;
Also download &lt;a href=&quot;http://pdk.android.com/online-pdk/guide/debugging_native.html&quot;&gt;Android cpp sources&lt;/a&gt;. Using sources as manual you will understand more about what android consist of and will be able to all native library or drivers to extend Android functionality</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/6478819326448945169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/6478819326448945169' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6478819326448945169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6478819326448945169'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/07/ndk-android.html' title='NDK Android'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-283769009001584812</id><published>2010-06-05T11:41:00.006-04:00</published><updated>2010-07-24T22:11:06.689-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Win32"/><category scheme="http://www.blogger.com/atom/ns#" term="WinCE"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="WTL"/><title type='text'>Subclassing child window using WTL</title><content type='html'>To create custom control &amp;nbsp;you may use WM_DRAW_ITEM but this message you will receive in DLGPROC&lt;br /&gt;
So you have to draw control not in his own procedure but in parent one.&lt;br /&gt;
&lt;br /&gt;
To resolve this complexity you can use subclassing with the child control.&lt;br /&gt;
If you are using &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Template_Library&quot;&gt;WTL&lt;/a&gt; - all need to do is create class dediven not from standard WTL controls with other template parameter&lt;br /&gt;
&lt;br /&gt;
For example for ATL::CListBox use&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;class CListBoxEx;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;typedef CWindowImpl&amp;lt; CListBoxEx, CWindow, CControlWinTraits&amp;gt; CMyListBox;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;template &amp;lt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;HWND CListBoxT&lt;cmylistbox&gt;::Create(HWND hWndParent, ATL::_U_RECT rect, LPCTSTR szWindowName,&lt;/cmylistbox&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;         DWORD dwStyle, DWORD dwExStyle,&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;         ATL::_U_MENUorID MenuOrID, LPVOID lpCreateParam)&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;return CMyListBox::Creat&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;e( hWndParent&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt; rect&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, szWindowName&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, dwStyle&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, dwExStyle&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, MenuOrID&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, lpCreateParam);&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;template &amp;lt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;CListBoxT&lt;cmylistbox&gt;::CListBoxT&lt;cmylistbox&gt;(HWND hParentHwnd)&lt;/cmylistbox&gt;&lt;/cmylistbox&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;:CMyListBox()&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;if (::IsWindow(hParentHwnd))&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CMyListBox::SetParent(hParentHwnd);&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;class CListBoxEx :&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt; public CListBoxT&lt;cmylistbox&gt;&lt;/cmylistbox&gt;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
This code allows you create a control and using Subclass-window replace WNDPROC for that control class&lt;br /&gt;
Now we can create or subclass a control &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;class CList_boxDialog :  public CAppStdDialogResizeImpl&lt;clist_boxdialog&gt;,&lt;/clist_boxdialog&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt; public CUpdateUI&lt;clist_boxdialog&gt;,&lt;/clist_boxdialog&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt; public CMessageFilter, public CIdleHandler&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;...&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;LRESULT OnInitDialog(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL&amp;amp; bHandled)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; ..&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; CWindow wnd = GetDlgItem(IDC_LIST_ADAPTERS);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; mListBox.SubclassWindow(wnd);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; mListBox.SetParent(m_hWnd);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; mListBox.ResetContent();&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; mListBox.AddString(_T(&quot;First&quot;));&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; mListBox.AddString(_T(&quot;Second&quot;));&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp; ..&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;..&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;CListBoxEx mListBox;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Code above get controls window handle and WTL replace controls window procedure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should allow all unhandled messages to pass to old WNDPROC to do it just return &#39;false&#39; from &lt;br /&gt;
ProcessWindowMessage()&amp;nbsp;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;in CListBoxEx class:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;BEGIN_MSG_MAP(CListBoxEx)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;MESSAGE_HANDLER(OCM_DRAWITEM, OnDrawItem)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;MESSAGE_HANDLER(OCM_MESUREITEM, OnMesureItem)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;END_MSG_MAP()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Next step is message reflection&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the most difficulties is to follow code in templates&lt;b&gt; ..&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
In your CDialog class you need to reflect all messages so they will be handled in child control class&lt;br /&gt;
to reflect all unhanded messages use&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;class CMyDialog;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;BEGIN_MSG_MAP(CMyDialog)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp; &amp;nbsp;   REFLECT_NOTIFICATIONS()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; CHAIN_MSG_MAP(CAppStdDialogResizeImpl&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;CMyDialog&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;END_MSG_MAP()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now you should be able to receive OCM_XXX and handle them in child control&lt;br /&gt;
&lt;br /&gt;
This trick allow you to hold code in one place and increase portability and reduce time to create applications&lt;br /&gt;
As usual people don&#39;t create GUI in C++ &amp;nbsp;even for Windows CE, Mobile but who knows ;)</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/283769009001584812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/283769009001584812' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/283769009001584812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/283769009001584812'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/06/subclassing-child-control-using-wtl.html' title='Subclassing child window using WTL'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-7749222057515032507</id><published>2010-05-22T18:11:00.006-04:00</published><updated>2010-07-24T22:06:25.452-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><category scheme="http://www.blogger.com/atom/ns#" term="embeded"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="microwindows"/><category scheme="http://www.blogger.com/atom/ns#" term="nano-x"/><title type='text'>Nano-X window system</title><content type='html'>Recently I have worked in Linux environment with a great &lt;a href=&quot;http://www.microwindows.org/&quot;&gt;NanoX project&lt;/a&gt;&lt;br /&gt;
It is about 300k size. NanoX provide solution for timer support, windows management, user input.&lt;br /&gt;
&lt;br /&gt;
To use Nano-X you need only &lt;a href=&quot;http://gcc.gnu.org/&quot;&gt;gcc&lt;/a&gt; c/c++ compiler that it is included in many(most) Linux systems&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Architecture:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_S8lqrI_mZMA/S_hSPnAxYVI/AAAAAAAAC8Y/K7DeZaKTx5k/s1600/nano-x-arch.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_S8lqrI_mZMA/S_hSPnAxYVI/AAAAAAAAC8Y/K7DeZaKTx5k/s320/nano-x-arch.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Features:&lt;/b&gt;&lt;br /&gt;
- message based system&lt;br /&gt;
- small size&lt;br /&gt;
- simple API&lt;br /&gt;
- add/replace any keyboard/mouse/screen driver&lt;br /&gt;
- font support. It is possible to add Unicode TrueType fonts&lt;br /&gt;
&lt;br /&gt;
Lets discuss how to use it:&lt;br /&gt;
&lt;br /&gt;
To create nano-X window you need :&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;#include &lt;nano-x.h&gt;&amp;nbsp;&quot;nano-x.h&quot;&lt;nano-x.h&gt;&lt;/nano-x.h&gt;&lt;/nano-x.h&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;int main(int argv, char[][] argv)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;GR_WINDOW_ID wnd =&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;GrNewWindow( GR_ROOT_WINDOW_ID&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , 0,0,100,100&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , WINDOW_NO_BORDER&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , FOREGROUND_COLOR&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;BLACKGROUND_COLOR)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;; // create a window&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;&amp;nbsp;       gc = GrNewGC(); // create a graphic context&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;//select events. you are able to select&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;//only that events that you need. this will boost your application &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;       GrSelectEvents( &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;wnd&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;, GR_EVENT_MASK_ALL);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;GrMapWindow( &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;wnd&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; ); // show window&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;// you may create as many windows as you wish&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;// there is only one message queue for all Nano-X windows&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;   &amp;nbsp;GR_EVENT anEvent;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;while (true)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; &amp;nbsp; &amp;nbsp;GrCheckNextEvent(&amp;amp;anEvent);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (anEvent.type == GR_EVENT_TYPE_NONE )&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sleep(1);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;continue;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if (HandleEvent(anEvent) == NEED_TO_EXIT) break;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;// close all handles and exit&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp;  &amp;nbsp;GrUnmapWindow(wnd); // hide window&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; &amp;nbsp;  &amp;nbsp;GrDestroyGC( gc ); //&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt; &amp;nbsp;  &amp;nbsp;GrDestroyWindow( wnd );&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now you might understand nano-x weak side:&amp;nbsp;   &lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Messages might not be synchronized. ( for example when you kill window but some messages that was in queue might come)&lt;/li&gt;
&lt;li&gt;Timer messages might not work proper under some circumstances &amp;nbsp;(for example when you create a timer event, then change time in your system)&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Pure focus management (for example you can use GrSetFocus() then destroy window and then GrGetFocus() doesn&#39;t return you focus to a parent window like it is in MS Window OS,&lt;/li&gt;
&lt;li&gt;Font support is available but you have to dig into sources to add it.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/7749222057515032507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/7749222057515032507' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/7749222057515032507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/7749222057515032507'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/05/linux-nano-x.html' title='Nano-X window system'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_S8lqrI_mZMA/S_hSPnAxYVI/AAAAAAAAC8Y/K7DeZaKTx5k/s72-c/nano-x-arch.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-1455368442894396982</id><published>2010-04-10T05:26:00.003-04:00</published><updated>2010-07-24T22:07:06.520-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="IPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="SDK"/><title type='text'>iPhone SDK</title><content type='html'>Yesterday, I start investigating IPhone SDK&lt;br /&gt;
there are few links that may help to start developing&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html&quot;&gt;MAC OS reference library&lt;/a&gt; SDK and framework&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.gnustep.org/experience/Windows.html&quot;&gt;Objective C /C/C++ &amp;nbsp;compiler&lt;/a&gt; for windows platform</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/1455368442894396982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/1455368442894396982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1455368442894396982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/1455368442894396982'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/04/iphone-sdk.html' title='iPhone SDK'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-171636962962714690</id><published>2010-03-28T19:43:00.006-04:00</published><updated>2017-08-10T01:54:33.048-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="SDK"/><category scheme="http://www.blogger.com/atom/ns#" term="Yii framework"/><title type='text'>Yii framework</title><content type='html'>Not so long time ago I have learned php5 &lt;a href=&quot;http://www.blogger.com/&quot;&gt;Yii framework&lt;/a&gt;&lt;br /&gt;
It is quite simple and well documented &lt;a href=&quot;http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller&quot;&gt;MVC&lt;/a&gt; &amp;nbsp;framework&lt;br /&gt;
I like it!&lt;br /&gt;
&lt;br /&gt;
So why I think it will be popular?&lt;br /&gt;
because it is easy to use.. and it is free&lt;br /&gt;
Here is &amp;nbsp;few the most important features for me&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;Localization&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
first of all I pay attention to frameworks localization&lt;br /&gt;
only one static function &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Yii::t(&quot;section&quot;, &quot;string&quot;)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;Security&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
It is very important to have only one entry point for all user requests&lt;br /&gt;
in this case you can wrap this entry with security patterns and framework itself already did it for you&lt;br /&gt;
&lt;br /&gt;
All requests have the same entry for example&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;http://mysite.com/index.php?r=action&amp;amp;...&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
of cause you are able to create more attractive requests like&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;http://mysite.com/home/livingroom&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;http://mysite.com/2010/09/01/school&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
there is a trick.. all this urls redirect your request to one php file. remove php file entry name like &quot;index.php&quot; is done using .htaccess or if you are able to configure apache yourself it is could be done in *.conf file&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;b&gt;Database&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;You are able to request data&amp;nbsp; from database even if you don&#39;t know sql and even if you are not sure what database is installed on you web server. I mean code that Yii framework produces is working with any sql database platform (MySQL, PostageSQL, SQLite or other PDO php extention.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
As results of the request it returns associative array and all other low-level stuff framework hides inside.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;b&gt;Widgets and Components&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Widgets is a way to reuse you code - very powerful thing&lt;br /&gt;
&lt;br /&gt;
I am not going to describe all Yii features, there is a manual for that</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/171636962962714690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/171636962962714690' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/171636962962714690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/171636962962714690'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/03/yii-framework.html' title='Yii framework'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-554923404292528314</id><published>2010-03-19T20:08:00.004-04:00</published><updated>2013-07-11T00:50:15.572-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Android Streaming Audio</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Android audio framework&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;I will try to explain as detailed as possible about streaming audio in android. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;For this purposes in SDK 1.5 has been added AudioRecord and AudioTrack classes. &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;AudioRecord is responsible to get samples from microphone and AudioTrack is responsible for playback samples.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;This classes works only with PCM encoded data (it means that they are not encoded at all :)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Examples:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Play one buffer loop&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Initialzation&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;AudioRecord record = null;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt; AudioTrack track = null;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;record = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; AudioFormat.CHANNEL_CONFIGURATION_MONO,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; AudioFormat.ENCODING_PCM_16BIT,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; AudioRecord.getMinBufferSize(8000, &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT) * 4&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; );&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;   log.d(&quot;AudioTrack min buffer size: &quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;     + AudioTrack.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;       AudioFormat.ENCODING_PCM_16BIT));&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;   track = new AudioTrack(AudioManager.STREAM_VOICE_CALL, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;     AudioFormat.ENCODING_PCM_16BIT, AUDIO_SYSTEM_BUFFER_SIZE, AudioTrack.MODE_STREAM);&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Initialization is quite simple. All you have to do is to create AudioRecord and AudioTrack&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Start audio player&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;track.play();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;

&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Start audio recorder&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;record.startRecording();&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Main Loop&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;while (needMoreAudioData)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;recorder.read(buffer, bufferSize);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;player.write(buffer, bufferSize);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Stop audio&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;player/recorder&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;track.stop();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;record.stop();&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Remove player&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Because this objects works with system resources developer has to release them when they are not in use. Java garbage collector will not release them automatically because instances hold system handlers.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;track.release();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;record.release();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #351c75;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Hope you have got the idea ...&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;Now few practical tips&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;When you call &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;record.startRecording();&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt; &amp;nbsp;recording is already started! and to reduce latency you have to read that data immediately.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;You should realize that android is not a real-time operating system and often call backs come not exactly at certain. You will end-up with increased latency over time unless you apply a sort of throttling algorithm to adjust playback side.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/554923404292528314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/554923404292528314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/554923404292528314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/554923404292528314'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2010/03/android-streaming-audio.html' title='Android Streaming Audio'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-5759877566185919225</id><published>2009-03-25T04:40:00.001-04:00</published><updated>2010-04-19T04:14:40.046-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="API"/><category scheme="http://www.blogger.com/atom/ns#" term="COM"/><category scheme="http://www.blogger.com/atom/ns#" term="Delphi"/><category scheme="http://www.blogger.com/atom/ns#" term="Sintral"/><category scheme="http://www.blogger.com/atom/ns#" term="STOLL"/><category scheme="http://www.blogger.com/atom/ns#" term="Win32"/><title type='text'>Sintral IDE</title><content type='html'>Hello All,&lt;br /&gt;
I decided to delay all my own projects and ideas to finish &lt;a href=&quot;http://sites.google.com/site/odanchuk/&quot;&gt;Sintral IDE project&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
this is a program for STOLL knitting machine. From the first glance it looks like&amp;nbsp;very simple VB language&amp;nbsp;but also it is quite specific.&lt;br /&gt;
I&#39;ve start this project for all old STOLL machines. they are still working bug they didn&#39;t have support by vendors. Software for them was created in 80-90s. Once I was able to see &lt;a href=&quot;http://www.stoll.com/&quot;&gt;STOLL&lt;/a&gt; program for windows 95.&lt;br /&gt;
&lt;br /&gt;
My friend ask me started this project... and I agreed :)&lt;br /&gt;
&lt;br /&gt;
Features that are already done:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;- BMP to TXT image converter&lt;/li&gt;
&lt;li&gt;- TXT to BMP converter&lt;/li&gt;
&lt;li&gt;- Sintral highlighter&lt;/li&gt;
&lt;li&gt;- export to MS Word&lt;/li&gt;
&lt;li&gt;- Pack/Unpack big Jackards&lt;/li&gt;
&lt;li&gt;- Line, Rectangle, Normal selection&lt;/li&gt;
&lt;li&gt;- Renumeration lines&lt;/li&gt;
&lt;li&gt;- Syntax check&lt;/li&gt;
&lt;li&gt;- STOLL communication via com port (read, write, erase)&lt;/li&gt;
&lt;li&gt;- Language pack (russian, english)&lt;/li&gt;
&lt;li&gt;- Add/remove external tools in programs menu&lt;/li&gt;
&lt;li&gt;- Users help&lt;/li&gt;
&lt;/ul&gt;I&#39;ve translated all sources to Delphi 2009 Unicode version&lt;br /&gt;
Also I remove 3rd party component UniHighlighter and wrote a plugin component for UniSyn to highlight a sin language. I could not compile UniHighlighter in 30 minutes so I decided to drop this component down and remove from future using.&lt;br /&gt;
If you are the one who needs this application, please contact me over email or send me request &lt;a href=&quot;http://sites.google.com/site/odanchuk/&quot;&gt;here&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/5759877566185919225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/5759877566185919225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/5759877566185919225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/5759877566185919225'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2009/03/sintral-ide.html' title='Sintral IDE'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-5628120059992641312</id><published>2009-01-31T19:24:00.001-05:00</published><updated>2009-07-24T19:15:45.045-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="camera"/><category scheme="http://www.blogger.com/atom/ns#" term="canon"/><title type='text'>Canon A540 camera problem</title><content type='html'>&lt;p&gt;Hi there&lt;/p&gt;&lt;p&gt;I&#39;d like to talk about files...&lt;/p&gt;&lt;p&gt;I have a camera Canon A540 and when I get files to PC, they have name like img_XXXX&lt;number&gt;.jpg&lt;p p=&quot;&quot; p=&quot;&quot; p=&quot;&quot;&gt;this is bad name for image because there is no information in the name. It doesn&#39;t contain when and where the photo was taken.&lt;p p=&quot;&quot; p=&quot;&quot;&gt;Other problem occurs when I try to remove some small defects (red ayes for example) I am losing last modification date and then I don&#39;t know when the photo was taken&lt;p p=&quot;&quot; p=&quot;&quot;&gt;If my camera is more smart I won&#39;t have this problem&lt;p p=&quot;&quot;&gt;So I decided to create a console application for changing file name. And the main task was to add date, time and prefix to filename. Sure I understand that if I change filename the last file  modification date would be changed. So I add a file description to do reverse operation if there is a need.&lt;p p=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p p=&quot;&quot;&gt;Finally I have finished the program. It was not difficult to implement but I have no free time for that game.&lt;/p&gt;&lt;p p=&quot;&quot;&gt;So about program:&lt;/p&gt;&lt;p p=&quot;&quot;&gt;NameChanger - if you need one just mail me&lt;/p&gt;&lt;p p=&quot;&quot;&gt;You should use program with arguments:&lt;/p&gt;&lt;p p=&quot;&quot;&gt;-r - recursive search in sub-folders&lt;/p&gt;&lt;p p=&quot;&quot;&gt;-d -t - rename fonded file and insert date and time in file name&lt;/p&gt;&lt;p p=&quot;&quot;&gt;-pimg - insert prefix img in file name so all you files will start from this prefix. it is convinient when you just download photos from camera and wanted a prefix (for example: my_summer_holidays )&lt;/p&gt;&lt;p p=&quot;&quot;&gt;-ejpg - rename files only with jpg extension&lt;/p&gt;&lt;p p=&quot;&quot;&gt;-iimg - ignore files started with &quot;img&quot;&lt;/p&gt;&lt;p p=&quot;&quot;&gt;So in general you could use this command tool like bellow:&lt;/p&gt;&lt;p p=&quot;&quot;&gt;NameChanger.exe -d -t -r -pparty -ejpg&lt;/p&gt;&lt;p p=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p p=&quot;&quot;&gt;I have used it and noticed that some files have the same file modify date and time. In this case NameChanger add a letter to the resulted name. For example if you have three files with the same date and time then you will have &lt;/p&gt;&lt;p p=&quot;&quot;&gt;summer_2009_06_01_13_27_10.jpg&lt;/p&gt;&lt;p p=&quot;&quot;&gt;summer_2009_06_01_13_27_10A.jpg&lt;/p&gt;&lt;p p=&quot;&quot;&gt;summer_2009_06_01_13_27_10B.jpg&lt;/p&gt;&lt;p p=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/5628120059992641312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/5628120059992641312' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/5628120059992641312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/5628120059992641312'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2009/01/canon-camera-problem.html' title='Canon A540 camera problem'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-6177818469552279162</id><published>2008-10-31T22:55:00.001-04:00</published><updated>2017-08-10T01:49:09.857-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Mobile"/><title type='text'>Windows Mobile API ToolBar</title><content type='html'>Today I&#39;d like to make some suggestion about CCommandBar class for Windows Mobile 5.0. &lt;br /&gt;
You can use MFC menu wrapper class or you can use Windows WINAPI function to get access to the ToolBar&lt;br /&gt;
&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5362168178831076594&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhlILd2bjWzcAtuTxfju7ADyfmi0rXcEvk3_CBmPvOvt0ky_J7vqPHodpxuRp5GEdDO8wIsNS9OZCUGo6Dl4cfGRemp310Xstm8XElWBB1dXazmx8r0IoL99qROjrfvsoFuvhDJscIFE/s400/toolbar.PNG&quot; style=&quot;cursor: hand; cursor: pointer; display: block; height: 29px; margin: 0px auto 10px; text-align: center; width: 241px;&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
MFC class CCommandBar class has no API to access to menu items and doesn&#39;t know how to control the menu. After a brief investigation and experiments with the menu I have got a working code:&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;TBBUTTON tbb;&lt;br /&gt;
&amp;nbsp;::SendMessage(m_oCommandBar.GetSafeHwnd(),&amp;nbsp; &amp;nbsp; &amp;nbsp;TB_GETBUTTON, 1, (LPARAM)&amp;amp;tbb);&lt;br /&gt;
&amp;nbsp;HMENU hMenu=HMENU(tbb.dwData);&lt;br /&gt;
&amp;nbsp;if(hMenu)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; ::DeleteMenu(hMenu,0,MF_BYPOSITION);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;::InsertMenu(hMenu,0,MF_BYPOSITION, ID_MENU_FR_SHOWDETAILS, L&quot;Show Details&quot;); &lt;br /&gt;
&amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here m_oCommandBar is an instance of CCommandBar. By using windows messages you can access to WINAPI menu and create a dynamic menus :-)</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/6177818469552279162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/6177818469552279162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6177818469552279162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6177818469552279162'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2008/10/windows-mobile-api-toolbar.html' title='Windows Mobile API ToolBar'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhlILd2bjWzcAtuTxfju7ADyfmi0rXcEvk3_CBmPvOvt0ky_J7vqPHodpxuRp5GEdDO8wIsNS9OZCUGo6Dl4cfGRemp310Xstm8XElWBB1dXazmx8r0IoL99qROjrfvsoFuvhDJscIFE/s72-c/toolbar.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-9123624742429275567</id><published>2008-10-09T10:12:00.000-04:00</published><updated>2017-08-10T01:44:04.227-04:00</updated><title type='text'>WMI database</title><content type='html'>Hi there !&lt;br /&gt;
I&#39;d like to tell you about WMI&lt;br /&gt;
It&#39;s a pretty huge database with common API to access to the hardware/software information&lt;br /&gt;
It contains different information about operating system and hardware. For example computer name, TCP/IP address, DNS, and DHCP information and many other keys that are necessary for normal working.&lt;br /&gt;
Also, I notice that it builds as a COM service and it is available from different languages C++, C, Pascal, Visual Basic and scripts such as VBScript. &lt;br /&gt;
According to C++ to invoke a method we need to do a lot of work. So I show you how to use:&lt;br /&gt;
I have created two classes: first is for reading properties, second to invoke methods.&lt;br /&gt;
WMI divided to several groups and each group contain classes:&lt;br /&gt;
For example Network group contains NetworkAdapter, NetworkAdapterConfigurator&lt;br /&gt;
It&#39;s not a c++ classes. Actually, it is a description of the class which you can use with not C++ languages.</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/9123624742429275567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/9123624742429275567' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/9123624742429275567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/9123624742429275567'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2008/10/wmi-database.html' title='WMI database'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-6173449810238715161</id><published>2008-09-23T11:55:00.002-04:00</published><updated>2017-08-10T01:40:15.093-04:00</updated><title type='text'>small annoying bugs :-(</title><content type='html'>Sometimes when you debugging a code, You don&#39;t expect a bug in project settings and you may spend hours to find it.&lt;br /&gt;
&lt;br /&gt;
Here is some suggestions that may help you with it.&lt;br /&gt;
This is applicable to mobile development:&lt;br /&gt;
&lt;br /&gt;
1. All resources line memory allocation, files, etc., you need to put in a wrapper: shared_ptr&lt;pointer&gt; myPointer(rawPointer)&lt;/pointer&gt;&lt;br /&gt;
&lt;br /&gt;
2. All unexpected behavior line &quot;low memory&quot; should throw an exception and exit.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;class MyDataBlock&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;char* mData;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;public:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;MyDataBlock():mData(NULL){}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;MyDataBlock():mData(int size)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ASSERT(size&amp;gt;0,&quot;wrong size&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; mData = new char[size];&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ASSERT(mData,&quot;low memory&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;~MyDataBlock()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; delete[] mData;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
3. Logs&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;developer logs - you must have them if there is no way to run application in debug mode. This is more applicable to OS driver development or other specific domain development.&lt;/li&gt;
&lt;li&gt;when exception happen try to log stack. When application crashes it is very useful to have function calls stack.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/6173449810238715161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/6173449810238715161' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6173449810238715161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/6173449810238715161'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2008/09/small-annoying-bugs.html' title='small annoying bugs :-('/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-679565523368883189</id><published>2008-07-31T15:39:00.002-04:00</published><updated>2017-08-10T01:29:58.921-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C/C++"/><title type='text'>Factorial calculation</title><content type='html'>Hello everyone!&lt;br /&gt;
Yesterday, I have implemented program that calculates 2347!.&lt;br /&gt;
That is the same as 1*2*...*2347&lt;br /&gt;
It is &amp;nbsp;really big number that holds 10000 digits&lt;br /&gt;
I will publish it in the next posts.

One thing I observed is: I like creating really compact programs...</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/679565523368883189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/679565523368883189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/679565523368883189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/679565523368883189'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2008/07/factorial-calculation.html' title='Factorial calculation'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-795782098978159916</id><published>2008-07-22T18:44:00.000-04:00</published><updated>2017-08-10T01:14:02.110-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="drivers"/><title type='text'>User activity</title><content type='html'>I&#39;d like to create a user activity driver&lt;br /&gt;
&lt;br /&gt;
It will have two modes:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;in the first mode, it collects data from the user (mouse and keyboard) and store them to a local file&lt;/li&gt;
&lt;li&gt;in the second mode, it reproduces data from the file so we could have a very small sized video demonstration.&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/795782098978159916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/795782098978159916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/795782098978159916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/795782098978159916'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2008/07/what-about-user-activity.html' title='User activity'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-254517917119511180.post-8353538829307595399</id><published>2008-07-17T09:41:00.000-04:00</published><updated>2017-08-10T01:23:50.178-04:00</updated><title type='text'>Folder monitor</title><content type='html'>I&#39;d like to implement folder monitor. I think it should be easy because there is a Win32 API to do this.&lt;br /&gt;
&lt;br /&gt;
Also, I could do this via driver...

</content><link rel='replies' type='application/atom+xml' href='http://odanchuk.blogspot.com/feeds/8353538829307595399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/254517917119511180/8353538829307595399' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/8353538829307595399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/254517917119511180/posts/default/8353538829307595399'/><link rel='alternate' type='text/html' href='http://odanchuk.blogspot.com/2008/07/folder-monitor.html' title='Folder monitor'/><author><name>Oleksandr</name><uri>http://www.blogger.com/profile/06068713102707640380</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>