본문 바로가기

Code review24

[WinApi]apiStart apiStart.cpp from http://www.winapi.co.kr 01: #include 02: 03: LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); 04: HINSTANCE g_hInst; 05: LPSTR lpszClass="Class"; 06: 07: int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance 08: ,LPSTR lpszCmdParam,int nCmdShow) 09: { 10: HWND hWnd; 11: MSG Message; 12: WNDCLASS WndClass; 13: g_hInst=hInstance; 14: 15: WndClass.cbClsExtra=0; 16: Wn.. 2009. 5. 27.
[C]File merge // 두개의 파일을 읽어서 하나의 파일로 합치는 코드 01: /* 02: * description : 두 개의 파일을 읽어서 merge 03: */ 04: 05: 06: #include 07: 08: #define FILEREAD 4096 // buffer size define 09: 10: void main(void) 11: { 12: 13: FILE *fpR1, *fpR2, *fpW; 14: char buff[FILEREAD]; 15: int len; 16: 17: // first file read 18: fpR1 = fopen("C:\\test.exe","rb"); 19: if(fpR1 == NULL) 20: { 21: perror("first file read fail"); 22: return; .. 2009. 5. 27.
Linked List Sample 필요해서 추가하고 삭제 할때마다 해당하는 node의 index를 자동 정렬해주는 코드가 필요해서 작성해봤다. 나중에 수정해서 써봐야지.. ㅡㅡ; #include #include #include // simple linked list // type define linked list typedef struct _nodeObject { int nodeIdx; char *string; struct _nodeObject *Next; } nodeObject; // global define nodeObject *gFileIdx; // node index arrange nodeObject* setNodeIdx(nodeObject *gNode) { int idx=0; nodeObject *saveNode = NULL; .. 2009. 5. 27.
[WinApi] 실행중인 프로세스 검사 - FindProcessName() 실행 파일 이름을 입력 받아 프로세스에서 실행 여부 판단하는 함수 *. 입력파일명은 소문자로 받는다고 가정함. 01: #include "Tlhelp32.h" 02: 03: // 04: // 현재 실행중인 프로세스 리스트에서 파라메터로 받은 실행 파일이 존재하면 TRUE return 05: // 06: BOOL FindProcessName(char *sProcessName) 07: { 08: HANDLE hProcessSnap = NULL; 09: PROCESSENTRY32 pe32 = {0}; 10: UINT i; 11: 12: hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); 13: 14: if (hProcessSnap == INVALID.. 2009. 2. 1.
반응형