본문 바로가기

프로그래밍245

MFC - 리소스에서 FileVersion 얻어오기 #pragma comment(lib, "version.lib") void main() { // 버전정보를 담을 버퍼 char *buffer = NULL; // 버전을 확인할 파일 char *name = "c:\\TestFolder\\test.exe"; DWORD infoSize = 0; // 파일로부터 버전정보데이터의 크기가 얼마인지를 구합니다. infoSize = GetFileVersionInfoSize(name, 0); if (infoSize == 0) return; // 버퍼할당 buffer = new char[infoSize]; if (buffer) { // 버전정보데이터를 가져옵니다. if (GetFileVersionInfo(name, 0, infoSize, buffer) != 0) { VS_F.. 2015. 2. 2.
MFC - 다이얼로그(Dialog)에 상태표시줄(CStatusBar)을 표시하기 Introduction Someone asked in the VC++ forum how they can add a status bar to a dialog and I foolishly replied saying that all they had to do was to have a CStatusBar member in their dialog class and that they should call Create() from the OnInitDialog() handler. Then someone else replied saying that it didn't work and then I tried it out myself and to my horror found that nothing happened. Anyh.. 2015. 2. 2.
MFC - 다이얼로그(Dialog)에 상태표시줄(CStatusBarCtrl)을 표시하기 Header public: CStatusBarCtrl m_StatusBar; CPP m_StatusBar.Create(WS_CHILD | WS_VISIBLE | SBT_OWNERDRAW, CRect(0, 0, 0, 0), this, 0); int strPartDim[4] = {180, 300, 300, 450 - 1}; m_StatusBar.SetParts(4, strPartDim); m_StatusBar.SetText("테스트1", 0, 0); m_StatusBar.SetText("테스트2", 1, 0); m_StatusBar.SetText("아이콘", 3, SBT_NOBORDERS); m_StatusBar.SetIcon(3, SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAM.. 2015. 2. 2.
MFC - 다이얼로그(CDialog)에서 ESC, ENTER키를 눌렀을 때 창이 종료되지 않게 하기 MFC의 다이얼로그(Dialog)기반 프로그램을 생성하였을 경우, 에디트박스와 같은 컨트롤에서 "ESC" 혹은 "ENTER"키를 눌렀을 때 다이얼로그가 종료되는 불편함이 있습니다. 이와 같은 현상은 해당키가 눌러졌을 때 OnOK, OnCancel의 이벤트가 호출되면서 다이얼로그가 종료되기 때문입니다. 이에 대한 해결방법으로 흔히 사용되는 방법은 해당키에 대한 이벤트를 다이얼로그에 전달되기 전에 가로채서 아무런 동작도 하지 않게 합니다. 그 처리 방법은 해당 다이얼로그에서 "PreTranslateMessage"를 재정의(Overriding)한 후 아래의 소스 코드를 넣어주면 됩니다. BOOL CUserDlg::PreTranslateMessage(MSG *pMsg) { if (pMsg->message == .. 2015. 2. 2.
MFC - 모달(Modal), 모덜리스(Modeless) 다이얼로그(CDailog)의 생성 및 소멸 방법 from MSDN MSDN에서 권고하고 있는 Modal, Modeless 다이얼로그(Dialog)의 생성 소멸하는 방법에 대해 간략히 정리 해 보겠습니다. 참고 사이트: https://msdn.microsoft.com/ko-kr/library/132s802t(v=vs.120).aspx CDialog 클래스 CDialog 클래스 아티클 06/10/2015 읽는 데 9분 걸림 이 문서의 내용 --> 화면에 대화 상자를 표시 하는 데 사용 되는 기본 클래스입니다. class CDialog : public CWnd Members Public 생성자 Public 메서드 CDialog::Crea docs.microsoft.com 모달(Modal) 다이얼로그 생성 방법 DoModal()함수를 호출합니다. 소멸 방법 OK, Cancel.. 2015. 1. 30.
반응형