본문 바로가기
반응형

분류 전체보기778

[Dialog] 시스템 색상 가져오기 GetSysColor 함수를 실행하면 시스템에 설정된 색상값을 가져올 수 있다. 아래의 예제는 버튼 색상을 RGB 로 가져오는 코드이다. 버튼 색상과 대화상자 색상이 같다고 생각하여서 대화상자 색상을 가져오는 함수를 제작한 경우이다. COLORREF GetDialogBkColor() { return GetSysColor( COLOR_BTNFACE ); } This function retrieves the current color of the specified display element. Display elements are the parts of a window and the Windows display that appear on the system display screen. DWORD GetSysC.. 2011. 12. 14.
DLL 에 있는 비트맵(Bitmap) 리소스를 실행 파일로 가져오는 방법 3가지 DLL 에 있는 비트맵 리소스를 실행 파일로 가져오는 방법 3가지 1. FindResource() -> LoadResource() -> LockResource() 를 이용한 방법 ① LoadLibrary() 를 이용해서 DLL 파일의 핸들값을 얻어온다. HINSTANCE hDll = NULL; hDll = LoadLibrary("ExportDll.dll"); if(hDll == NULL) { MessageBox("Can't ExportDll.dll", "ResourceDll", MB_OK); return; } ② FindResource() -> LoadResource() -> LockResource() 와 CBrush의 객체인 CreateDIBPatternBrush를 이용해서 출력. HRSRC hRes;.. 2011. 12. 14.
[Dialog / 팝업 메뉴] 팝업 메뉴 밖을 클릭하면 팝업 메뉴가 닫히게 하는 방법 TrackPopupMenu() 또는 TrackPopupMenuEx() 를 이용하여서 팝업 메뉴를 보여진 후, 팝업 메뉴를 클릭하지 않고 팝업 메뉴 이외의 공간을 클릭한 경우, 팝업 메뉴를 닫히게 하려면 아래와 같이 구현하시면 됩니다. // Display the menu at the current mouse location. There's a "bug" // (Microsoft calls it a feature) in Windows 95 that requires calling // SetForegroundWindow. To find out more, search for Q135788 in MSDN. CPoint mouse; GetCursorPos(&mouse); ::SetForegroundWindow(Ge.. 2011. 12. 14.
[Dialog] 윈도우 작업영역 크기 설정 도우의 작업영역 크기를 설정하려면 아래의 메소드를 사용하면 된다. 아래의 메소드는 윈도우 작업영역을 설정하기 위하여서 AdjustWindowRectEx() 메소드와 SetWindowPos() 를 사용한다. 수직/수평 스크롤에 따른 영역 증가/축소는 개인 취향에 따라서 자유롭게 수정해서 사용하면 될 것 같다. 윈도우 API 정복 (개정판) - page 397 void SetClientRect(HWND hWnd,int width,int height) { RECT crt; DWORD Style,ExStyle; SetRect(&crt,0,0,width,height); Style=GetWindowLong(hWnd,GWL_STYLE); ExStyle=GetWindowLong(hWnd,GWL_EXSTYLE); Adj.. 2011. 12. 14.
[Dialog] 대화상자를 부모 윈도우 정 중앙에 위치시키기 대화상자를 부모의 정 중앙에 위치시키는 메소드입니다. - 윈도우API 정복(개정판) 2060 페이지에서 가져왔습니다. void MoveToParentCenter( HWND hWnd ) { RECT sttParentRect, sttClientRect; HWND hParent; hParent = ::GetParent( hWnd ); if( hParent == NULL ) return; if( ::IsIconic( hWnd ) ) { ::ShowWindow( hParent, SW_RESTORE ); } ::GetWindowRect( hParent, &sttParentRect ); ::GetWindowRect( hWnd, &sttClientRect ); ::SetWindowPos( hWnd, NULL , stt.. 2011. 12. 14.
[Dialog] 자식 윈도우 일괄 재배치하는 방법 자식 윈도우를 일관 재배치하려면 아래의 메소드를 사용하면 된다. HDWP BeginDeferWindowPos( int nNumWindows );HDWP DeferWindowPos( HDWP hWinPosInfo , HWND hWnd , HWND hWndInsertAfter , int x, int y, int cx, int cy, UINT uFlags ); BOOL EndDeferWindowPos( HDWP hWinPosInfo ); BeginDeferWindowPos() 메소드를 호출하여서 자식 윈도우의 크기와 위치를 저장하기 위한 메모리를 할당받는다. DeferWindowPos() 메소드를 호출하여서 각 자식 윈도우의 크기와 위치를 설정한다. EndDeferWindowPos() 메소드를 호출하여서 위에.. 2011. 12. 14.
반응형