본문 바로가기

Windows/Windows API

shared memory http://wwwi.tistory.com/63 프로세스간 통신이 되면 여러가지로 편리한 점이 있다. 프로세스간 통신을 하는 간단한 방법으로는 메모리 맵 파일이 있다. 어떤 프로세스에서 쓰고 있는 메모리는 가상 메모리로 그 어드레스는 가상 메모리의 어드레스이다. 따라서 다른 프로세스에 있어서는 의미가 없는 어드레스이다. 어떤 프로세스에서 물리 메모리의 어드레스를 가상 메모리로 매핑하여 읽고 쓰면 다른 프로세스에서도 그 메모리에 대하여 읽고 쓰기가 가능하다. 파일 매핑을 이용한 프로스세간 통신 예제 ◆ 공유 메모리 생성과 공유 메모리에 쓰기(서버) [code] #include #include #include #define DATA_LEN 1024 LPSTR lpMapping; int main() { BOO.. 더보기
pipe http://legendfinger.com/447 이름없는 파이프 - 하나의 프로세스가 생성 / 전달 - 전달 실행중 : DuplicateHandle() 자식일때 : 상속 자식의 표준 입출력과 연결 --------------------------- pipe_a.exe ------------------------------ 파이프 생성 / 전달 #include #include void main() { HANDLE hRead, hWrite; // 익명의 pipe - 단방향 CreatePipe(&hRead, &hWrite, 0, // 보안 속성 1024); // 버퍼 크기 // 이미 실행중인 프로세스에 전달해 주려면 // DuplicateHandle()로 복사한 후 메세지를 // 보내서 핸들을 전달 // //.. 더보기
disk free space (wince) wchar_t* directory = L"/"; ULARGE_INTEGER avail, total, free; avail.QuadPart = 0L; total.QuadPart = 0L; free.QuadPart = 0L; int returnVal = GetDiskFreeSpaceEx(directory, &avail, &total, &free); 더보기
local ip address (wince) std::string strIp; //Init winsock WSADATA wsaData; int nErrorCode = WSAStartup(MAKEWORD(1,1), &wsaData); if (nErrorCode != 0) { //Cannot initialize winsock //return _T(""); } char strHostName[81]; if (gethostname(strHostName, 80)==0) { hostent *pHost = gethostbyname(strHostName); if (pHost->h_addrtype == AF_INET) { in_addr **ppip=(in_addr**)pHost->h_addr_list; //Enumarate all addresses while (*p.. 더보기
camel CPU info // Camel - CPU Identifying Tool // Copyright (C) 2002, Iain Chesworth // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARR.. 더보기
CenterWindow firstzim님의 블로그 | 멋진보이 http://blog.naver.com/firstzim/120018394345 windows api 로 프로그램을 할때... 아래 함수를 가지고 이용하면, 편하다. winapi 책 같은 데 보면, 기본적으로 윈도우를 띄우고, 다이얼로그 박스 하나 정도 띄운뒤... 아래 함수들을 이용하면, 편하다. CenterWindow( hDlg ) 같이 그냥 쓰기만 하면된다. 아래의 두 함수의 차이점은 첫번째 함수는 화면 전체를 기준으로 가운데로 맞추어 주는 것이고, 두번째는 부모 윈도우의 중간에 맞추어 주는 것이다. 즉, 첫번째 함수는 전체 프로그램 띄울때 쓰면 좋고, 두번째 함수는 menu를 통해서 어떤 다이얼로그 박스를 띄울때, 그 프로그램의 가운데 나오게 하고 싶을때 쓰면.. 더보기
DrawTransparentBitmap // ========================================================================== // Image Drawing Functions // ========================================================================== static HBITMAP StretchBitmap(HBITMAP hBitmap, int iWidth, int iHeight) { HDC hdcScreen = ::GetDC(NULL); HDC hdcSource = ::CreateCompatibleDC(hdcScreen); HDC hdcStretch = ::CreateCompatibleDC(hdcScreen); ::SelectObje.. 더보기
system tray [img src=www.codeproject.com/useritems/SysTray_Application/systray_demo.jpg] 1, 필수 파일 [code]#include [/code] 2. inint [code] nidApp.cbSize = sizeof(NOTIFYICONDATA); // sizeof the struct in bytes nidApp.hWnd = (HWND) hWnd; //handle of the window which will process this app. messages nidApp.uID = IDI_SYSTRAYDEMO; //ID of the icon that willl appear in the system tray nidApp.uFlags = NIF_ICON | NIF_.. 더보기
Message Cracker Wizard Link : http://www.codeproject.com/win32/msgcrackwizard.asp API 에서 삽질을 도와주는 -_ - 듯한... 꽤 좋아 뵌다.. 더보기
Message Cracker #include "defime.h" HINSTANCE g_hInst; HWND hWndMain; LPCTSTR lpszClass = TEXT("DefIme"); // change unicode int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance ,LPSTR lpszCmdParam,int nCmdShow) { HWND hWnd; MSG Message; WNDCLASS WndClass; g_hInst=hInstance; WndClass.cbClsExtra=0; WndClass.cbWndExtra=0; WndClass.hbrBackground=(HBRUSH)(COLOR_WINDOW+1); WndClass.hCursor=LoadCursor(NULL.. 더보기