• http://www.cnblogs.com/wuxilin/archive/2006/06/04/416838.htm

    安装服务需要用到sc.exe可执行文件,它是win32Platform sdk中附带的工具.安装服务的DOS命令
    sc create 服务名称 binpath= exe的路径
    卸载服务的DOS命令
    sc delete 服务名称
    服务对话框:或在“开始”|“运行”对话框中输入 services.msc /s

     安装服务需要用到sc.exe可执行文件,它是win32Platform sdk中附带的工具.安装服务的DOS命令
    sc create 服务名称 binpath= exe的路径
    卸载服务的DOS命令
    sc delete 服务名称
    服务对话框:或在“开始”|“运行”对话框中输入 services.msc /s


    // 启动服务的控制分派机线程
    SERVICE_TABLE_ENTRY ServiceTable[2];
    ServiceTable[0].lpServiceName = "MemoryStatus";
    ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain; 
    ServiceTable[1].lpServiceName = NULL;
    ServiceTable[1].lpServiceProc = NULL;

    //Connects the main thread of a service process to the service control manager
    StartServiceCtrlDispatcher(ServiceTable);

    // Registers a function to handle service control requests.
    RegisterServiceCtrlHandler

    //Updates the service control manager's status information for the calling service.
    SetServiceStatus

    硬断点
    _asm int 3;

     

    我的对象是基于“我想让这个对象做什么?”而不是“Windows 用这些 APIs 做什么?”

  • 2009-05-11

    C++内存泄漏


    #define _CRTDBG_MAP_ALLOC //使生成的内存dump包含内存块分配的具体代码为止
    #include<stdlib.h>
    #include<crtdbg.h>

    int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
    tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
    _CrtSetDbgFlag( tmpFlag )