A Quick note to “Windows Service”

WindowsService (WinCE).JPG

A simple note from “Write Pure Windows Service” and “How to debug Windows Service”.

Write “Windows Service”

Windows Service is kind of application but it will start when system startup. Windows service will triggerd by “SMC”(System Managed Controller). There is some important note from my writing windows service experience.

  1. **Register your service:
    **What ever your application is big or small. You must register them to SMC before you use it. Please reference ::OpenSCManager() and ::CreateService().
    For more detail please reference Writing a Service Program’s main Function

  2. Start a “Windows Service”.
    You can not startup a windows service via any debugger, you need to startup it on SMC. The SMC will use ::StartServiceCtrlDispatcher to start service and wait for the call back signal “SERVICE_RUNNING”. If you can not startup windows service normally, please let the Service_Status call back and tried to figurate out the root cause. For more detail please refer to Installing a Service

  3. Stop a Windows Service
    When you tried to close a windows service from SMC.The handler will receive a “SERVICE_CONTROL_STOP” from system. Your program have to pass “SERVICE_STOP_PENDING” and call RevokeClassObjects() . For more detail please refer to Stopping a Service.

Debugging “Windows Service”

There are two “easy” ways to debug your Windows service.

  1. Attach Windows service by debugger:
    In VC6 “Build”–> “Start Debug” –>”Attach a process” to point out your service it will use debugger to debug the service.

  2. “Debugging Windows Service”
    use “DebugBreak();”. it will pop up the Window and allow you to debug into Windows Service(You must install VC6 or higher version).

  3. For more detail, please refer this address(How to debug Windows services).

At finally, there is a best practice for you.

2006-03-20:(Update)

Please note:

  1. VC7 or VC8 may have some problem when attach the VC6 debug version. (I think it is the pdb doesn’t match).
  2. To attach the thread. you may need to turn on the “Show system process”, it will show the Windows Service process.

2006-04-12:(Update)

Download Beeper Service Simple Code

本站開始檔blogspot的留言

Blogger

由於來自於blogspot.com的廣告實在太多,不知道是不是她們自己的問題,還是廣告商的利害~~ 決定要檔這整個網域的留言~~~ 若是從這些網站來的~~ 請加上空白

勇者鬥惡龍~ 裝備篇

《勇者斗恶龙II》对应手机追加新型号

之前去日本北海道的時候,去電玩賣場的玩具部看到的。雖然沒有買到羅德系列的裝備~~ 但是卻也買了兩個很漂亮的武器~~

IMG_0046.JPG

  IMG_0047.JPG

IMG_0051.JPG

IMG_0052.JPG

IMG_0053.JPG

IMG_0057.JPG

IMG_0059.JPG

IMG_0060.JPG

Resolve some build error in VS2005

Designing .NET Class Libraries: API Usability





  1. **Remove DirectX SDK
    **Because VS2005 doesn’t need DirectX SDK, so ~~~ if you use some library from DirectX. Please use

#if (defined(_MSC_VER) && (_MSC_VER > 1310)) //For VS2005 Compiler
///…..
#endif

Which the version of compiler VS2003 is 1310, and VS2005 is 1400.

  1. **Resolve “ambiguous symbol” build error from IXMLDOMElementPtr
    **From Microsoft PRB 316317(PRB: Compiler Errors When You Use #import with XML in Visual C++ .NET) and 26914(PRB: Compiler Errors When You Use #import with XML) .

We may use more precise directory path to import msxml.dll, such like import “C:MSXMLmsxml.dll”.

Also refer Belarce’s post on CodeGuru. You can download the old version msxml.h and include it before you import

青年首次購屋貸款


(資料來源:  蘋果日報網路)

最近察到資料~~~

資格

青年購屋低利貸款申請人應符合下列條件:
(一)年滿20歲以上至40歲之間,在當地設有戶籍者。
(二)與直系親屬設籍於同一戶或有配偶者。
(三)本人、配偶、戶籍內之直系親屬及其配偶均無自有住宅。
(四)家庭年收入在戶數20%分位點以下者。
(五)本人、配偶、戶籍內之直系親屬及其配偶均未曾受政府輔助購(建)住宅者。

申辦手續(傑森 > 部落格 > 生活雜記 > 青年首購貸款 )

  1. 申請書一份
  2. 戶口名簿影本或戶籍謄本一份
  3. 切結書一份
  4. 本人、配偶、戶籍內之直系親屬及其配偶之歸戶財產查詢清單
  5. 貼足雙掛號郵資之回郵信封(所填地址須為白天有人收信之地址)。

How to intstall Vista related SDK to your computer

Windows Vista

If you want to develop and run WinFX applications:

Make sure your OS is higher than WinXP SP2.

Where to get the sample code? Extract the AllSample.zip in Windows SDL installation Samples.

[Optional]You may need ZAM 3D, to editing 3D XAML

Reference: Windows Vista Developer Center