月份:二月 2007

How to change button’s text

Posted on

Problem:
How to change the button’s text in a dialog that has been designed by IB at runtime?
Solution:
SetControlTitle(theControl, theTitle);
SetControlTitleWithCFString(…); is better

廣告

MSVCR80D.dll not found

Posted on Updated on

Symptom:
When running a builded application in VC++ 8.0, it appears
MSVCR80D.dll not found

this problem offten happens on FAT format disk. If your project saved on FAT disk.
because the manifast mechanism works bad on FAT disk file system.
Solution:
Project Properties->Configuration Properties->Mainfest Tool->Input and Output->Embed Manifest’ set to “NO"

Reference:

  • 看看簡體字部分的說明
  • About Hook

    Posted on

    Reference:

  • MSDN Hook
  • How to get DHCP server’s IP.

    Posted on Updated on

    1. include SystemConfiguration.framework in your project
    2. sample codes
    3. #include <iostream>
      #include <sys/cdefs.h>
      #include <CoreFoundation/CoreFoundation.h>
      #include <SystemConfiguration/SCDynamicStore.h>
      #include <SystemConfiguration/SCDynamicStoreCopyDHCPInfo.h>

      int main (int argc, char * const argv[]) {
      CFDictionaryRef dhcpInfo = SCDynamicStoreCopyDHCPInfo(NULL, NULL);
      CFDataRef dhcpServerIP = NULL;
      UInt8 dhcpCode = 54 ; // server identification

      if ( dhcpInfo == NULL )
      {
      std::cout << "SCDynamicStoreCopyDHCPInfo return null\n" ;
      return 0;
      }

      dhcpServerIP = DHCPInfoGetOptionData( dhcpInfo, dhcpCode) ;

      if ( dhcpServerIP != NULL )
      {
      const UInt8 * ptr = CFDataGetBytePtr( dhcpServerIP) ;
      printf("ServerIP:%d.%d.%d.%d\n",*ptr,*(ptr+1),*(ptr+2),*(ptr+3));
      }

      // insert code here...
      std::cout << "Hello, World!\n";
      return 0;
      }

    Reference:

    Bonjour

    Posted on

    Apple 在 MAC OS X 上廣泛使用的一種協定,可以用來找尋周邊的設備或是服務。例如: iTunes 上的檔案分享,照片分享,或是周邊的印表機,數位機上盒等等。感覺上有點像uPnP的功能。但是bonjour本身並不提供該項服務的協定。此外如果沒有做特殊的設定,bonjour只能在LAN 裡面作用。無法跨subnet。

    VRRP

    Posted on

    Virtual Routing Redundancy Protocol
    Router 的備份機制,一台掛了之後,備份的Router會活起來接手原本的工作。但是同一時間只有一台Router在工作。所以沒有覆載平衡(Loading Balance)的功能。
    Reference:

  • debian VRRP