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

<channel>
	<title>Code Library &#187; hamo</title>
	<atom:link href="http://www.ucosoft.com/author/hamo/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ucosoft.com</link>
	<description>Free Source Code and Program Tips</description>
	<lastBuildDate>Thu, 22 Jul 2010 05:17:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to get the local DNS server record</title>
		<link>http://www.ucosoft.com/how-to-get-the-local-dns-server-record.html</link>
		<comments>http://www.ucosoft.com/how-to-get-the-local-dns-server-record.html#comments</comments>
		<pubDate>Wed, 03 Jan 2007 07:48:42 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[How-to]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/62.html</guid>
		<description><![CDATA[If you don&#8217;t have Iphlpapi.lib installed, you can retrieve the local DNS server in the following way. The main step is load &#8220;Iphlpapi.dll&#8221; with ::LoadLibary method and call ::GetProcAddress to get the &#8220;GetNetworkParams&#8221;. Here is the full source: #include &#8220;stdafx.h&#8221; #include #include #define MAX_HOSTNAME_LEN 128 #define MAX_DOMAIN_NAME_LEN 128 #define MAX_SCOPE_ID_LEN 256 typedef struct _IP_ADDR_STRING { [...]]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t have Iphlpapi.lib installed, you can retrieve the local DNS server in the following way.</p>
<p>The main step is load &#8220;Iphlpapi.dll&#8221; with <b>::LoadLibary</b> method and call <b>::GetProcAddress</b> to get the &#8220;GetNetworkParams&#8221;.</p>
<p>Here is the full source:</P><br />
<span id="more-62"></span><br />
<coolcode lang="cpp" linenum="no" download="GetDns.cpp"><br />
#include &#8220;stdafx.h&#8221;<br />
#include <stdio.h><br />
#include <windows.h></p>
<p>#define MAX_HOSTNAME_LEN     128<br />
#define MAX_DOMAIN_NAME_LEN  128<br />
#define MAX_SCOPE_ID_LEN     256</p>
<p>typedef struct _IP_ADDR_STRING {<br />
        struct _IP_ADDR_STRING* Next;<br />
        BYTE IpAddress[16];<br />
        BYTE IpMask[16];<br />
        DWORD Context;<br />
}IP_ADDR_STRING, *PIP_ADDR_STRING;</p>
<p>typedef struct {<br />
        char HostName [MAX_HOSTNAME_LEN + 4] ;<br />
        char DomainName [MAX_DOMAIN_NAME_LEN + 4] ;<br />
        PIP_ADDR_STRING CurrentDnsServer ;<br />
        IP_ADDR_STRING DnsServerList ;<br />
        UINT NodeType ;<br />
        char ScopeId [MAX_SCOPE_ID_LEN + 4] ;<br />
        UINT EnableRouting ;<br />
        UINT EnableProxy ;<br />
        UINT EnableDns ;<br />
} FIXED_INFO, *PFIXED_INFO ;</p>
<p>typedef  DWORD  (__stdcall *pGetNetworkParams)(PFIXED_INFO,PULONG);</p>
<p>int main()<br />
{<br />
        FIXED_INFO     *  FixedInfo;<br />
        ULONG             ulOutBufLen;<br />
        HINSTANCE         hIphlpapiDll;<br />
        pGetNetworkParams  p;</p>
<p>        __try<br />
        {<br />
                hIphlpapiDll=::LoadLibrary(&#8220;Iphlpapi.dll&#8221;);<br />
                p=(pGetNetworkParams)::GetProcAddress(hIphlpapiDll,<br />
&#8220;GetNetworkParams&#8221;);</p>
<p>        FixedInfo = (FIXED_INFO *) GlobalAlloc( GPTR, sizeof( FIXED_INFO ) );<br />
        ulOutBufLen = sizeof( FIXED_INFO );</p>
<p>                if( ERROR_BUFFER_OVERFLOW ==(*p)( FixedInfo, &#038;ulOutBufLen ) )<br />
                {<br />
                GlobalFree( FixedInfo );<br />
                FixedInfo = (FIXED_INFO *)GlobalAlloc( GPTR, ulOutBufLen );<br />
                }</p>
<p>                (*p)( FixedInfo, &#038;ulOutBufLen );</p>
<p>                printf( &#8220;Host Name: %s\n&#8221;, FixedInfo->HostName );<br />
                printf( &#8220;DNS Servers: %s\n&#8221;,FixedInfo->DnsServerList.IpAddress )<br />
;</p>
<p>        }<br />
        __except( EXCEPTION_EXECUTE_HANDLER){}<br />
        ::FreeLibrary(hIphlpapiDll);<br />
    ::GlobalFree( FixedInfo );<br />
    return 1;<br />
}<br />
</coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/api" title="API" rel="tag">API</a>, <a href="http://www.ucosoft.com/tag/dns" title="DNS" rel="tag">DNS</a>, <a href="http://www.ucosoft.com/tag/how-to" title="How-to" rel="tag">How-to</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/how-to-get-the-local-dns-server-record.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MessageBox support Ctrl+C to copy content</title>
		<link>http://www.ucosoft.com/65.html</link>
		<comments>http://www.ucosoft.com/65.html#comments</comments>
		<pubDate>Mon, 01 Jan 2007 08:26:36 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[MessageBox]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/65.html</guid>
		<description><![CDATA[It&#8217;s a good trick. From windows 2000, when a MessageBox popped out, you can use Ctrl+C to copy the content of the MessageBox window to the clipboard. It is a very interesting trick, and it is very usrful to share the information easily. The condition is only that the MessageBox window was created by MessageBoxA/MessageBoxW [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a good trick. From windows 2000, when a MessageBox popped out, you can use Ctrl+C to copy the content of the MessageBox window to the clipboard. It is a very interesting trick, and it is very usrful to share the information easily.</p>
<p>The condition is only that the MessageBox window was created by MessageBoxA/MessageBoxW from the win32 api. Whether you call AfxMessageBox or CWnd::MessageBox in vc or MsgBox in vb, they finally call the ::MessageBoxA or ::MessageBoxW, so it also works.</p>
<p>Here is a example.</p>
<p>1. When some message box popped, press Ctrl+C to copy.</p>
<p><img id="image64" style="width: 282px; height: 139px" height="139" alt="msgbox1.PNG" src="http://www.ucosoft.com/wp-content/uploads/2007/01/msgbox1.PNG" width="282" /></p>
<p>2. Paste in notepad, and you will see&#8230;<br />
<span id="more-65"></span><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Notepad<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
The text in the Untitled file has changed.<br />
Do you want to save the changes?<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Yes No Cancel<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/messagebox" title="MessageBox" rel="tag">MessageBox</a>, <a href="http://www.ucosoft.com/tag/tips" title="Tips" rel="tag">Tips</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/65.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to read the graphics card RAM capacity</title>
		<link>http://www.ucosoft.com/how-to-read-the-graphics-card-ram-capacity.html</link>
		<comments>http://www.ucosoft.com/how-to-read-the-graphics-card-ram-capacity.html#comments</comments>
		<pubDate>Tue, 19 Dec 2006 07:43:32 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[How-to]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/61.html</guid>
		<description><![CDATA[When you want to get the RAM capacity of the graphics card installed on the computer, It&#8217;s more simple to use WMI class. You can give a look at the AdapterRAM attribute of Win32_VideoController. The Win32_VideoController WMI class represents the capabilities and management capacity of the video controller. AdapterRAM is one of its attibute: AdapterRAM [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to get the RAM capacity of the graphics card installed on the computer, It&#8217;s more simple to use <a href="http://www.ucosoft.com/archives/60.html">WMI class</a>.</p>
<p>You can give a look at the AdapterRAM attribute of Win32_VideoController.</p>
<p>The Win32_VideoController <a href="http://www.ucosoft.com/archives/60.html">WMI class</a> represents the capabilities and management capacity of the video controller. AdapterRAM is one of its attibute:</p>
<p><coolcode linenum="no"><br />
AdapterRAM<br />
Data type: uint32<br />
Access type: Read-only<br />
Qualifiers: Units(Bytes)<br />
Memory size of the video adapter. </p>
<p>Example: 64000<br />
</coolcode></p>
<p>The full syntax is listed here:</p>
<p><span id="more-61"></span><br />
<coolcode lang="cpp" linenum="no"><br />
class Win32_VideoController : CIM_PCVideoController<br />
{<br />
  uint16 AcceleratorCapabilities[]  ;<br />
  string AdapterCompatibility  ;<br />
  string AdapterDACType  ;<br />
  uint32 AdapterRAM  ;<br />
  uint16 Availability  ;<br />
  string CapabilityDescriptions[]  ;<br />
  string Caption  ;<br />
  uint32 ColorTableEntries  ;<br />
  uint32 ConfigManagerErrorCode  ;<br />
  boolean ConfigManagerUserConfig  ;<br />
  string CreationClassName  ;<br />
  uint32 CurrentBitsPerPixel  ;<br />
  uint32 CurrentHorizontalResolution  ;<br />
  uint64 CurrentNumberOfColors  ;<br />
  uint32 CurrentNumberOfColumns  ;<br />
  uint32 CurrentNumberOfRows  ;<br />
  uint32 CurrentRefreshRate  ;<br />
  uint16 CurrentScanMode  ;<br />
  uint32 CurrentVerticalResolution  ;<br />
  string Description  ;<br />
  string DeviceID  ;<br />
  uint32 DeviceSpecificPens  ;<br />
  uint32 DitherType  ;<br />
  datetime DriverDate  ;<br />
  string DriverVersion  ;<br />
  boolean ErrorCleared  ;<br />
  string ErrorDescription  ;<br />
  uint32 ICMIntent  ;<br />
  uint32 ICMMethod  ;<br />
  string InfFilename  ;<br />
  string InfSection  ;<br />
  datetime InstallDate  ;<br />
  string InstalledDisplayDrivers  ;<br />
  uint32 LastErrorCode  ;<br />
  uint32 MaxMemorySupported  ;<br />
  uint32 MaxNumberControlled  ;<br />
  uint32 MaxRefreshRate  ;<br />
  uint32 MinRefreshRate  ;<br />
  boolean Monochrome  ;<br />
  string Name  ;<br />
  uint16 NumberOfColorPlanes  ;<br />
  uint32 NumberOfVideoPages  ;<br />
  string PNPDeviceID  ;<br />
  uint16 PowerManagementCapabilities[]  ;<br />
  boolean PowerManagementSupported  ;<br />
  uint16 ProtocolSupported  ;<br />
  uint32 ReservedSystemPaletteEntries  ;<br />
  uint32 SpecificationVersion  ;<br />
  string Status  ;<br />
  uint16 StatusInfo  ;<br />
  string SystemCreationClassName  ;<br />
  string SystemName  ;<br />
  uint32 SystemPaletteEntries  ;<br />
  datetime TimeOfLastReset  ;<br />
  uint16 VideoArchitecture  ;<br />
  uint16 VideoMemoryType  ;<br />
  uint16 VideoMode  ;<br />
  string VideoModeDescription  ;<br />
  string VideoProcessor  ;<br />
};<br />
</coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/api" title="API" rel="tag">API</a>, <a href="http://www.ucosoft.com/tag/hardware" title="hardware" rel="tag">hardware</a>, <a href="http://www.ucosoft.com/tag/how-to" title="How-to" rel="tag">How-to</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/how-to-read-the-graphics-card-ram-capacity.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Retrieving a class and WMI class</title>
		<link>http://www.ucosoft.com/retrieving-a-class-and-wmi-class.html</link>
		<comments>http://www.ucosoft.com/retrieving-a-class-and-wmi-class.html#comments</comments>
		<pubDate>Mon, 18 Dec 2006 02:48:32 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/60.html</guid>
		<description><![CDATA[Note: This a part from MSDN, just for self refference. The copyright is handled by Microsoft. The first type of object you can retrieve is a WMI class. When retrieving a WMI class, you actually retrieve a class definition: that is, a listing of the properties, qualifiers, and methods that fully describe the class. However, [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Note: This a part from <a href="http://msdn.microsoft.com" rel="nofollow">MSDN</a>, just for self refference. The copyright is handled by Microsoft.</em></strong> </p>
<p>The first type of object you can retrieve is a WMI class. When retrieving a WMI class, you actually retrieve a class definition: that is, a listing of the properties, qualifiers, and methods that fully describe the class. However, a class definition is for all purposes the class itself.</p>
<p><strong>To retrieve a class definition in VBScript</strong> </p>
<p>You can retrieve the class definition with the VBScript call <b>GetObject</b>, but do not specify a specific instance in the object path for the class.  </p>
<p>The following code example retrieves the class definition for the class that describes logical drives on your computer. For information on the defaults that are being used, see <strong>Using Defaults for More Concise Code</strong>. </p>
<p>Visual Basic and VBScript support the following syntax:<br />
<coolcode lang="vbs" linenum="no"><br />
Set objinst = GetObject(&#8220;WinMgmts:Win32_LogicalDisk&#8221;)<br />
</coolcode></p>
<p>Windows Script Host also supports:<br />
<coolcode lang="xml" linenum="no"><br />
<OBJECT id="myLocator" progid="WbemScripting.SWbemLocator"></OBJECT><br />
</coolcode><br />
<span id="more-60"></span></p>
<p>A class or instance can also be specified, in which case the returned object is a WMI object rather than a services object. </p>
<p>The <b>GetObject</b> function provided by VBScript and JScript cannot be used when running scripts embedded within an HTML page, as MicrosoftÂ® Internet Explorer disallows the use of this call for security reasons. This function also cannot be used to create an instance of the &#8220;generic&#8221; object <b>SWbemObject</b>.<P></P><br />
<strong>To retrieve a class definition in C++</strong></p>
<p>Call the <b>IWbemServices::GetObject</b> or <b>IWbemServices::GetObjectAsync</b> methods to retrieve the definition of a class. </p>
<p>A single class can have multiple class definitions, usually when you have more than one class provider loaded into a single namespace. When a class has multiple class definitions, WMI returns the first definition discovered and the WBEM_S_DUPLICATE_OBJECTS status code.</p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/script" title="Script" rel="tag">Script</a>, <a href="http://www.ucosoft.com/tag/wmi" title="WMI" rel="tag">WMI</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/retrieving-a-class-and-wmi-class.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple code to create an EMF or Bitmap file from existed draw code</title>
		<link>http://www.ucosoft.com/simple-code-to-create-an-emf-or-bitmap-file-from-existed-draw-code.html</link>
		<comments>http://www.ucosoft.com/simple-code-to-create-an-emf-or-bitmap-file-from-existed-draw-code.html#comments</comments>
		<pubDate>Sun, 17 Dec 2006 02:04:30 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[emf]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/58.html</guid>
		<description><![CDATA[We often need to create an Enhanced Meta File(EMF) or Bitmap(bmp) from an existed DC draw code. It&#8217;s not very difficult but it&#8217;s boring to code again and again. The following is a simple solution, what you need to do is only to implement an IPicDrawer and call DrawEnhMeta or DrawBitmap function. struct IPicDrawer { [...]]]></description>
			<content:encoded><![CDATA[<p>We often need to create an Enhanced Meta File(EMF) or Bitmap(bmp) from an existed DC draw code. It&#8217;s not very difficult but it&#8217;s boring to code again and again.<br />
The following is a simple solution, what you need to do is only to implement an <strong>IPicDrawer</strong> and call <strong>DrawEnhMeta</strong> or <strong> DrawBitmap</strong> function.</p>
<p><span id="more-58"></span><br />
<!--adsense--><br />
<coolcode lang="cpp" linenum="no" download="demo_src.cpp"><br />
struct IPicDrawer<br />
{<br />
  virtual void GetSize(CSize&#038;) = 0; // It&#8217;s the smallest size for EMF<br />
  virtual BOOL Draw(CDC*) = 0;<br />
};</p>
<p>BOOL DrawEnhMeta(LPCTSTR lpszFileName, IPicDrawer *pIDrawer)<br />
{<br />
  // Draw EMF file, the limitation of DC function refer to MSDN<br />
  HDC hDC = ::CreateEnhMetaFile(NULL, lpszFileName, NULL,<br />
      _T(&#8220;FQ EMF Func\0No Title\0&#8243;));<br />
  CDC *pDC = CDC::FromHandle(hDC);<br />
  if(pDC)<br />
  {<br />
    CSize sz;<br />
    pIDrawer->GetSize(sz);<br />
    pDC->FillRect(CRect(0,0,sz.cx,sz.cy), &#038;CBrush(RGB(255,255,255)));<br />
    if(pIDrawer->Draw(pDC))<br />
    {<br />
      HENHMETAFILE hEmf = ::CloseEnhMetaFile(hDC);<br />
      if(hEmf)<br />
      {<br />
        ::DeleteEnhMetaFile(hEmf);<br />
        return TRUE;<br />
      }<br />
      else<br />
        ::DeleteFile(lpszFileName);<br />
    }<br />
  }<br />
  return FALSE;<br />
}</p>
<p>BOOL DrawBitmap(LPCTSTR lpszFileName, IPicDrawer *pIDrawer)<br />
{<br />
  // Draw 24 bit true color bitmap file<br />
  HANDLE hFile = ::CreateFile(lpszFileName, GENERIC_READ | GENERIC_WRITE,<br />
    0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);<br />
  BOOL bRet = FALSE;<br />
  if(hFile)<br />
  {<br />
    CSize sz;<br />
    pIDrawer->GetSize(sz);<br />
    BITMAPINFO BmpInfo = {0, }; //<br />
    BmpInfo.bmiHeader.biWidth = sz.cx;<br />
    BmpInfo.bmiHeader.biHeight = sz.cy;<br />
    BmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
    BmpInfo.bmiHeader.biPlanes = 1;<br />
    BmpInfo.bmiHeader.biBitCount = 24; // 24bit<br />
    BmpInfo.bmiHeader.biCompression = BI_RGB;<br />
    BmpInfo.bmiHeader.biSizeImage = BmpInfo.bmiHeader.biBitCount / 8 *<br />
      BmpInfo.bmiHeader.biWidth * BmpInfo.bmiHeader.biHeight;</p>
<p>    BITMAPFILEHEADER bmpFileHeader = {0, }; //<br />
    bmpFileHeader.bfType = *(WORD*)_T(&#8220;BM&#8221;);<br />
    bmpFileHeader.bfOffBits =<br />
      sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
    bmpFileHeader.bfOffBits +=<br />
      sizeof(DWORD) &#8211; (bmpFileHeader.bfOffBits % sizeof(DWORD));<br />
    bmpFileHeader.bfSize = bmpFileHeader.bfOffBits + BmpInfo.bmiHeader.biSizeImage;<br />
    //write file header and image information<br />
    DWORD dwNum = 0;<br />
    bRet = ::WriteFile(hFile, &#038;bmpFileHeader, sizeof(BITMAPFILEHEADER),<br />
      &#038;dwNum, NULL);<br />
    bRet = bRet &#038;&#038; ::WriteFile(hFile, &#038;(BmpInfo.bmiHeader), sizeof(BITMAPINFOHEADER),<br />
      &#038;dwNum, NULL);<br />
    if(bRet)<br />
    {<br />
      bRet = FALSE;<br />
      //create file mapping<br />
      HANDLE hMap = ::CreateFileMapping(hFile, NULL, PAGE_READWRITE,<br />
        0, bmpFileHeader.bfSize, NULL);<br />
      if(hMap)<br />
      {<br />
        // create bitmap object<br />
        void *pBits = NULL;<br />
        HBITMAP hBMP = ::CreateDIBSection(NULL, &#038;BmpInfo, DIB_RGB_COLORS,<br />
          &#038;pBits, hMap, bmpFileHeader.bfOffBits);<br />
        if(hBMP)<br />
        {<br />
          // draw the specified figure to file<br />
          CDC memTmpDC;<br />
          memTmpDC.CreateCompatibleDC(NULL);<br />
          if(memTmpDC.GetSafeHdc())<br />
          {<br />
            CBitmap *pbmp;<br />
            pbmp = CBitmap::FromHandle(hBMP);<br />
            if(pbmp)<br />
            {<br />
              memTmpDC.SelectObject(pbmp);<br />
              memTmpDC.FillRect(CRect(0,0,sz.cx,sz.cy), &#038;CBrush(RGB(255,255,255)));<br />
              bRet = pIDrawer->Draw(&#038;memTmpDC);<br />
            }<br />
          }<br />
          ::DeleteObject(hBMP);<br />
        }<br />
        ::CloseHandle(hMap);<br />
      }<br />
    }<br />
    ::CloseHandle(hFile);<br />
  }<br />
  if(!bRet)<br />
    ::DeleteFile(lpszFileName);<br />
  return bRet;<br />
}<br />
</coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/bitmap" title="Bitmap" rel="tag">Bitmap</a>, <a href="http://www.ucosoft.com/tag/emf" title="emf" rel="tag">emf</a>, <a href="http://www.ucosoft.com/tag/win32mfc" title="Win32/MFC" rel="tag">Win32/MFC</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/simple-code-to-create-an-emf-or-bitmap-file-from-existed-draw-code.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup SCIM in Ubuntu 6.10</title>
		<link>http://www.ucosoft.com/setup-scim-in-ubuntu-610.html</link>
		<comments>http://www.ucosoft.com/setup-scim-in-ubuntu-610.html#comments</comments>
		<pubDate>Mon, 11 Dec 2006 15:21:57 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[SCIM]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/57.html</guid>
		<description><![CDATA[After install the ubuntu 6.10 from the live-cd, you may find that the SCIM does not work. All the related package has been installed, but after press Ctrl+Space, the SCIM input has not enabled. The main reason is that the scim daemo is not running.&#160; Following is the solution: create 75scim file under /etc/X11/Xsession.d/ with [...]]]></description>
			<content:encoded><![CDATA[<p>After install the ubuntu 6.10 from the live-cd, you may find that the SCIM does not work. All the related package has been installed, but after press Ctrl+Space, the SCIM input has not enabled.</p>
<p>The main reason is that the scim daemo is not running.&nbsp; Following is the solution:</p>
<p>create 75scim file under /etc/X11/Xsession.d/ with following lines :<br/><br />
<coolcode linenum="no"><br />
export XMODIFIERS=&#8221;@im=SCIM&#8221;<br />
export XIM_PROGRAM=&#8221;/usr/bin/scim -d&#8221;<br />
export GTK_IM_MODULE=scim<br />
export QT_IM_MODULE=scim<br />
</coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/linux" title="linux" rel="tag">linux</a>, <a href="http://www.ucosoft.com/tag/scim" title="SCIM" rel="tag">SCIM</a>, <a href="http://www.ucosoft.com/tag/tips" title="Tips" rel="tag">Tips</a>, <a href="http://www.ucosoft.com/tag/ubuntu" title="Ubuntu" rel="tag">Ubuntu</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/setup-scim-in-ubuntu-610.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The work plan in the next days</title>
		<link>http://www.ucosoft.com/the-work-plan-in-the-next-days.html</link>
		<comments>http://www.ucosoft.com/the-work-plan-in-the-next-days.html#comments</comments>
		<pubDate>Mon, 11 Dec 2006 06:09:13 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/56.html</guid>
		<description><![CDATA[Document the ucoFml Parser and release the source. Release an old project, simpMath parser, which can parse math expressions and support + &#8211; * / and many math functions, such as sin,cos,tan,cot, etc. &#160; No tag for this post.]]></description>
			<content:encoded><![CDATA[<ul>
<li>Document the ucoFml Parser and release the source.</li>
<li>Release an old project, simpMath parser, which can parse math expressions and support + &#8211; * / and many math functions, such as sin,cos,tan,cot, etc.</li>
</ul>
<p>&nbsp;</p>
No tag for this post.]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/the-work-plan-in-the-next-days.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make the Code Completion working again in VC++ 6.0</title>
		<link>http://www.ucosoft.com/make-the-code-completion-working-again-in-vc-60.html</link>
		<comments>http://www.ucosoft.com/make-the-code-completion-working-again-in-vc-60.html#comments</comments>
		<pubDate>Thu, 07 Dec 2006 00:59:10 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/55.html</guid>
		<description><![CDATA[Code Completion is a very useful feature&#160;of programiing, but&#160;it often &#160;strikes in VC++ 6.0. If you meet such matter, try the following step: 1. delete *.ncb, *.opt, *.plg and *.clw files from your project directory 2. rebuild your project. And you often need CTRL+W to generate the class wizard infmation again. But the above works [...]]]></description>
			<content:encoded><![CDATA[<p>Code Completion is a very useful feature&nbsp;of programiing, but&nbsp;it often &nbsp;strikes in VC++ 6.0. If you meet such matter, try the following step:</p>
<p><!--adsense--><br />
<coolcode linenum="no"><br />
1. delete *.ncb, *.opt, *.plg and *.clw files from your project directory<br />
2. rebuild your project.<br />
</coolcode> </p>
<p>And you often need CTRL+W to generate the class wizard infmation again.</p>
<p>But the above works quite often but not always. For a better experience, you need to try some comercial tools, for example, <a href="http://www.wholetomato.com/" rel="nofollow">Visual Assistant</a>.It is a product of <a href="http://www.wholetomato.com/" rel="nofollow">Whold Tomato Software</a> and&nbsp; provides more powerful functions.</p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/tips" title="Tips" rel="tag">Tips</a>, <a href="http://www.ucosoft.com/tag/visual-studio" title="Visual Studio" rel="tag">Visual Studio</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/make-the-code-completion-working-again-in-vc-60.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to change the row height of CListCtrl</title>
		<link>http://www.ucosoft.com/how-to-change-the-row-height-of-clistctrl.html</link>
		<comments>http://www.ucosoft.com/how-to-change-the-row-height-of-clistctrl.html#comments</comments>
		<pubDate>Wed, 06 Dec 2006 02:34:32 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[CListCtrl]]></category>
		<category><![CDATA[Cpp]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/54.html</guid>
		<description><![CDATA[When you&#160;want to change the height of CListCtrl, you need to use an owner-draw version of CListCtrl and change the font of the control. But when&#160;you change the font of&#160;the CListCtrl, the control or its parent window does not get a chance to respecify the height of the rows and the effect will not be [...]]]></description>
			<content:encoded><![CDATA[<p>When you&nbsp;want to change the height of CListCtrl, you need to use an owner-draw version of CListCtrl and change the font of the control. But when&nbsp;you change the font of&nbsp;the CListCtrl, the control or its parent window does not get a chance to respecify the height of the rows and the effect will not be taken. The reason is that No WM_MEASUREITEM message is sent to the controls parent window. </p>
<p>The following article from <a href="http://www.codeproject.com" rel="nofollow">CodeProject</a>&nbsp;provided a good solution.</p>
<p><!--adsensex-->
<ul>
<li><a href="http://www.codeproject.com/listctrl/changerowheight.asp">Changing Row Height in an owner drawn Control</a></li>
</ul>
<p>And there is a similar&nbsp;article on CodeGuru.</p>
<ul>
<li><a href="http://www.codeguru.com/Cpp/controls/listview/advanced/article.php/c1013" rel="nofollow">Changing row height in owner drawn control</a></li>
</ul>

	Tags: <strong><a href="http://www.ucosoft.com/tag/clistctrl" title="CListCtrl" rel="tag">CListCtrl</a>, <a href="http://www.ucosoft.com/tag/cpp" title="Cpp" rel="tag">Cpp</a>, <a href="http://www.ucosoft.com/tag/win32mfc" title="Win32/MFC" rel="tag">Win32/MFC</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/how-to-change-the-row-height-of-clistctrl.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving selection of CListCtrl</title>
		<link>http://www.ucosoft.com/moving-selection-of-clistctrl.html</link>
		<comments>http://www.ucosoft.com/moving-selection-of-clistctrl.html#comments</comments>
		<pubDate>Mon, 04 Dec 2006 00:00:00 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[CListCtrl]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/52.html</guid>
		<description><![CDATA[tag: CListCtrl, SetItemState, SetSelectionMark When you try to move the item selection of a CListCtrl object, you should remember to call SetSelectionMark. If not, the program will not work as you think. It will only work once and won&#8217;t work any longer. The reason is that even you have called SetItemState and the selection was [...]]]></description>
			<content:encoded><![CDATA[<p>tag: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.asp" rel="nofollow">CListCtrl</a>, <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.3a3a.getitemstate.asp" rel="nofollow">SetItemState</a>, <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.3a3a.setselectionmark.asp" rel="nofollow">SetSelectionMark</a></p>
<p>When you try to move the item selection of a <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.asp">CListCtrl</a> object, you should remember to call <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.3a3a.setselectionmark.asp" rel="nofollow">SetSelectionMark</a>. If not, the program will not work as you think. It will only work once and won&#8217;t work any longer.</p>
<p>The reason is that even you have called <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.3a3a.getitemstate.asp" rel="nofollow">SetItemState</a> and the selection was changed in visiable, but the selection mark still keeps the old value.</p>
<p>The solution is to call the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.3a3a.setselectionmark.asp" rel="nofollow">SetSelectionMark</a> function after <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_clistctrl.3a3a.getitemstate.asp" rel="nofollow">SetItemState</a>.</p>
<p>Here is a short example.</p>
<p> <span id="more-52"></span><br />
<!--adsense--><br />
<coolcode lang="cpp" linenum="no"><br />
void CTestListDlg::OnBtnMoveNextItem()<br />
{<br />
int curSel = m_list.GetSelectionMark();<br />
int nCount = m_list.GetItemCount();<br />
m_list.SetItemState(curSel, 0, LVIS_SELECTED);<br />
curSel ++;<br />
if (curSel>= nCount) curSel=0;<br />
m_list.SetItemState(curSel, LVIS_SELECTED,LVIS_SELECTED);<br />
m_list.SetSelectionMark(curSel);<br />
m_list.SetFocus();<br />
}<br />
  </coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/clistctrl" title="CListCtrl" rel="tag">CListCtrl</a>, <a href="http://www.ucosoft.com/tag/win32mfc" title="Win32/MFC" rel="tag">Win32/MFC</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/moving-selection-of-clistctrl.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

