[转]遍历windows服务
原文:http://www.codeproject.com/Articles/1573/About-Windows-Services
#include <windows.h>
#include <stdio.h>
#include "resource.h"
#include "services.h" #define BUFF_LEN 256 TCHAR g_szSelectedComputer[BUFF_LEN];
int g_iLen = BUFF_LEN;
QUERY_SERVICE_CONFIG* g_psc = NULL; // main program
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialogProc);
return ;
} // Dialog procedure
BOOL CALLBACK DialogProc(HWND p_hWnd, UINT p_uMsg, WPARAM p_wParam, LPARAM p_lParam) { HICON hIcon = NULL;
static HWND hWndList = NULL;
int iWidth = ; switch (p_uMsg) { case WM_INITDIALOG:
// Load Icon
hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN));
SendMessage(p_hWnd, WM_SETICON, TRUE, (LPARAM)hIcon); // initilize common control
InitCommonControls(); hWndList = GetDlgItem(p_hWnd, IDC_LIST_SERVICES); InsertColumn(hWndList, DISPLAY_NAME_COL, TEXT("Display Name"), iWidth);
InsertColumn(hWndList, SERVICE_NAME_COL, TEXT("Service Name"), iWidth);
InsertColumn(hWndList, TYPE_COL, TEXT("Type"), iWidth);
InsertColumn(hWndList, STATE_COL, TEXT("Current State"), iWidth);
InsertColumn(hWndList, CONTROL_COL, TEXT("Controls Accepted"), iWidth); // Set extended style of List control full row select
SendMessage(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, , (LPARAM) LVS_EX_FULLROWSELECT);
break; case WM_COMMAND:
switch(LOWORD(p_wParam)) { // Exit from the program
case IDC_BTN_EXIT:
PostQuitMessage();
break; case IDC_BTN_UPDATE:
GetWindowServices(hWndList);
break; case IDC_BTN_COMPUTER:
if (DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG_COMPUTER), NULL, DialogProcComputer)
== IDOK) { SetWindowText(GetDlgItem(p_hWnd, IDC_STATICCOMPUTER), g_szSelectedComputer);
}
break;
} case WM_NOTIFY:
switch (p_wParam) { case IDC_LIST_SERVICES:
if (((NMHDR*)p_lParam)->code == NM_DBLCLK) { TCHAR szService[BUFF_LEN];
int iPos = SendMessage(hWndList, LVM_GETNEXTITEM,
-, LVIS_SELECTED);
LVITEM lvItem;
ZeroMemory(&lvItem, sizeof(LVITEM)); // get the text of second column
lvItem.iSubItem = ;
lvItem.pszText = szService;
lvItem.cchTextMax = g_iLen;
SendMessage(hWndList, LVM_GETITEMTEXT, (WPARAM)iPos, (LPARAM)&lvItem); SC_HANDLE hSCM = OpenSCManager(g_szSelectedComputer, NULL, SC_MANAGER_ALL_ACCESS);
SC_HANDLE hService = OpenService(hSCM, szService, SERVICE_ALL_ACCESS); QUERY_SERVICE_CONFIG sc;
DWORD dwBytesNeeded = ; // Try to get information about the query
BOOL bRetVal = QueryServiceConfig(hService, &sc, sizeof(QUERY_SERVICE_CONFIG),
&dwBytesNeeded); if (!bRetVal) {
DWORD retVal = GetLastError(); // buffer size is small.
// Required size is in dwBytesNeeded
if (ERROR_INSUFFICIENT_BUFFER == retVal) { DWORD dwBytes = sizeof(QUERY_SERVICE_CONFIG) + dwBytesNeeded;
g_psc = new QUERY_SERVICE_CONFIG[dwBytesNeeded]; bRetVal = QueryServiceConfig(hService, g_psc, dwBytes, &dwBytesNeeded); if (!bRetVal) { ErrorDescription(GetLastError()); delete [] g_psc;
g_psc = NULL;
break;
} DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG_SERVICE), NULL, DialogProcService); delete [] g_psc;
g_psc = NULL;
}
} CloseServiceHandle(hService);
CloseServiceHandle(hSCM);
}
}
break;
} return FALSE;
} // insert column in the list control
int InsertColumn(HWND p_hWnd, int p_iCol, LPCTSTR p_lpszHeading, int p_iWidth) { LVCOLUMN column; column.mask = LVCF_TEXT | LVCF_FMT | LVCF_WIDTH;
column.fmt = LVCFMT_LEFT;
column.cx = p_iWidth;
column.pszText = (LPTSTR)p_lpszHeading;
column.iSubItem = -;
column.iImage = -;
column.iOrder = ; return (int) SendMessage(p_hWnd, LVM_INSERTCOLUMN, p_iCol, (LPARAM)&column);
} // insert rows in the list control
int InsertItem(HWND p_hWnd, int p_iRow, LPCTSTR p_lpszText) { LVITEM lvItem; lvItem.mask = LVIF_TEXT;
lvItem.iItem = p_iRow;
lvItem.iSubItem = ;
lvItem.state = ;
lvItem.stateMask = ;
lvItem.pszText = (LPTSTR)p_lpszText;
lvItem.iImage = ;
lvItem.lParam = ;
lvItem.iIndent = ; return (int) SendMessage(p_hWnd, LVM_INSERTITEM, , (LPARAM)&lvItem);
} // insert the item in the other columns of the list control
int InsertSubItem(HWND p_hWnd, int p_iRow, LPCTSTR p_lpszText, int p_iSubItem) { LVITEM lvItem; lvItem.iSubItem = p_iSubItem;
lvItem.pszText = (LPTSTR)p_lpszText; return (int) SendMessage(p_hWnd, LVM_SETITEMTEXT, p_iRow, (LPARAM)&lvItem);
} // get all the services of the window
BOOL GetWindowServices(HWND p_hWnd) { // first delete all item
SendMessage(p_hWnd, LVM_DELETEALLITEMS, , ); // open service manager
SC_HANDLE hHandle = OpenSCManager(g_szSelectedComputer, NULL, SC_MANAGER_ENUMERATE_SERVICE); if (!hHandle) { ErrorDescription(GetLastError());
return FALSE;
} ENUM_SERVICE_STATUS service; DWORD dwBytesNeeded = ;
DWORD dwServicesReturned = ;
DWORD dwResumedHandle = ; // Query services
BOOL retVal = EnumServicesStatus(hHandle, SERVICE_WIN32 | SERVICE_DRIVER, SERVICE_STATE_ALL,
&service, sizeof(ENUM_SERVICE_STATUS), &dwBytesNeeded, &dwServicesReturned,
&dwResumedHandle); if (!retVal) { // Need big buffer
if (ERROR_MORE_DATA == GetLastError()) { // Set the buffer
DWORD dwBytes = sizeof(ENUM_SERVICE_STATUS) + dwBytesNeeded;
ENUM_SERVICE_STATUS* pServices = NULL;
pServices = new ENUM_SERVICE_STATUS [dwBytes]; // Now query again for services
EnumServicesStatus(hHandle, SERVICE_WIN32 | SERVICE_DRIVER, SERVICE_STATE_ALL,
pServices, dwBytes, &dwBytesNeeded, &dwServicesReturned, &dwResumedHandle); // now traverse each service to get information
for (unsigned iIndex = ; iIndex < dwServicesReturned; iIndex++) { InsertItem(p_hWnd, iIndex, (pServices + iIndex)->lpDisplayName);
InsertSubItem(p_hWnd, iIndex, (pServices + iIndex)->lpServiceName, SERVICE_NAME_COL); // get type of the service
GetTypeOfService(p_hWnd, (pServices + iIndex)->ServiceStatus.dwServiceType, iIndex); // get current status of the services
GetCurrentStatus(p_hWnd, (pServices + iIndex)->ServiceStatus.dwCurrentState, iIndex); // check the control code which service can accept
GetControlCode(p_hWnd, (pServices + iIndex)->ServiceStatus.dwControlsAccepted, iIndex);
} delete [] pServices;
pServices = NULL;
}
else
return FALSE;
} CloseServiceHandle(hHandle); return TRUE;
} // get type of the service
void GetTypeOfService(HWND p_hWnd, DWORD p_dwType, int p_iIndex) { switch (p_dwType) { case SERVICE_WIN32_OWN_PROCESS:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Run its own process"), TYPE_COL);
break; case SERVICE_WIN32_SHARE_PROCESS:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Share a process with other application"), TYPE_COL);
break; case SERVICE_KERNEL_DRIVER:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Device driver"), TYPE_COL);
break; case SERVICE_FILE_SYSTEM_DRIVER:
InsertSubItem(p_hWnd, p_iIndex, TEXT("File system driver"), TYPE_COL);
break; case SERVICE_INTERACTIVE_PROCESS:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Service can interactive with desktop"), TYPE_COL);
break;
}
} // get current status of the services
void GetCurrentStatus(HWND p_hWnd, DWORD p_dwType, int p_iIndex) { switch (p_dwType) { case SERVICE_STOPPED:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Not running"), STATE_COL);
break; case SERVICE_START_PENDING:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Starting"), STATE_COL);
break; case SERVICE_STOP_PENDING:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Stopping"), STATE_COL);
break; case SERVICE_RUNNING:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Running"), STATE_COL);
break; case SERVICE_CONTINUE_PENDING:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Continue is pending"), STATE_COL);
break; case SERVICE_PAUSE_PENDING:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Pause is pending"), STATE_COL);
break; case SERVICE_PAUSED:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Paused"), STATE_COL);
break;
}
} // check the control code which service can accept
void GetControlCode(HWND p_hWnd, DWORD p_dwType, int p_iIndex) { switch (p_dwType) { case SERVICE_ACCEPT_STOP:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Can Stop"), CONTROL_COL);
break; case SERVICE_ACCEPT_PAUSE_CONTINUE:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Can Pause and continue"), CONTROL_COL);
break; case SERVICE_ACCEPT_SHUTDOWN:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Notified when shutdown"), CONTROL_COL);
break; // win 2000 and above
case SERVICE_ACCEPT_PARAMCHANGE:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Reread startup paramater"), CONTROL_COL);
break; // win 2000 and above
case SERVICE_ACCEPT_NETBINDCHANGE:
InsertSubItem(p_hWnd, p_iIndex, TEXT("Can change network binding"), CONTROL_COL);
break;
}
} // dialog procedure for computer dialog
BOOL CALLBACK DialogProcComputer(HWND p_hWnd, UINT p_uMsg, WPARAM p_wParam, LPARAM p_lParam) { HICON hIcon = NULL;
static HWND hWndList = NULL;
int iWidth = ;
int iPos = ; switch (p_uMsg) { case WM_INITDIALOG:
// Load Icon
hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN));
SendMessage(p_hWnd, WM_SETICON, TRUE, (LPARAM)hIcon); hWndList = GetDlgItem(p_hWnd, IDC_LIST_COMPUTER); InsertColumn(hWndList, PLATEFORM_COLUMN, TEXT("Plateform"), iWidth);
InsertColumn(hWndList, NAME_COLUMN, TEXT("Name"), iWidth);
InsertColumn(hWndList, VERSION_COLUMN, TEXT("Version"), iWidth);
InsertColumn(hWndList, TYPE_COLUMN, TEXT("Type"), iWidth);
InsertColumn(hWndList, COMMENT_COLUMN, TEXT("Comment"), iWidth); // Set extended style of List control full row select
SendMessage(hWndList, LVM_SETEXTENDEDLISTVIEWSTYLE, , (LPARAM) LVS_EX_FULLROWSELECT);
GetComputerInfo(hWndList); break; case WM_COMMAND:
switch(LOWORD(p_wParam)) { case IDOK:
iPos = SendMessage(hWndList, LVM_GETNEXTITEM, -, LVIS_SELECTED);
LVITEM lvItem;
ZeroMemory(&lvItem, sizeof(LVITEM)); // get the text of second column
lvItem.iSubItem = ;
lvItem.pszText = g_szSelectedComputer;
lvItem.cchTextMax = g_iLen;
SendMessage(hWndList, LVM_GETITEMTEXT, (WPARAM)iPos, (LPARAM)&lvItem); EndDialog(p_hWnd, IDOK);
break; case IDCANCEL:
strcpy(g_szSelectedComputer, TEXT(""));
EndDialog(p_hWnd, IDCANCEL);
break;
} case WM_NOTIFY:
switch (p_wParam) { case IDC_LIST_COMPUTER:
if (((NMHDR*)p_lParam)->code == NM_DBLCLK) { SendMessage(p_hWnd, WM_COMMAND, IDOK, NULL);
}
break;
} break;
} return FALSE;
} // get the information about the computer
void GetComputerInfo(HWND p_hWnd) { NET_API_STATUS nStatus;
LPSERVER_INFO_101 pBuff = NULL;
DWORD dwEntriesRead = NULL;
DWORD dwTotalEntries = NULL;
DWORD dwResumeHandle = NULL;
TCHAR buff[BUFF_LEN];
DWORD dwPrefMaxLen = -; // get information
nStatus = NetServerEnum(NULL, , (LPBYTE*)&pBuff, MAX_PREFERRED_LENGTH,
&dwEntriesRead, &dwTotalEntries, SV_TYPE_SERVER, NULL, &dwResumeHandle); if ((NERR_Success == nStatus) || (ERROR_MORE_DATA == nStatus)) { // first delete all item
SendMessage(p_hWnd, LVM_DELETEALLITEMS, , ); for (unsigned int iIndex = ; iIndex < dwEntriesRead; iIndex++) { if ((pBuff+iIndex)->sv101_platform_id == PLATFORM_ID_DOS) { sprintf(buff, TEXT("%s"), TEXT("DOS"));
}
else if ((pBuff+iIndex)->sv101_platform_id == PLATFORM_ID_OS2) { sprintf(buff, TEXT("%s"), TEXT("OS/2 or Win9x"));
}
else if ((pBuff+iIndex)->sv101_platform_id == PLATFORM_ID_NT) { sprintf(buff, TEXT("%s"), TEXT("Win NT/2000"));
}
else if ((pBuff+iIndex)->sv101_platform_id == PLATFORM_ID_VMS) { sprintf(buff, TEXT("%s"), TEXT("VMS"));
} InsertItem(p_hWnd, iIndex, buff); // Name
// convert UNICODE to ANSI
sprintf(buff, TEXT("%S"), (pBuff+iIndex)->sv101_name);
InsertSubItem(p_hWnd, iIndex, buff, NAME_COLUMN); // version
sprintf(buff, TEXT("%d.%d"), (pBuff+iIndex)->sv101_version_major,
(pBuff+iIndex)->sv101_version_minor);
InsertSubItem(p_hWnd, iIndex, buff, VERSION_COLUMN); // type
if ((pBuff+iIndex)->sv101_type & SV_TYPE_DOMAIN_CTRL) { sprintf(buff, TEXT("%s"), TEXT("PDC"));
}
else if ((pBuff+iIndex)->sv101_type & SV_TYPE_DOMAIN_BAKCTRL) { sprintf(buff, TEXT("%s"), TEXT("BDC"));
}
else if ((pBuff+iIndex)->sv101_type & SV_TYPE_WORKSTATION){ sprintf(buff, TEXT("%s"), TEXT("WorkStation"));
} InsertSubItem(p_hWnd, iIndex, buff, TYPE_COLUMN); // comment
// convert UNICODE to ANSI
sprintf(buff, TEXT("%S"), (pBuff+iIndex)->sv101_comment);
InsertSubItem(p_hWnd, iIndex, buff, COMMENT_COLUMN);
}
}
else { ErrorDescription(GetLastError());
} if (pBuff != NULL) { NetApiBufferFree(pBuff);
}
} // get the description of the error
void ErrorDescription(DWORD p_dwError) { HLOCAL hLocal = NULL; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL, p_dwError, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),(LPTSTR)&hLocal,
, NULL); MessageBox(NULL, (LPCTSTR)LocalLock(hLocal), TEXT("Error"), MB_OK | MB_ICONERROR);
LocalFree(hLocal);
} // call back function for service dialog
BOOL CALLBACK DialogProcService(HWND p_hWnd, UINT p_uMsg, WPARAM p_wParam, LPARAM p_lParam) { HWND hWndEdit = NULL;
HICON hIcon = NULL;
TCHAR szBuff[BUFF_LEN]; switch(p_uMsg) { case WM_INITDIALOG:
// Load Icon
hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAIN));
SendMessage(p_hWnd, WM_SETICON, TRUE, (LPARAM)hIcon); // display information
SetDlgItemText(p_hWnd, IDC_EDIT_PATH_NAME, g_psc->lpBinaryPathName);
SetDlgItemText(p_hWnd, IDC_EDIT_DEPENDENCIES, g_psc->lpDependencies);
SetDlgItemText(p_hWnd, IDC_EDIT_START_NAME, g_psc->lpServiceStartName);
SetDlgItemText(p_hWnd, IDC_EDIT_DISPLAY_NAME, g_psc->lpDisplayName);
SetDlgItemText(p_hWnd, IDC_EDIT_ORDER_GROUP, g_psc->lpLoadOrderGroup); SetServiceType(p_hWnd, g_psc->dwServiceType);
SetStartType(p_hWnd, g_psc->dwStartType);
SetErrorControl(p_hWnd, g_psc->dwErrorControl); sprintf(szBuff, TEXT("%d"), g_psc->dwTagId);
SetDlgItemText(p_hWnd, IDC_EDIT_TAG_ID, szBuff);
break; case WM_COMMAND:
switch(LOWORD(p_wParam)) { case IDOK:
EndDialog(p_hWnd, IDOK);
break;
}
} return FALSE;
} // display the service type
void SetServiceType(HWND p_hWnd, DWORD p_dwType) { TCHAR szBuff[BUFF_LEN]; // service type
switch(p_dwType) { case SERVICE_WIN32_OWN_PROCESS:
sprintf(szBuff, TEXT("%s"), TEXT("Runs in its own process"));
break; case SERVICE_WIN32_SHARE_PROCESS:
sprintf(szBuff, TEXT("%s"), TEXT("Service shares a process with other services"));
break; case SERVICE_KERNEL_DRIVER:
sprintf(szBuff, TEXT("%s"), TEXT("Service is device driver"));
break; case SERVICE_FILE_SYSTEM_DRIVER:
sprintf(szBuff, TEXT("%s"), TEXT("Service is file system driver"));
break; case SERVICE_INTERACTIVE_PROCESS:
sprintf(szBuff, TEXT("%s"), TEXT("Service can interact with desktop"));
break;
} SetDlgItemText(p_hWnd, IDC_EDIT_SERVICE_TYPE, szBuff);
} // dispalay the start type
void SetStartType(HWND p_hWnd, DWORD p_dwType) { TCHAR szBuff[BUFF_LEN]; // service type
switch(p_dwType) { case SERVICE_BOOT_START:
sprintf(szBuff, TEXT("%s"), TEXT("Start by System Loader"));
break; case SERVICE_SYSTEM_START:
sprintf(szBuff, TEXT("%s"), TEXT("Started by IoInitSystem function"));
break; case SERVICE_AUTO_START:
sprintf(szBuff, TEXT("%s"), TEXT("Started by Service Control Manager"));
break; case SERVICE_DEMAND_START:
sprintf(szBuff, TEXT("%s"), TEXT("Start by StartService function"));
break; case SERVICE_DISABLED:
sprintf(szBuff, TEXT("%s"), TEXT("No Longer be started"));
break;
} SetDlgItemText(p_hWnd, IDC_EDIT_START_TYPE, szBuff);
} // set error control
void SetErrorControl(HWND p_hWnd, DWORD p_dwErrro) { TCHAR szBuff[BUFF_LEN]; // service type
switch(p_dwErrro) { case SERVICE_ERROR_IGNORE:
sprintf(szBuff, TEXT("%s"), TEXT("Logs error but continue operation"));
break; case SERVICE_ERROR_NORMAL:
sprintf(szBuff, TEXT("%s"), TEXT("Logs error and display message box"));
break; case SERVICE_ERROR_SEVERE:
sprintf(szBuff, TEXT("%s"), TEXT("Logs error and restarted with Last Known Good Configuration"));
break; case SERVICE_ERROR_CRITICAL:
sprintf(szBuff, TEXT("%s"), TEXT("Log error if possible"));
break;
} SetDlgItemText(p_hWnd, IDC_EDIT_ERROR_CONTROL, szBuff);
}
[转]遍历windows服务的更多相关文章
- C# 6 与 .NET Core 1.0 高级编程 - 39 章 Windows 服务(上)
译文,个人原创,转载请注明出处(C# 6 与 .NET Core 1.0 高级编程 - 39 章 Windows 服务(上)),不对的地方欢迎指出与交流. 章节出自<Professional C ...
- 通过C#来开启、关闭、重启Windows服务
通过C#开启服务需要这个C#程序有相应权限,比如服务的账户是Local System的就必须以管理员权限运行C#程序才能开启或关闭. 这里只写重启的方式(就是先关闭,后开启): // Security ...
- powershell脚本之windows服务与进程
powershell脚本之windows服务与进程 服务与进程的区别: Windows服务是指系统自动完成的,不需要和用户交互的过程,可长时间运行的可执行应用程序 进程是程序运行的实例,系统会给运行中 ...
- Windows服务安装与控制
Windows服务安装与控制 1.建立服务 (1)定义一个ServiceInstaller using System; using System.Collections.Generic; using ...
- 使用C#创建windows服务续之使用Topshelf优化Windows服务
前言: 之前写了一篇“使用C#创建windows服务”,https://www.cnblogs.com/huangwei1992/p/9693167.html,然后有博友给我推荐了一个开源框架Tops ...
- c# Windows服务管理
.NET Framework中提供的类库可以很方便的实现对windows服务的安装.卸载.启动.停止.获取运行状态等功能.这些类都在System.ServiceProcess命名空间下. 所以,在开始 ...
- 基于SignalR实现B/S系统对windows服务运行状态的监测
通常来讲一个BS项目肯定不止单独的一个BS应用,可能涉及到很多后台服务来支持BS的运行,特别是针对耗时较长的某些任务来说,Windows服务肯定是必不可少的,我们还需要利用B/S与windows服务进 ...
- C#创建、安装、卸载、调试Windows Service(Windows 服务)的简单教程
前言:Microsoft Windows 服务能够创建在它们自己的 Windows 会话中可长时间运行的可执行应用程序.这些服务可以在计算机启动时自动启动,可以暂停和重新启动而且不显示任何用户界面.这 ...
- 玩转Windows服务系列汇总
玩转Windows服务系列汇总 创建Windows服务 Debug.Release版本的注册和卸载及其原理 无COM接口Windows服务启动失败原因及解决方案 服务运行.停止流程浅析 Windows ...
随机推荐
- 安装生物信息学软件-Samtools
装完Bowtie2,官方文档给出的栗子说可以玩一玩samtools,所以我入个坑 参考这篇http://m.010lm.com/roll/2016/0620/2343389.html Step 1: ...
- SVG DOM常用属性和方法介绍
将以Adobe SVG Viewer提供的属性和方法为准,因为不同解析器对JavaScript以及相关的属性和方法支持的程度不同,有些方法和属性是某个解析器所特有的.SVG支持DOM2标准. 12.2 ...
- sphinx 增量索引 实现近实时更新
一.sphinx增量索引的设置 数据库中的已有数据很大,又不断有新数据加入到数据库中,也希望能够检索到.全部重新建立索引很消耗资源,因为我们需要更新的数据相比较而言很少.例如.原来的数据有几百万条 ...
- C#中的var类型
var关键字是C#3.0开始新增的特性,称为推断类型(其实也就是弱化类型的定义) . VAR可代替任何类型,编译器会根据上下文来判断你到底是想用什么类型,类似 OBJECT,但是效率比OBJECT高点 ...
- C#代码示例_函数
参数数组 C#允许为函数指定一个(只能指定一个)特定的参数,这个参数必须是函数定义中的最后一个参数,称为参数数组.参数数组可以使用个数不定的参数调用函数,可以使用params关键字定义它们. 参数数组 ...
- Smart210学习记录----nand flash驱动
[详解]如何编写Linux下Nand Flash驱动 :http://www.cnblogs.com/linux-rookie/articles/3016990.html 当读写文件请求到来的时候, ...
- CentOS 6.5 安装CodeBlocks
CentOS 6.5 安装CodeBlocks 经历了无数痛苦的折磨,Linux上的库依赖真是能把人逼疯,终于在Google上找到了办法,勉强将CodeBlocks安装成功. 1.为了避免最新版本的C ...
- jq 一些小方法
js 控制a标签的onclick方法 document.getElementById("a3").onclick = ""; window.document.g ...
- BNUOJ 13105 nim博弈
ncredible Chess Time Limit: 2000ms Memory Limit: 32768KB This problem will be judged on LightOJ. Ori ...
- 如何在JBoss WildFly 8 自定义log4j日志
最近在 JBoss WildFly 8 下部署 Web应用,自定义的 log4j 日志不工作.console下无日志输出,用System.out.println都不输出内容到console. 原因是J ...