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...
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...
**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.
**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