Programming/C Win32 MFC2017. 11. 28. 14:01

음.. 적절한 용어가 안떠오르네

always on top의 해제 라고 해야하나?

기본적으로 귀찮으니(...) modal-less로 Create 할때 ID만 넣어 주고 했는데

이 때는 기본값이 부모 위에 생성되도록 된다고 한다.

(자식 다이얼로그 설정에 무엇이든 간에)

reg->Create(IDD_CHL_REG);

reg->ShowWindow(SW_HIDE); 


대신 아래처럼 데스크탑 윈도우를 받아와서 생성에 넣어주면

부모와 자유롭게 순서를 바꿀수가 있게 된다.

다만, 작업 표시줄에서 여러개로 쌓이게 되니 참고.

('윈도우즈'에서 개별 윈도우로 인식을 하는건가? 프로세스는 하나로 뜨긴 한다..)

reg->Create(IDD_CHL_REG, CWnd::GetDesktopWindow()); 

reg->ShowWindow(SW_HIDE);


[링크 : http://shaeod.tistory.com/776]

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms633504(v=vs.85).aspx]

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms644996(v=vs.85).aspx#init_box]



+

2017.11.29

어... 이렇게 하니 getParent()로 부모의 핸들을 얻는게 불가능 하다?!?!

'Programming > C Win32 MFC' 카테고리의 다른 글

MFC CList 선택항목 인덱스 얻기  (0) 2017.11.28
MFC CSdlierCtrl 에서 SetPos()  (0) 2017.11.28
MFC CListBox  (0) 2017.11.26
부모 다이얼로그, 자식 다이얼로그 통신하기  (0) 2017.11.25
CCheckListBox  (0) 2017.11.24
Posted by 구차니
Programming/C Win32 MFC2017. 11. 26. 12:28

CCombobox 처럼 그냥 addstring 하면되지만

InsertString을 사용하면 특정 위치에 추가할 수 있어서 편하긴 하다.

다르게 말하면 addString을 하면 순서대로 추가가 되지만

InsertString에서 동일 번호로 계속 주면 역순으로 추가가 되는 개념이 된다.


[링크 : http://www.tipssoft.com/bulletin/tb.php/FAQ/600]

[링크 : https://msdn.microsoft.com/ko-kr/library/80ay18e5.aspx] insertstring

[링크 : https://msdn.microsoft.com/ko-kr/library/2cekde96.aspx] addstring

Posted by 구차니
Programming/C Win32 MFC2017. 11. 25. 11:21

통신이라 하기 애매하려나..


자식 다이얼로그에서 부모 다이얼로그의 함수를 호출하고

그에 대한 응답을 부모 다이얼로그에서 자식 다이얼로그의 컨트롤로 던져주는 건데..


다이얼로그 클래스 컨스트럭터를 보다 보니 신기한 걸 발견

CRegister(CWnd* pParent = NULL);   // 표준 생성자입니다.

CRegister::CRegister(CWnd* pParent /*=NULL*/) : CDialogEx(CRegister::IDD, pParent) { }


오호.. 이걸 이용해서 잘 구워삶으면 되지 않을까 해서 찾은게

HWND WINAPI GetParent(

  _In_ HWND hWnd

); 

[링크 : https://msdn.microsoft.com/ko-kr/library/0x2wyab0.aspx]

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms633510(v=vs.85).aspx]


일단은.. modal-less로 구성할건데

컨스트럭터 호출때 (this)를 넣으면 자동으로 CDialgEx를 상속받아 pParent에 넣어 주지 않을까! 했는데

정작 실험해보니.. (this)를 해서 컨스트럭터를 통해 넣어 주던

그냥 () 으로 생성을 하던 똑같이 되긴 한다... 이게 머야 -ㅁ-?



아무튼,

Child는 이런식으로 부모 함수를 부르면 되고

#include "parent.h"

((CparentDlg*)GetParent())->parent_fuction();


parent야 어짜피 생성하러면 이미 include 해야 하니

#include "child.h"

reg = new Cchild(this);

if(reg)

{

reg->Create(IDD_CHLREG);

reg->ShowWindow(SW_HIDE);

}

modal-less로 생성하고 필요할때 SW_SHOW로 보여주면 끝

그리고 reg->로 필요한 함수를 미리 만들어서 interface로서 사용하면 끝!

(물론 child 컨트롤 직접 접근해도 되지만 귀찮은데 어느게 더 귀찮을까 -ㅁ-?)


[링크 : http://www.howspace.kr/gbs/bbs/tb.php/gr2_10_data/176]

[링크 : http://blog.daum.net/pince0/8457191]

2017/08/01 - [Programming/C / Win32 / MFC] - MFC 모달리스(modaless) 다이얼로그


'Programming > C Win32 MFC' 카테고리의 다른 글

MFC 자식 다이얼로그를 backward로 보내기  (0) 2017.11.28
MFC CListBox  (0) 2017.11.26
CCheckListBox  (0) 2017.11.24
MFC CMenu 이벤트 핸들러 관련  (0) 2017.11.24
정체 불명의.. 메시지 WM_DEVMODECHANGE  (0) 2017.11.13
Posted by 구차니
Programming/C Win32 MFC2017. 11. 24. 17:56

vs2010에서는 기본은 아니고 변경해줘야 하고..

vs2015정도 부터는 기본으로 되는거 같네?


[링크 : http://egloos.zum.com/mindol/v/209099]

[링크 : https://msdn.microsoft.com/en-us/library/d58s8sak.aspx]

Posted by 구차니
Programming/C Win32 MFC2017. 11. 24. 16:51

COMMAND는 클릭시 발생하고

프로토타입은 아무런 인자를 받지 않는다.

void CtestDlg::On___()

{

// TODO: 여기에 명령 업데이트 UI 처리기 코드를 추가합니다.

}


UPDATE_COMMAND_UI는 체크박스 등에 대한 처리라고 하는데

프로토타입은 CCmdUI를 받는다.

void CtestDlg::OnUpdate___(CCmdUI *pCmdUI)

{

// TODO: 여기에 명령 업데이트 UI 처리기 코드를 추가합니다.



[링크 : http://kjhworld.tistory.com/entry/메뉴-항목의-활성화비활성화]

[링크 : http://blog.naver.com/hji0223/220663170726]

Posted by 구차니
Programming/C Win32 MFC2017. 11. 13. 17:18

WM_DEVICECHANGE를 보다가 나온 녀석..

도대체 정체가 멀까?


001b 27 WM_DEVMODECHANGE

0219 537 WM_DEVICECHANGE

[링크 : https://wiki.winehq.org/List_Of_Windows_Messages]


읽어 보면.. 사용자가 장치 모드를 바꾸는 거랑(즉, 사용자가 트리거.. 해상도 변경 등... 일려나?)

The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings.

A window receives this message through its WindowProc function. 

[링크 : https://msdn.microsoft.com/.../dd145209(v=vs.85).aspx] WM_DEVMODECHANGE


장치 설정이 바뀌거나(뽑는건 사용자의 행위지만, 뽑음으로 장치 설정이 바뀌는건 OS의 책임이니?)

의 차이인거 같은데 누가 행위의 주체이냐? 라는 미묘한 차이가 관건으로 보인다.

Notifies an application of a change to the hardware configuration of a device or the computer.

A window receives this message through its WindowProc function. 

[링크 : https://msdn.microsoft.com/.../aa363480(v=vs.85).aspx] WM_DEVICECHANGE


ResetDC()는 WM_DEVMODECHANGE가 처리 할때 불리는데..

용지 방향을 바꿀때 쓸수도 있다. 근데 장치명 변경이나 이런데는 쓰지 말라 라는데 용도가 머냐..

The device context is updated from the information specified in the Windows DEVMODE structure. This member function only resets the attribute device context.

An application will typically use the ResetDC member function when a window processes a WM_DEVMODECHANGE message. You can also use this member function to change the paper orientation or paper bins while printing a document.

You cannot use this member function to change the driver name, device name, or output port. When the user changes the port connection or device name, you must delete the original device context and create a new device context with the new information.

Before you call this member function, you must ensure that all objects (other than stock objects) that had been selected into the device context have been selected out.

[링크 : https://msdn.microsoft.com/ko-kr/library/etschh40.aspx]

'Programming > C Win32 MFC' 카테고리의 다른 글

CCheckListBox  (0) 2017.11.24
MFC CMenu 이벤트 핸들러 관련  (0) 2017.11.24
윈도우 ini 파일 사용하기  (0) 2017.11.13
hidpi 지원 - winform wpf mfc  (2) 2017.11.10
cedit ctrl-a 단축키 사용하기  (0) 2017.11.08
Posted by 구차니
Programming/C Win32 MFC2017. 11. 13. 16:14

한번 써봐야지..


msdn 문서를 보니 16비트 OS와의 호환성으로 놔둔거고

레지스트리 쓰세요~ 라고 되어있네?


[링크 : http://myblue0324.tistory.com/93]

[링크 : http://terrorjang.tistory.com/18]

[링크 : https://ko.wikipedia.org/wiki/INI_파일]


BOOL WINAPI WritePrivateProfileString(

  _In_ LPCTSTR lpAppName,

  _In_ LPCTSTR lpKeyName,

  _In_ LPCTSTR lpString,

  _In_ LPCTSTR lpFileName

); 

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms725501(v=vs.85).aspx]


DWORD WINAPI GetPrivateProfileString(

  _In_  LPCTSTR lpAppName,

  _In_  LPCTSTR lpKeyName,

  _In_  LPCTSTR lpDefault,

  _Out_ LPTSTR  lpReturnedString,

  _In_  DWORD   nSize,

  _In_  LPCTSTR lpFileName

); 

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms724353(v=vs.85).aspx]


+

ini 파일 존재 여부는 이걸로 하면 편할거 같고..

BOOL PathFileExists(

  _In_ LPCTSTR pszPath

); 

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/bb773584(v=vs.85).aspx]


음.. Private 붙은거랑은 무슨 차이일려나?

읽어 보다 보니.. lpFileName이 없는게 차이고.. win.ini에 섹션을 만들어서 관리 하는 것으로 보이네..

일단 내 목적에는 Private..가 맞는 듯 하다.

[링크 : https://msdn.microsoft.com/en-us/library/windows/desktop/ms724366(v=vs.85).aspx] GetProfileString

[링크 : https://msdn.microsoft.com/en-us/library/windows/desktop/ms725504(v=vs.85).aspx] WriteProfileString

'Programming > C Win32 MFC' 카테고리의 다른 글

MFC CMenu 이벤트 핸들러 관련  (0) 2017.11.24
정체 불명의.. 메시지 WM_DEVMODECHANGE  (0) 2017.11.13
hidpi 지원 - winform wpf mfc  (2) 2017.11.10
cedit ctrl-a 단축키 사용하기  (0) 2017.11.08
mfc sleep 주의  (0) 2017.11.08
Posted by 구차니
Programming/C Win32 MFC2017. 11. 10. 18:27

win10 에서는 바로 적용되는 hidpi의 적용과

win7에서는 최소한 로그아웃해야 하는 녀석이긴 하지만


아무튼 win32 에서도 dpi 변경시에 이벤트가 날아 온다는 거군..

다만 win32는 vs2012 이후에 적용이 되는 것 같은데


찾다보니 win7 대응으로 vs2010 이고

win8  이후에 대응을 위해 vs2012 출시 된 거 같으니

그런 지원 기능 차이가 생기는 걸려나?


그래서 vs2008이 vista 대응이라 개판인건가!?

(찾아보니. 비스타 지원용.. 그래서 그렇게 vs2008도 망작이었던 게냐...)

[링크 : https://en.wikipedia.org/wiki/Microsoft_Visual_Studio#2008]


case WM_DPICHANGED

    // Find the button and resize it 

    HWND hWndButton = FindWindowEx(hWnd, NULL, NULL, NULL); 

    if (hWndButton != NULL) 

    { 

        UpdateButtonLayoutForDpi(hWndButton); 

    } 

}  

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/dn312083(v=vs.85).aspx]


어? 지원범위로는 win7 에서는 해당 이벤트가 발생하지 않을테니..

초기 실행시 CreateWindow에서 

Minimum supported client Windows 8.1 [desktop apps only]


이 놈도.. win8 이상..

GetDpiForMonitor()

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/dn280510(v=vs.85).aspx]


이 놈은 win10 이상.. -_-

GetDpiForWindow()

[링크 : https://msdn.microsoft.com/en-us/library/windows/desktop/mt748624(v=vs.85).aspx]


[링크 : https://msdn.microsoft.com/en-us/library/windows/desktop/mt843498(v=vs.85).aspx] win32

   [링크 : https://blogs.msdn.microsoft.com/vcblog/2010/03/11/mfc-applications-now-default-to-being-dpi-aware/]

[링크 : https://docs.microsoft.com/en-us/dotnet/framework/winforms/high-dpi-support-in-windows-forms] winform

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ee308410(v=vs.85).aspx] wpf


+

2017.11.13

GetDeviceCaps(hdcScreen, LOGPIXELSX);

GetDeviceCaps(hdcScreen, LOGPIXELSY); 

[링크 : https://stackoverflow.com/questions/12652835/getting-actual-screen-dpi-ppi-under-windows]


int GetDeviceCaps(

  _In_ HDC hdc,

  _In_ int nIndex

);


LOGPIXELSX

Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for all monitors.

LOGPIXELSY

Number of pixels per logical inch along the screen height. In a system with multiple display monitors, this value is the same for all monitors.


Minimum supported client

Windows 2000 Professional [desktop apps only] 

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/dd144877(v=vs.85).aspx]


음.. win7 에서는 96dpi로 기본 설정된다고 하는데

변경하면 저게 다르게 나오려나?

[링크 : https://www.techrepublic.com/.../get-a-better-view-in-windows-7-by-adjusting-dpi-scaling/]

'Programming > C Win32 MFC' 카테고리의 다른 글

정체 불명의.. 메시지 WM_DEVMODECHANGE  (0) 2017.11.13
윈도우 ini 파일 사용하기  (0) 2017.11.13
cedit ctrl-a 단축키 사용하기  (0) 2017.11.08
mfc sleep 주의  (0) 2017.11.08
win32 usb class  (0) 2017.11.03
Posted by 구차니
Programming/VHDL2017. 11. 9. 09:33

FPGA - Field-programmable gate array

[링크 : https://en.wikipedia.org/wiki/Complex_programmable_logic_device]


CPLD - Complex Programmable Logic Device

[링크 : https://en.wikipedia.org/wiki/Complex_programmable_logic_device]



여기 내용이 맞는진 모르겠지만..

CPLD(altera)는 로직을 굳혀서 별도의 외부 플래시가 필요없고

FPGA(xilinx)는 FPGA내 SRAM에 외부 플래시의 내용을 올리는 방식이라 외부 플래시기 필수인가?

(일단 artix-7나 kintex-7는 외부 플래시 필수이긴 하니..)

[링크 : http://cooa.tistory.com/entry/20048324430]


+

MAX V 라는 녀석인데

보드에 i2c / spi eeprom이 실장되지 않은 채 판매가 되고 있다.

CPLD 내부에 플래시가 들었거나 로직 게이트 자체를 바로 프로그래밍 하는 개념 인가?

별도의 외부 프로그램을 적재할 공간이 존재하지 않는 것이 xilinx와의 차이로 보인다.


[링크 : https://www.altera.com/.../manual/rm_maxv_cpld_dev_board.pdf]

    [링크 : https://www.altera.com/products/boards_and_kits/dev-kits/altera/kit-max-v.html]

'Programming > VHDL' 카테고리의 다른 글

VHDL 문법 공부중 1  (0) 2017.12.10
VHDL 문법 관련  (0) 2017.12.08
VHDL 문법  (0) 2017.12.07
xilinx fpga with vhdl verilog  (0) 2017.12.02
CPLD, FPGA  (0) 2009.12.17
Posted by 구차니
Programming/C Win32 MFC2017. 11. 8. 17:34

음.. 그냥.. 기본 단축키가 아니었던건가 -ㅁ-?


[링크 : http://blog.naver.com/sjplus/220436689165]

'Programming > C Win32 MFC' 카테고리의 다른 글

윈도우 ini 파일 사용하기  (0) 2017.11.13
hidpi 지원 - winform wpf mfc  (2) 2017.11.10
mfc sleep 주의  (0) 2017.11.08
win32 usb class  (0) 2017.11.03
CEdit 내용 지우기와 메모리 사용량  (0) 2017.10.26
Posted by 구차니