정리

[MSDN][VS6.0] RUNTIME_CLASS

저장소/VC++

RUNTIME_CLASS

RUNTIME_CLASS( class_name )

Parameters

class_name

The actual name of the class (not enclosed in quotation marks).

Remarks

Use this macro to get the run-time class structure from the name of a C++ class.

RUNTIME_CLASS returns a pointer to a CRuntimeClass structure for the class specified by class_name. Only CObject-derived classes declared with DECLARE_DYNAMIC, DECLARE_DYNCREATE, or DECLARE_SERIAL will return pointers to a CRuntimeClass structure.

For more information, seeCObject Class Topics in Visual C++ Programmer’s Guide.

Example

// example for RUNTIME_CLASSCRuntimeClass* prt = RUNTIME_CLASS( CAge );ASSERT( lstrcmp( prt->m_lpszClassName, "CAge" )  == 0 );

See Also   DECLARE_DYNAMIC, DECLARE_DYNCREATE, DECLARE_SERIAL, CObject::GetRuntimeClass, CRuntimeClass

'저장소 > VC++' 카테고리의 다른 글

[MSDN][VS6.0] ASSERT  (0) 2009.09.22
[MSDN][VS6.0] IMPLEMENT_DYNCREATE  (0) 2009.09.22
[MSDN][VS6.0] DECLARE_DYNCREATE  (0) 2009.09.22
[MSDN][VS6.0] Predefined Macros  (0) 2009.09.22
[Error/Warning] fatal error C1902  (0) 2009.09.22

[MSDN][VS6.0] DECLARE_DYNCREATE

저장소/VC++

DECLARE_DYNCREATE

DECLARE_DYNCREATE( class_name )

Parameters

class_name

The actual name of the class (not enclosed in quotation marks).

Remarks

Use the DECLARE_DYNCREATE macro to enable objects of CObject-derived classes to be created dynamically at run time. The framework uses this ability to create new objects dynamically, for example, when it reads an object from disk during serialization. Document, view, and frame classes should support dynamic creation because the framework needs to create them dynamically.

Add the DECLARE_DYNCREATE macro in the .H module for the class, then include that module in all .CPP modules that need access to objects of this class.

If DECLARE_DYNCREATE is included in the class declaration, then IMPLEMENT_DYNCREATE must be included in the class implementation.

For more information on the DECLARE_DYNCREATE macro, seeCObject Class Topics in Visual C++ Programmer’s Guide.

Example

See the example for IMPLEMENT_DYNCREATE.

See Also   DECLARE_DYNAMIC, IMPLEMENT_DYNAMIC, IMPLEMENT_DYNCREATE, RUNTIME_CLASS, CObject::IsKindOf


'저장소 > VC++' 카테고리의 다른 글

[MSDN][VS6.0] IMPLEMENT_DYNCREATE  (0) 2009.09.22
[MSDN][VS6.0] RUNTIME_CLASS  (0) 2009.09.22
[MSDN][VS6.0] Predefined Macros  (0) 2009.09.22
[Error/Warning] fatal error C1902  (0) 2009.09.22
[Tool] VS2005 단축키 및 매크로  (0) 2009.09.22

[MSDN][VS6.0] Predefined Macros

저장소/VC++
Predefined Macros

The compiler recognizes six predefined ANSI C macros (see Table 1.1), and the Microsoft C++ implementation provides several more (see Table 1.2). These macros take no arguments and cannot be redefined. Their value (except for __LINE__ and __FILE__) must be constant throughout compilation. Some of the predefined macros listed below are defined with multiple values. Their values can be set by selecting the corresponding menu option in the Visual C++ development environment, or by using a command-line switch. See the tables below for more information.

Table 1.1   ANSI Predefined Macros

Macro Description
__DATE__ The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy. The month name Mmm is the same as for dates generated by the library function asctime declared in TIME.H.
__FILE__ The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks.
__LINE__ The line number in the current source file. The line number is a decimal integer constant. It can be altered with a #line directive.
__STDC__ Indicates full conformance with the ANSI C standard. Defined as the integer constant 1 only if the /Za compiler option is given and you are not compiling C++ code; otherwise is undefined.
__TIME__ The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.
__TIMESTAMP__ The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31.

 

Table 1.2   Microsoft-Specific Predefined Macros

Macro Description
_CHAR_UNSIGNED Default char type is unsigned. Defined when /J is specified.
__cplusplus Defined for C++ programs only.
_CPPRTTI Defined for code compiled with /GR (Enable Run-Time Type Information).
_CPPUNWIND Defined for code compiled with /GX (Enable Exception Handling).
_DLL Defined when /MD or /MDd (Multithread DLL) is specified.
_M_ALPHA Defined for DEC ALPHA platforms. It is defined as 1 by the ALPHA compiler, and it is not defined if another compiler is used.
_M_IX86 Defined for x86 processors. See Table 1.3 for more details.
_M_MPPC Defined for Power Macintosh platforms. Default is 601 (/QP601). See Table 1.4 for more details.
_M_MRX000 Defined for MIPS platforms. Default is 4000 (/QMR4000). See Table 1.5 for more details.
_M_PPC Defined for PowerPC platforms. Default is 604 (/QP604). See Table 1.6 for more details.
_MFC_VER Defines the MFC version. Defined as 0x0421 for Microsoft Foundation Class Library 4.21. Always defined.
_MSC_EXTENSIONS This macro is defined when compiling with the /Ze compiler option (the default).  Its value, when defined, is 1.
_MSC_VER Defines the compiler version. Defined as 1200 for Microsoft Visual C++ 6.0. Always defined.
_MT Defined when /MD or /MDd (Multithreaded DLL) or /MT or /MTd (Multithreaded) is specified.
_WIN32 Defined for applications for Win32®. Always defined.

As shown in following tables, the compiler generates a value for the preprocessor identifiers that reflect the processor option specified.

Table 1.3   Values for _M_IX86

Option in Developer Studio Command-Line Option Resulting Value
Blend /GB _M_IX86 = 500 (Default. Future compilers will emit a different value to reflect the dominant processor.)
Pentium /G5 _M_IX86 = 500
Pentium Pro /G6 _M_IX86 = 600
80386 /G3 _M_IX86 = 300
80486 /G4 _M_IX86 = 400

 

Table 1.4   Values for _M_MPPC

Option in development environment Command-Line Option Resulting Value
PowerPC 601 /QP601 _M_MPPC = 601 (Default)
PowerPC 603 /QP603 _M_MPPC = 603
PowerPC 604 /QP604 _M_MPPC = 604
PowerPC 620 /QP620 _M_MPPC = 620

 

Table 1.5   Values for _M_MRX000

Option in Developer Studio Command-Line Option Resulting Value
R4000 /QMR4000 _M_MRX000 = 4000 (Default)
R4100 /QMR4100 _M_MRX000 = 4100
R4200 /QMR4200 _M_MRX000 = 4200
R4400 /QMR4400 _M_MRX000 = 4400
R4600 /QMR4600 _M_MRX000 = 4600
R10000 /QMR10000 _M_MRX000 = 10000

 

Table 1.6   Values for _M_PPC

Option in Developer Studio Command-Line Option Resulting Value
PowerPC 601 /QP601 _M_PPC = 601
PowerPC 603 /QP603 _M_PPC = 603
PowerPC 604 /QP604 _M_PPC = 604 (Default)
PowerPC 620 /QP620 _M_PPC = 620


'저장소 > VC++' 카테고리의 다른 글

[MSDN][VS6.0] RUNTIME_CLASS  (0) 2009.09.22
[MSDN][VS6.0] DECLARE_DYNCREATE  (0) 2009.09.22
[Error/Warning] fatal error C1902  (0) 2009.09.22
[Tool] VS2005 단축키 및 매크로  (0) 2009.09.22
[Tool] VS2005 환경설정 및 단축키 설정  (0) 2009.09.22

[Error/Warning] fatal error C1902

저장소/VC++

fatal error C1902: 프로그램 데이터베이스 관리자가 일치하지 않습니다.

이건 뭐임? -_-;;

dumpbin.exe 사용 좀 하려 했더니
mspdb80.dll을 찾는다.

그래서 복사했더니 요모양 요꼴~

지워주면 정상적으로 된다.
원인은 도데체 무엇인가...


[Tool] VS2005 단축키 및 매크로

저장소/VC++
 

불타는 펌질. 내용 ㄳㄳ
원문 : Visual Studio 2005 단축키




VC 단축키 및 주석 매크로

 

Ctrl + Tab Edit하고 있는 Child Window 간의 이동


Ctrl + F4 현재 Edit하고 있는 Child Window를 닫기


Ctrl + I 문자열 입력 점진적으로 문자열 찾기 (Incremental Search)


Ctrl + F3 현재 커서에 있는 문자열 찾기 fowared (블록 지정 안 해도 됨)


Shift + F3 현재 커서에 있는 문자열 찾기 backward


F3 찾은 문자열에 대한 다음 문자열로 이동 (Next Search)


Ctrl + H 문자열 찾아 바꾸기 (Replace)


Ctrl + Left/Right Arrow 단어 단위로 이동


Ctrl + Delete 또는 Backspace 단어 단위로 삭제


Ctrl + F2 현재 라인에 북마크 지정/해제


F2 지정된 다음 북마크로 이동


Ctrl + Shift + F2 지정된 모든 북마크를 해제


F9 현재 라인에 Breakpoint를 지정/해제


Ctrl + Shift + F9 현재 Edit하고 있는 소스파일에 지정된 모든 Breakpoint 해제


Ctrl + ] 또는 E '{'괄호의 짝을 찾아줌 ('{'에 커서를 놓고 눌러야 함}


Ctrl + J, K #ifdef 와 #endif의 짝을 찾아줌


Ctrl + L 한 라인을 클립보드로 잘라내기 (Cut)


Ctrl + Shift + L 한 라인을 삭제


Alt + Mouse 블록 설정 세로로 블록 설정하기 (마우스d로)


Ctrl + Shift + F8 세로로 블록 설정하기 (키보드로), 취소할 때는 Esc키를 눌러야 함


블록 설정 -> Tab 선택된 블록의 문자열을 일괄적으로 들여쓰기(Tab) 적용


블록 설정 -> Shift + Tab 선택된 블록의 문자열을 일괄적으로 내어쓰기 적용


Alt + F8 -> Tab 또는 Shift + Tab 들여쓰기 자동 조정 (Tab:들여쓰기, Shift + Tab : 내어쓰기)


Ctrl + T 현재 커서에 있는 변수/함수에 대한 Type이 Tooltip 힌트 창에 나타남


Ctrl + Alt + T 멤버 변수/함수 목록에 대한 팝업 창이 나타남


Ctrl + Shift + T 공백/콤마/파이프/괄호 등을 기준으로 좌우 문자열을 Swap시킴


Ctrl + Shift + 8 문단기호 표시/감추기 : Tab은 ^, Space는 .으로 표시


Ctrl + D 툴바의 찾기 Editbox로 이동


Ctrl + Up/Down Arrow 커서는 고정시키고 화면만 스크롤 시키기


Tab 들여쓰기


Shift+Tab 내어쓰기


F4 다음 에러메세지로 이동


Alt+F8 들여쓰기 자동 조정


Ctrl+F 찾기


Ctrl+F3 현재 커서에 있는 단어로 찾기


Ctrl+H 찾아 바꾸기


F3 다음 단어 찾기


Ctrl+Shift+F3 이전 단어 찾기


Alt+E+I 프로젝트 내의 모든 파일에서 찾기


F2 설정된 북마크로 이동


F9 현재 커서위치에 BreakPoint를 설정/해제


Ctrl+B 브레이크 포인트 관리 메뉴


Ctrl+Spacebar 멤버목록 팝업창


Ctrl+T 현재 커서에 있는 단어의 툴팁정보 보기


Ctrl+U 모두 소문자로


Ctrl+Shift+U 모두 대문자로


Ctrl+Shift+8 Tab은 ^ 로 공백은 . 으로 보여줌


 


디버깅에 관련된 단축키 하나 더.


변수이름을 적어 놓고 브래이크 포인터의 위치 여부와 관계 없이 변수의 내용을 추적하는 기능이 Watch Window에 들어 있다. 디버그 모드에서 추가하고픈 변수나 등등 앞에 커서를 위치 시킨후 Shift + F9를 누르면 그냥 바로 추가된다.


 


▼ Browse Information file 이 필요한 단축키


(컴파일 되어야 함)


 


F12 현재 커서의 함수 정의 부분으로 이동


Shift+F12 현재 커서의 함수 참조 부분으로 이동


Ctrl+Num+ 다음 정의/참조 로 이동


Ctrl+Num- 이전 정의/참조 로 이동


 


▼ Visual Assist 6.0 설치시 가능한 단축키


 


Alt+O 현재 파일의 헤더(.h)/구현(.cpp) 파일로 이동


Alt+G 현재 커서의 함수 정의 부분으로 이동


Alt+M 현재 파일의 모든 함수 목록


Ctrl+Shift+V 선택해서 붙여넣기


Alt+← 이전 커서 위치로 이동


Alt+→ 다음 커서 위치로 이동



■ 디버그 단축키


 


변수이름을 적어 놓고 브래이크 포인터의 위치 여부와 관계 없이 변수의 내용을


추적하는 기능이 Watch Window에 들어 있죠...


그 때 디버그 모드에서 추가하고픈 변수나 등등 앞에 커서를 위치 시킨후


Shift + F9를 누르면 그냥 바로 추가됩니다


[Tool] VS2005 환경설정 및 단축키 설정

저장소/VC++

퍼왔음. 내용 ㄳㄳ
원문 : Kyuseo’s Visual Studio 2005 단축키 및 옵션 설정(세팅)



개요 

 

Kyuseo가 즐겨 사용하는 Visual Studio 6.0 과 유사하도록 설정한 Visual Studio 2005 단축키 및 옵션 설정(세팅) 입니다. 2005 는 6.0과 달리 복잡한 세부적인 설정까지 할 수 있어서 좋더군요.

 

2005에서 프로그래밍 하시는 분들은 참고하세요.

 

 

Kyuseo's Visual Studio 2005 설정

 

- 옵션 설정 (세부설명 : F1 을 눌러서 msdn 도움말을 참고)

 

 

 

- 단축키 설정

 

빌드.선택영역빌드         : F7

빌드.선택영역다시빌드    : Shift+F7

파일.모두저장            : Alt S

편집.클립보드링순환    : Ctrl+Shift +V

창.자동숨기기            : Ctrl+`

 

보기.솔루션탐색기    : Ctrl+1

보기.클래스뷰        : Ctrl+2

보기.리소스뷰        : Ctrl+3

 

Visual Assist

헤더 소스 전환     : Alt O

함수 목록        : Alt M

 

프로젝트 익스플러러 : Ctrl+E

 

알아둘 기본 단축키

파일에서 찾기            : Ctrl Shift S

파일에서 바꾸기        : Ctrl Shift H

'저장소 > VC++' 카테고리의 다른 글

[Error/Warning] fatal error C1902  (0) 2009.09.22
[Tool] VS2005 단축키 및 매크로  (0) 2009.09.22
[Win32] System Performance Monitoring(2)  (0) 2009.09.14
[Win32] 시스템 메모리 정보 확인  (0) 2009.09.14
[Win32] PDH Error Codes  (0) 2009.09.11

[Win32] System Performance Monitoring(2)

저장소/VC++
성능 모니터(perfmon)

Idle Time 확인으로부터 여기까지 왔다.
처음부터 알았으면 무지 좋았을텐데... ㅡㅜ
아무튼 설명 시작!

성능 모니터(이하 perfmon)를 살펴보자. 보는 방법은 2가지!

1. '시작' - '실행' - perfmon.msc 를 실행시킨다.
2. '제어판' - '관리 도구' - '성능' 을 실행시킨다.

실행시키면 다음과 같은 윈도우가 열린다.


음... 상큼하다. 이런게 있었다니.
전에 보긴 봤는데 별로 관심을 안갖다보니... 쿨럭.. -_-;
아무튼 필요한 것들을 보자.


뭐... 대략 이런 것들을 확인할 수 있다.
여기서 중요한게 '성능 개체의 카운터'라고 할 수 있겠다.
상당히 많은 종류의 개체와 카운터들이 존재한다.

설명을 누르면 설명 부분이 추가로 보이며 매우 친절하게 설명까지 해준다.
너무 멋지다~ +_+


※추가 정보
'Process' 개체를 보면 '인스턴스'에 프로세스 이름만 있을 뿐 PID를 확인할 수 없다.


근데 MS에서 PID를 확인할 수 있게 만들어놨다. (http://support.microsoft.com/kb/281884)
방법은 바로 레지스트리를 수정하는 것!!!
다음 위치에 DWORD 값을 하나 추가하도록 하자.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance
Type : DWORD
Name : ProcessNameFormat
Value : 2

시스템 재시작 따위는 필요 없다! perfmon을 다시 확인해보자.


오우! 잘 보인다앙~

뭐... 이게 끝!
카운터에 대한 설명은 '설명 버튼'을 눌러 잘 확인해보자.

---------------------------------------------------------------------------------
나머지는 네이버 친구로 부터 확인할 수 있었던 정보들~
원문 출처 못찾아서 그냥 긁었음 ㅎㅎ

Processor
% Processor Time  - 총 프로세서 사용량, Privileged time + User time (70% 이상은 과부하)
% Privileged Time - 시스템이 사용한 CPU 시간의 백분율
% User Time - 사용자모드에서 사용한 CPU 시간의 백분율
Interrupts/sec - 프로세스가 받아 처리한 하드웨어 인터럽트이 평균 비율(초당)-App에서 App로 넘어가는 시간

System
Processor Queue Length - CPU의 연산을 하기 위해 대기하는 Queue (2 이상이면 과부하)

Memory
Available Bytes - 사용 가능한 메모리 용량(byte)
Committed Bytes - 최대 사용한 메모리 용량(Available bytes와 반대)
Pages/sec - 초당 페이징 파일 사용 횟수 (30 이상 올라가면 오버) / 사용하면 RAM으로 올리고 사용안하면 VM내림
Page Reads/sec - 가상메모리를 읽은 비율
Page Writes/sec - 가상메모리에 쓴 비율(메모리를 비우기 위해)
Pool Paged Bytes - 페이지 풀은 사용되지 않고 있을 때 디스크에 쓸 수 있는 개체의 시스템 메모리 영역
Pool NonPaged Bytes - 페이지 되지 않은 바이트(20, 수치가 높으면 어플리케이션의 문제)
Page Fault/Sec
Paging File
% Usage - 사용하고 있는 Page File 인스턴스 양을 백분율로 표시한 것

Physical Disk
% Disk Time - Read/Write 요청을 처리하는데 사용된 시간의 백분율(50~60% 이상이면 과부하)
Avg. Disk Queue Length - 디스크에 대해 대기열에 있는 읽기 및 쓰기 요청의 평균 수
Current Disk Queue Length - 디스크를 읽기 위해서 대기하는 Queue (2 이상이면 IO많음 과부하)
Disk Reads/sec - 디스크에서의 읽기 작업 횟수
Disk Writes/sec - 디스크에서의 쓰기 작업 횟수
Logical Disk
% Free Space - 전체 사용할 수 있는 빈 공간의 백분율

Network
Bytes Total/sec - NIC를 통하며 보내고 받는 바이트의 비율(Received/Sent)
Network Segment
% Network Utilization - 50%가 넘으면 과부하
Server Work Queues
Queue Length - CPU의 현재 작업 큐의 길이(4 이상이면 병목)

Server
Bytes Total/sec - 네트워크에서 주고 받은 바이트 수
Logon/sec - 초당 로그온 수(로그온 비율)
Logon Total - 총 로그온 수(대화형 로그온,네트워크 로그온,서비스 로그온,성공한 로그온,실패한 로그온등)

[Win32] 시스템 메모리 정보 확인

저장소/VC++

[출처]
KJH님 : www.swip.co.kr
MSDN : http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx


//  Sample output:
//  There is       51 percent of memory in use.
//  There are 2029968 total Kbytes of physical memory.
//  There are  987388 free Kbytes of physical memory.
//  There are 3884620 total Kbytes of paging file.
//  There are 2799776 free Kbytes of paging file.
//  There are 2097024 total Kbytes of virtual memory.
//  There are 2084876 free Kbytes of virtual memory.
//  There are       0 free Kbytes of extended memory.

#include <windows.h>
#include <stdio.h>

// Use to convert bytes to KB
#define DIV 1024

// Specify the width of the field in which to print the numbers.
// The asterisk in the format specifier "%*I64d" takes an integer
// argument and uses it to pad and right justify the number.
#define WIDTH 7

void main(int argc, char *argv[])
{
  MEMORYSTATUSEX statex;

  statex.dwLength = sizeof (statex);

  GlobalMemoryStatusEx (&statex);

  printf ("There is  %*ld percent of memory in use.\n",
          WIDTH, statex.dwMemoryLoad);
  printf ("There are %*I64d total Kbytes of physical memory.\n",
          WIDTH, statex.ullTotalPhys/DIV);
  printf ("There are %*I64d free Kbytes of physical memory.\n",
          WIDTH, statex.ullAvailPhys/DIV);
  printf ("There are %*I64d total Kbytes of paging file.\n",
          WIDTH, statex.ullTotalPageFile/DIV);
  printf ("There are %*I64d free Kbytes of paging file.\n",
          WIDTH, statex.ullAvailPageFile/DIV);
  printf ("There are %*I64d total Kbytes of virtual memory.\n",
          WIDTH, statex.ullTotalVirtual/DIV);
  printf ("There are %*I64d free Kbytes of virtual memory.\n",
          WIDTH, statex.ullAvailVirtual/DIV);

  // Show the amount of extended memory available.

  printf ("There are %*I64d free Kbytes of extended memory.\n",
          WIDTH, statex.ullAvailExtendedVirtual/DIV);
}

[Win32] PDH Error Codes

저장소/VC++

[출처]
MSDN


Performance Data Helper Error Codes

All Performance Data Helper (PDH) functions return a value of type PDH_STATUS. If the function succeeds, the return value is ERROR_SUCCESS. Otherwise, the function returns a system error code or a PDH error code. To retrieve the description text for the error in your application, use the FormatMessage function.

For data collection and formatting functions, it is important to remember that the return value of the function indicates the success or error of the function call and not necessarily that of the counter data. Always check the CStatus member of the counter value returned to ensure that the data returned is valid before you use it. If the value of the CStatus member does not indicate success, do not use the data.

The following table provides a list of error codes that are specific to PDH. These values are defined in the PDHMsg.h header file (for C programming) and PDHDefs.txt (for Visual Basic programming).

Error code Description
0x00000000 (PDH_CSTATUS_VALID_DATA) The returned data is valid.
0x00000001 (PDH_CSTATUS_NEW_DATA) The return data value is valid and different from the last sample.
0x800007D0 (PDH_CSTATUS_NO_MACHINE) Unable to connect to the specified computer, or the computer is offline.
0x800007D1 (PDH_CSTATUS_NO_INSTANCE) The specified instance is not present.
0x800007D2 (PDH_MORE_DATA) There is more data to return than would fit in the supplied buffer. Allocate a larger buffer and call the function again.
0x800007D3 (PDH_CSTATUS_ITEM_NOT_VALIDATED) The data item has been added to the query but has not been validated nor accessed. No other status information on this data item is available.
0x800007D4 (PDH_RETRY) The selected operation should be retried.
0x800007D5 (PDH_NO_DATA) No data to return.
0x800007D6 (PDH_CALC_NEGATIVE_DENOMINATOR) A counter with a negative denominator value was detected.
0x800007D7 (PDH_CALC_NEGATIVE_TIMEBASE) A counter with a negative time base value was detected.
0x800007D8 (PDH_CALC_NEGATIVE_VALUE) A counter with a negative value was detected.
0x800007D9 (PDH_DIALOG_CANCELLED) The user canceled the dialog box.
0x800007DA (PDH_END_OF_LOG_FILE) The end of the log file was reached.
0x800007DB (PDH_ASYNC_QUERY_TIMEOUT) A time-out occurred while waiting for the asynchronous counter collection thread to end.
0x800007DC (PDH_CANNOT_SET_DEFAULT_REALTIME_DATASOURCE) Cannot change set default real-time data source. There are real-time query sessions collecting counter data.
0xC0000BB8 (PDH_CSTATUS_NO_OBJECT) The specified object is not found on the system.
0xC0000BB9 (PDH_CSTATUS_NO_COUNTER) The specified counter could not be found.
0xC0000BBA (PDH_CSTATUS_INVALID_DATA) The returned data is not valid.
0xC0000BBB (PDH_MEMORY_ALLOCATION_FAILURE) A PDH function could not allocate enough temporary memory to complete the operation. Close some applications or extend the page file and retry the function.
0xC0000BBC (PDH_INVALID_HANDLE) The handle is not a valid PDH object.
0xC0000BBD (PDH_INVALID_ARGUMENT) A required argument is missing or incorrect.
0xC0000BBE (PDH_FUNCTION_NOT_FOUND) Unable to find the specified function.
0xC0000BBF (PDH_CSTATUS_NO_COUNTERNAME) No counter was specified.
0xC0000BC0 (PDH_CSTATUS_BAD_COUNTERNAME) Unable to parse the counter path. Check the format and syntax of the specified path.
0xC0000BC1 (PDH_INVALID_BUFFER) The buffer passed by the caller is not valid.
0xC0000BC2 (PDH_INSUFFICIENT_BUFFER) The requested data is larger than the buffer supplied. Unable to return the requested data.
0xC0000BC3 (PDH_CANNOT_CONNECT_MACHINE) Unable to connect to the requested computer.
0xC0000BC4 (PDH_INVALID_PATH) The specified counter path could not be interpreted.
0xC0000BC5 (PDH_INVALID_INSTANCE) The instance name could not be read from the specified counter path.
0xC0000BC6 (PDH_INVALID_DATA) The data is not valid.
0xC0000BC7 (PDH_NO_DIALOG_DATA) The dialog box data block was missing or not valid.
0xC0000BC8 (PDH_CANNOT_READ_NAME_STRINGS) Unable to read the counter and/or help text from the specified computer.
0xC0000BC9 (PDH_LOG_FILE_CREATE_ERROR) Unable to create the specified log file.
0xC0000BCA (PDH_LOG_FILE_OPEN_ERROR) Unable to open the specified log file.
0xC0000BCB (PDH_LOG_TYPE_NOT_FOUND) The specified log file type has not been installed on this system.
0xC0000BCC (PDH_NO_MORE_DATA) No more data is available.
0xC0000BCD (PDH_ENTRY_NOT_IN_LOG_FILE) The specified record was not found in the log file.
0xC0000BCE (PDH_DATA_SOURCE_IS_LOG_FILE) The specified data source is a log file.
0xC0000BCF (PDH_DATA_SOURCE_IS_REAL_TIME) The specified data source is the current activity.
0xC0000BD0 (PDH_UNABLE_READ_LOG_HEADER) The log file header could not be read.
0xC0000BD1 (PDH_FILE_NOT_FOUND) Unable to find the specified file.
0xC0000BD2 (PDH_FILE_ALREADY_EXISTS) There is already a file with the specified file name.
0xC0000BD3 (PDH_NOT_IMPLEMENTED) The function referenced has not been implemented.
0xC0000BD4 (PDH_STRING_NOT_FOUND) Unable to find the specified string in the list of performance name and help text strings.
0x80000BD5 (PDH_UNABLE_MAP_NAME_FILES) Unable to map to the performance counter name data files. The data will be read from the registry and stored locally.
0xC0000BD6 (PDH_UNKNOWN_LOG_FORMAT) The format of the specified log file is not recognized by the PDH DLL.
0xC0000BD7 (PDH_UNKNOWN_LOGSVC_COMMAND) The specified Log Service command value is not recognized.
0xC0000BD8 (PDH_LOGSVC_QUERY_NOT_FOUND) The specified query from the Log Service could not be found or could not be opened.
0xC0000BD9 (PDH_LOGSVC_NOT_OPENED) The Performance Data Log Service key could not be opened. This may be due to insufficient privilege or because the service has not been installed.
0xC0000BDA (PDH_WBEM_ERROR) An error occurred while accessing the WBEM data store.
0xC0000BDB (PDH_ACCESS_DENIED) Unable to access the desired computer or service. Check the permissions and authentication of the log service or the interactive user session against those on the computer or service being monitored.
0xC0000BDC (PDH_LOG_FILE_TOO_SMALL) The maximum log file size specified is too small to log the selected counters. No data will be recorded in this log file. Specify a smaller set of counters to log or a larger file size and retry this call.
0xC0000BDD (PDH_INVALID_DATASOURCE) Cannot connect to ODBC DataSource Name.
0xC0000BDE (PDH_INVALID_SQLDB) SQL Database does not contain a valid set of tables for Perfmon.
0xC0000BDF (PDH_NO_COUNTERS) No counters were found for this Perfmon SQL Log Set.
0xC0000BE0 (PDH_SQL_ALLOC_FAILED) Call to SQLAllocStmt failed with %1.
0xC0000BE1 (PDH_SQL_ALLOCCON_FAILED) Call to SQLAllocConnect failed with %1.
0xC0000BE2 (PDH_SQL_EXEC_DIRECT_FAILED) Call to SQLExecDirect failed with %1.
0xC0000BE3 (PDH_SQL_FETCH_FAILED) Call to SQLFetch failed with %1.
0xC0000BE4 (PDH_SQL_ROWCOUNT_FAILED) Call to SQLRowCount failed with %1.
0xC0000BE5 (PDH_SQL_MORE_RESULTS_FAILED) Call to SQLMoreResults failed with %1.
0xC0000BE6 (PDH_SQL_CONNECT_FAILED) Call to SQLConnect failed with %1.
0xC0000BE7 (PDH_SQL_BIND_FAILED) Call to SQLBindCol failed with %1.
0xC0000BE8 (PDH_CANNOT_CONNECT_WMI_SERVER) Unable to connect to the WMI server on requested computer.
0xC0000BE9 (PDH_PLA_COLLECTION_ALREADY_RUNNING) Collection "%1!s!" is already running.
0xC0000BEA (PDH_PLA_ERROR_SCHEDULE_OVERLAP) The specified start time is after the end time.
0xC0000BEB (PDH_PLA_COLLECTION_NOT_FOUND) Collection "%1!s!" does not exist.
0xC0000BEC (PDH_PLA_ERROR_SCHEDULE_ELAPSED) The specified end time has already elapsed.
0xC0000BED (PDH_PLA_ERROR_NOSTART) Collection "%1!s!" did not start; check the application event log for any errors.
0xC0000BEE (PDH_PLA_ERROR_ALREADY_EXISTS) Collection "%1!s!" already exists.
0xC0000BEF (PDH_PLA_ERROR_TYPE_MISMATCH) There is a mismatch in the settings type.
0xC0000BF0 (PDH_PLA_ERROR_FILEPATH) The information specified does not resolve to a valid path name.
0xC0000BF1 (PDH_PLA_SERVICE_ERROR) The "Performance Logs & Alerts" service did not respond.
0xC0000BF2 (PDH_PLA_VALIDATION_ERROR) The information passed is not valid.
0x80000BF3 (PDH_PLA_VALIDATION_WARNING) The information passed is not valid.
0xC0000BF4 (PDH_PLA_ERROR_NAME_TOO_LONG) The name supplied is too long.
0xC0000BF5 (PDH_INVALID_SQL_LOG_FORMAT) SQL log format is incorrect. Correct format is "SQL:<DSN-name>!<LogSet-Name>".
0xC0000BF6 (PDH_COUNTER_ALREADY_IN_QUERY) Performance counter in PdhAddCounter call has already been added in the performance query. This counter is ignored.
0xC0000BF7 (PDH_BINARY_LOG_CORRUPT) Unable to read counter information and data from input binary log files.
0xC0000BF8 (PDH_LOG_SAMPLE_TOO_SMALL) At least one of the input binary log files contain fewer than two data samples.
0xC0000BF9 (PDH_OS_LATER_VERSION) The version of the operating system on the computer named %1 is later than that on the local computer. This operation is not available from the local computer.
0xC0000BFA (PDH_OS_EARLIER_VERSION) Supports %2 or later. Check the operating system version on the computer named %3.
0xC0000BFB (PDH_INCORRECT_APPEND_TIME) The output file must contain earlier data than the file to be appended.
0xC0000BFC (PDH_UNMATCHED_APPEND_COUNTER) Both files must have identical counters in order to append.
0xC0000BFD (PDH_SQL_ALTER_DETAIL_FAILED) Cannot alter CounterDetail table layout in SQL database.
0xC0000BFE (PDH_QUERY_PERF_DATA_TIMEOUT) System is busy. A time-out occurred when collecting counter data. Please retry later or increase the CollectTime registry value.

[Win32] GetLastInputInfo와 LASTINPUTINFO

저장소/VC++
Idle Time에 관련된 정보 수집 중에 정리.
사용자 입력이 일정 시간동안 없는 경우를 확인하고자 할 때 아래와 같이 확인할 수 있다.

사용되는 API는 다음과 같다.

[GetLastInputInfo]


함수의 원형은 아래와 같다.
BOOL GetLastInputInfo(      
    PLASTINPUTINFO plii
);

간단히 설명하자면 GetLastInputInfo API는 마지막 입력 이벤트의 시간을 반환한다.
여기서 입력 이벤트라 함은 keyboard/mouse 모두를 포함한 의미이다.
다른 입력장치가 있다면? 다른 입력장치 없어서 모르겠다. -_-;;;
아무튼 나머지 정보는 아래와 같다.
Minimum DLL Version : user32.dll
Header : Declared in winuser.h, include windows.h
Import Library : User32.lib
Minimum Operating System : Windows 2000

Return Value : 0이 아니면 성공, 0이면 실패
Parameters : PLASTINPUTINFO로 마지막 입력 이벤트 발생 시간을 얻는다.

자, 이제 파라미터인 LASTINPUTINFO에 대해 알아보자.
LASTINPUTINFO 구조체의 원형과 기타 정보는 아래와 같다.
typedef struct tagLASTINPUTINFO {
    UINT cbSize;
    DWORD dwTime;
} LASTINPUTINFO, *PLASTINPUTINFO;


Header : Declared in winuser.h, include windows.h
Minimum Operating System : Windows 2000

LASTINPUTINFO의 멤버에 대한 설명은 아래와 같다.
cbSize : 크기값, 크기는 sizeof(LASTINPUINFO)로 설정해야 한다.
dwTime : 마지막 입력 이벤트 발생 시간(Tick count)을 받는다. 초기값은 그냥 0으로 해준다.



뭐... 일단 재료는 준비됐고~
아주아주 간단하게 샘플을 끄적거려보자.

조건 : 5초 동안 입력 이벤트가 발생하지 않으면 시스템 비프음을 발생하고 종료한다.

int main()
{
   LASTINPUTINFO lastInput;
   lastInput.dwTime = 0;
   lastInput.cbSize = sizeof(LASTINPUTINFO);

   while(1)
   {
      if(GetLastInputInfo(&lastInput))   // 마지막 입력 이벤트 발생시간 획득
      {
         printf("Last Input Info time : %d\n", lastInput.dwTime);

         // 5초 동안 입력이 없을 경우
         if(GetTickCount() - lastInput.dwTime > 5000)
         {
             printf("\a");   // 비프음 발생
             break;
         }

         printf("\n");
         Sleep(1000);   // 1초 대기후 다시 확인
      }
   }

   return 0;
}


음... 재밌군 ㅋ


[참고]
MSDN  http://msdn.microsoft.com/en-us/library/ms646302(VS.85).aspx
데브피아