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 구차니
embeded/AVR (ATmega,ATtiny)2017. 11. 13. 16:06

-U 옵션이 무지 복잡해 보이는데

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500 -PCOM6 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

2016/04/06 - [embeded/arduino(genuino)] - 아두이노 부트로더 굽기?


아래 내용으로 해석을 해보면..

lock / fuse bit(extended/high/low) 를 Write 하고 immediate 모드로 해당 값을 쓰도록 한다 정도?

-Ulock:w:0x3F:m

-Uefuse:w:0x05:m

-Uhfuse:w:0xDA:m

-Ulfuse:w:0xFF:m



-U memtype:op:filename[:format]

Perform a memory operation. Multiple ‘-U’ options can be specified in order to operate on multiple memories on the same command-line invocation. The memtype field specifies the memory type to operate on. Use the ‘-v’ option on the command line or the part command from terminal mode to display all the memory types supported by a particular device. Typically, a device’s memory configuration at least contains the memory types flash and eeprom. All memory types currently known are:


calibration

One or more bytes of RC oscillator calibration data.


eeprom

The EEPROM of the device.


efuse

The extended fuse byte.


flash

The flash ROM of the device.


fuse

The fuse byte in devices that have only a single fuse byte.


hfuse

The high fuse byte.


lfuse

The low fuse byte.


lock

The lock byte.


signature

The three device signature bytes (device ID).


fuseN

The fuse bytes of ATxmega devices, N is an integer number for each fuse supported by the device.


application

The application flash area of ATxmega devices.


apptable

The application table flash area of ATxmega devices.


boot

The boot flash area of ATxmega devices.


prodsig

The production signature (calibration) area of ATxmega devices.


usersig

The user signature area of ATxmega devices.


The op field specifies what operation to perform:


r

read the specified device memory and write to the specified file


w

read the specified file and write it to the specified device memory


v

read the specified device memory and the specified file and perform a verify operation


The filename field indicates the name of the file to read or write. The format field is optional and contains the format of the file to read or write. Possible values are:


i

Intel Hex


s

Motorola S-record


r

raw binary; little-endian byte order, in the case of the flash ROM data


e

ELF (Executable and Linkable Format), the final output file from the linker; currently only accepted as an input file


m

immediate mode; actual byte values specified on the command line, separated by commas or spaces in place of the filename field of the ‘-U’ option. This is useful for programming fuse bytes without having to create a single-byte file or enter terminal mode. If the number specified begins with 0x, it is treated as a hex value. If the number otherwise begins with a leading zero (0) it is treated as octal. Otherwise, the value is treated as decimal.


a

auto detect; valid for input only, and only if the input is not provided at stdin.


d

decimal; this and the following formats are only valid on output. They generate one line of output for the respective memory section, forming a comma-separated list of the values. This can be particularly useful for subsequent processing, like for fuse bit settings.


h

hexadecimal; each value will get the string 0x prepended.


o

octal; each value will get a 0 prepended unless it is less than 8 in which case it gets no prefix.


b

binary; each value will get the string 0b prepended.


The default is to use auto detection for input files, and raw binary format for output files.


Note that if filename contains a colon, the format field is no longer optional since the filename part following the colon would otherwise be misinterpreted as format.


As an abbreviation, the form -U filename is equivalent to specifying -U flash:w:filename:a. This will only work if filename does not have a colon in it. 

[링크 : http://www.nongnu.org/avrdude/user-manual/avrdude_4.html]

[링크 : http://www.ladyada.net/learn/avr/avrdude.html]


생각해보니.. 양산용으로 avrdude를 이용해서

초기에 fuse bit 설정 -> 리부팅 -> 빠른 속도로 굽기 이런식으로 

해두고 옵션파일을 ini에 저장하도록 해서 fuse bit나 mcu 종류별로 관리하도록 하면

편할 거 같은데 avrdude용 gui front end 한번 작성해볼까..

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

avrdude 실행 안됨  (0) 2017.11.18
keil bootloader example - avr/atmel  (0) 2017.11.17
USBasp 설치  (0) 2017.11.13
avr 저전압 감지  (0) 2017.08.11
avr bod(Brown out Detect)  (0) 2017.08.11
Posted by 구차니
embeded/AVR (ATmega,ATtiny)2017. 11. 13. 14:54

아래 링크에서 zadig를 받아서 실행하면 아래와 같이 뜨는데

[링크 : http://zadig.akeo.ie/] 드라이버


USBasp 를 찾아서 (USB ID 16C0 05DC)

드라이버를 WinUSB 에서 libusbk로 바꾼후 install driver를 하면 된다..(꽤나 삽질했네 -_-)


WinDriver로 깔면 아래와 같이 에러가 발생하면서 장치를 못 찾는다

C:\win32_executable>avrdude -cusbasp -Pusb -pm128 -v


avrdude: Version 6.3, compiled on Feb 17 2016 at 09:25:53

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch


         System wide configuration file is "C:\win32_executable\avrdude.conf"


         Using Port                    : usb

         Using Programmer              : usbasp

avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'


avrdude done.  Thank you.


libusbk로 깔고 나서 해결 -_-

C:\win32_executable>avrdude -cusbasp -Pusb -pm128 -v


avrdude: Version 6.3, compiled on Feb 17 2016 at 09:25:53

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch


         System wide configuration file is "C:\win32_executable\avrdude.conf"


         Using Port                    : usb

         Using Programmer              : usbasp

         AVR Part                      : ATmega128

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PA0

         RESET disposition             : dedicated

         RETRY pulse                   : SCK

         serial program mode           : yes

         parallel program mode         : yes

         Timeout                       : 200

         StabDelay                     : 100

         CmdexeDelay                   : 25

         SyncLoops                     : 32

         ByteDelay                     : 0

         PollIndex                     : 3

         PollValue                     : 0x53

         Memory Detail                 :


                                  Block Poll               Page                       Polled

           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom         4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff

           flash         33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff

           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00


         Programmer Type : usbasp

         Description     : USBasp, http://www.fischl.de/usbasp/


avrdude: auto set sck period (because given equals null)

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: program enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

         Double check connections and try again, or use -F to override

         this check.



avrdude done.  Thank you.

[링크 : http://www.fischl.de/usbasp/]

[링크 : http://download.savannah.gnu.org/releases/avrdude/] avrdude

[링크 : https://rlogiacco.wordpress.com/2016/09/01/usbasp-windows-10/]

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

keil bootloader example - avr/atmel  (0) 2017.11.17
avrdude -U 옵션  (0) 2017.11.13
avr 저전압 감지  (0) 2017.08.11
avr bod(Brown out Detect)  (0) 2017.08.11
avr pwm 관련  (0) 2017.04.19
Posted by 구차니
개소리 왈왈/컴퓨터2017. 11. 12. 09:54


전에 있었던 문제가 또 발생한거네..

2014/07/05 - [개소리 왈왈/컴퓨터] - 크아아아앙!! 풀뱅크!!!



오기가 돋아서 찾아 보니..

M3 78T5663EH3-CF7 / K4T1G084QE

M3 78T5663QZ3-CF7 / K4T1G084QQ

Revision만 6세대(E)와 17세대(Q)로 차이가 난다.



[링크 : http://pdf1.alldatasheet.com/datasheet-pdf/view/347885/SAMSUNG/M378T5663EH3.html]

[링크 : http://pdf1.alldatasheet.com/datasheet-pdf/view/347884/SAMSUNG/M378T5663QZH3.html]


gangged / ungangged 로 해결은 되는데..

도대체 저 세대 차이는 머지?

'개소리 왈왈 > 컴퓨터' 카테고리의 다른 글

intel 에게 힘든 2분기 째 인가?  (0) 2018.01.03
Intel Management Engine(ME) 취약점 관련  (0) 2017.11.28
으앙 컴퓨터 죽음 -_ㅠ  (0) 2017.11.11
주말에 노트북 때를 벗김  (0) 2017.07.17
잉여템 득템?  (0) 2017.04.16
Posted by 구차니
개소리 왈왈/컴퓨터2017. 11. 11. 21:40

하드 고장나서 못 켠지 년 단위가 되어가는 녀석..

오늘 켜보니

화면도 안나오고

먼가.. 삑 소리도 안나고.. 상태가 이상하다?!

ㅠㅠ


아.. 우울해 ㅠㅠ

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 구차니
개소리 왈왈/독서2017. 11. 10. 10:03

끌리는 책 하나와

읽어볼까 하던 책 하나


아래는 맨스플레인을 널리 퍼지게 한 책


페미니즘의 검은 오해들

[링크 : https://www.kyobobook.co.kr/product/detailViewKor.laf?barcode=9788965641889]

[링크 : http://blog.aladin.co.kr/haesung/9031567] 리뷰가 끌리게 함


남자들은 자꾸 나를 가르치려 든다

[링크 : http://www.kyobobook.co.kr/product/detailViewKor.laf?barcode=9788936472634]

'개소리 왈왈 > 독서' 카테고리의 다른 글

책 - 졸혼시대  (0) 2017.11.15
책 - 남자들은 자꾸 나를 가르치려 든다  (0) 2017.11.13
책 - 경이감을 느끼는 아이로 키우기  (0) 2017.10.30
책 - 가장 멍청한 세대  (0) 2017.10.27
책 - 아빠행복수업  (0) 2017.10.26
Posted by 구차니

일단 제목과는 달리, 기존의 법은 유지한 채

승인을 득했을 시에는 야간비행, 시계외 비행을 허용한다 였네..

즉, 취미로 마음대로 야간에 날릴 수 있는건 아니란 점 ㅠㅠ


국토교통부는 10일부터 드론 규제 개선과 지원근거 마련 등 드론 산업 육성을 위한 제도를 시행한다고 9일 밝혔다.

드론의 야간 및 육안거리 밖 운행을 승인받기 위해서는 ▲ 드론의 성능과 제원 ▲ 조작 방법 ▲ 비행 계획서 ▲ 비상상황 매뉴얼 등 관련 서류를 국토부에 제출해야 한다.

[링크 : http://v.media.daum.net/v/20171109110113248]


강원 영월, 전남 고흥, 경남 고성, 충북 보은, 부산 영도, 대구 달성, 전북 전주에서 자유로운 비행을 허용한다. 야간비행은 물론이고 450m 상공으로 드론을 날릴 수 있는 것.

[링크 : http://www.newspim.com/news/view/20171018000231]

Posted by 구차니
embeded/FPGA - ALTERA2017. 11. 9. 13:35

단순하게 보면.. VHDL이나 베릴로그로 짠걸 RTL이라고도 표현한다는데..

먼지 감이 안오네..


[링크 : https://en.wikipedia.org/wiki/Register-transfer_level]

[링크 : http://aboutmadlife.blogspot.com/2014/11/what-is-rtl.html]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano / nios2  (0) 2017.12.06
microblaze (xilinx) Nios II (altera)  (0) 2017.12.05
Cyclone IV,V (terasic de0-nano)  (0) 2017.12.05
xilinx USB cable 드럽게 비싸네  (0) 2017.12.05
EPCS, EPCQ  (0) 2017.12.03
Posted by 구차니