在軟體開發的過程中,對於一些需要的儲存資料,往往一般工程師都會使用INI檔來做為存取的要求。但是隨著資料量的增大、對於資料搜尋程度的渴望與日俱增。所以現在的許多APP開發上都會使用到XML來作為儲存資料與處理資料的中介。
但是隨著XML發展來的XPATH、XSLT、XQUERY種種多的語法來說,也是會讓人一下子無法找到任何的頭緒。
今天在看MSDN的雜誌的時候看到有關於Neetu Rajpal寫到關於An Introduction to the XML Tools in Visual Studio 2005,就直接拿手邊的VS2005來測試一下,果然相當的好用,對於XML的編輯上、使用XSLT來做搜尋的時候,更可以加上偵錯與逐步執行的功能,真是相當的人性化呢~~~~
(VS2005 裡面編輯XML,XSLT的畫面)
當然有許多家的業者也有許多相當好的XML編輯軟體可以使用,ALTOVA所研發的XMLSPY,如果只用到XMLSPY功能也就相當齊全,不過倒是用不太習慣就對了,不過慢慢適應總是會有所成長才對~~~
There are something we should keep in mind when we tried to write a Windows Service. The most important is the “Registry Key”.
In Windows programming, we usually use registry key to setting some value for difference user. Regstry key control become more and more in your code, and we also usually read the specific user in “HKEY_CURRENT_USER” **first then open generic “HKEY_LOCAL_MACHINE” .**
Here comes the problem, According this article(Services and the Registry) in MSDN. We should not use “HKEY_CURRENT_USER” **to retrival current user’s registry key value. Because Windows Services always startup before user login. It may happen some error or loading the wrong setting profile. If you still insist on using the current user registry key setting, please refer ”RegOpenCurrentUser”. In my experience use “RegQueryValueEx” with “HKEY_CURRENT_USER”** will retrival the RootUser’s setting. It make me confuse.
So the better way the use registry key in Windows Service is handle the “HKEY_LOCAL_MACHINE” **rather than “HKEY_CURRENT_USER”.**
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.
**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
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
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.
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.
“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).
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:
2006-04-12:(Update)
由於來自於blogspot.com的廣告實在太多,不知道是不是她們自己的問題,還是廣告商的利害~~ 決定要檔這整個網域的留言~~~ 若是從這些網站來的~~ 請加上空白