GSI

다이얼로그 투명하게..

C++ 2007. 10. 4. 11:29 |

BOOL SetLayeredWindowAttributes(
  HWND
hwnd,           // handle to the layered window
  COLORREF crKey,      // specifies the color key
  BYTE bAlpha,         // value for the blend function
  DWORD dwFlags        // action
);

typedef SLWA

선언:

typedef BOOL (WINAPI* SLWA)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);

#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED       0x00080000
#define LWA_ALPHA           0x00000002
#endif

코딩:

void CDlgTestDlg::SetTransparency(HWND hwnd, int percent)
{
    SLWA pSetLayeredWindowAttributes = NULL;  // 함수포인터 선언, 초기화.
    HINSTANCE hmodUSER32 = LoadLibrary("USER32.DLL"); // 인스턴스 얻음.
    pSetLayeredWindowAttributes=(SLWA)GetProcAddress(hmodUSER32,"SetLayeredWindowAttributes");
    //함수포인터 얻음.
//  HWND hwnd = this->m_hWnd; //다이얼로그의 핸들 얻음.
    SetWindowLong(hwnd, GWL_EXSTYLE,GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
    pSetLayeredWindowAttributes(hwnd, 0, (255 * percent) / 100, LWA_ALPHA);
}

Posted by gsi
:

사용자 삽입 이미지

본 프로그램은 <<, >> 버튼을 사용해서 화면에 보여지는 4개의 기준 패널을 좌우로 자연스럽게 이동시키는 데모 입니다.
기존에는 이것을 비하인드 코드 단에서 어떻게 해볼려고 삽질을 많이 했는데.
사실 그게 필요가 없을수도 있을거 같내요.

화면에 보여지는 것은 5개이지만 사실 5개의 패널로 구성되어진 것을 보실수 있으며,
선택된 내용을 우측 하단의 반사 효과로 되어 있는 곳에 뿌려 지게 됩니다.

이 부분은 나중에 다르게 변형 가능할거 같구요.

이 모듈을 조금더 확장해서.
이미지 뷰어를 하나 만들어 봐야 할거 같습니다.

<해당 데모>

Posted by gsi
:

Posted by gsi
:

union 사용법

C++ 2007. 9. 30. 01:53 |

가끔 공용체가 편할때가 있다 ^^

 union {
  struct {
     float m11; float m12; float m13; float m14;
     float m21; float m22; float m23; float m24;
     float m31; float m32; float m33; float m34;
     float m41; float m42; float m43; float m44;
  };
  struct {
   float m4x4[4][4];
  };
  float m16[16];
 };
Posted by gsi
:

Expression 프로그램을 실행하다가 오류가 났다. 프로그램이 실행 되면서 바로 죽는 것이다.
DirectX 용 프로그램을 개발하다 보면 "Use Debug Version of Direct3D"로 설정해 놓고 하는게 대부분인데.. 그것 때문에 실행이 되지 않았던 것이다. ^^

Expression 용 프로그램을 테스트 하기 위해서는 "Use Retail Version of Direct3D" 로 체크 하기 바란다.

Posted by gsi
: