'프로그래밍'에 해당되는 글 64건

  1. 2013.12.06 STM32와 W5500 연결중에 멘붕.. IMR 및 RCR 이름이 중복됨.
  2. 2012.06.29 아직 몰랐던 함수들...
  3. 2011.10.05 [C] 1차원 배열을 2차원 배열로 사용하기
  4. 2011.09.20 이 구성 요소에 대한 사용 권한 정보를 찾을 수 없습니다.
  5. 2011.09.14 MFC 다이얼로그 소멸 순서
  6. 2011.09.08 error C2258: illegal pure syntax, must be '= 0'
  7. 2011.09.05 warning C4819
  8. 2009.04.11 [펌] MFC 애플리케이션 위저드의 “Windows 소켓” 옵션 1
  9. 2009.03.02 [클래스] CObList
  10. 2009.02.16 SetWindowPos
  11. 2009.02.15 warning C4996: 'sprintf'이(가) deprecated로 선언되었습니다.
  12. 2009.02.14 진행바 만들기.. 1
  13. 2009.02.14 [펌] WMP 함수정리 ( 9.0 ) 1
  14. 2009.02.12 재생 상태 확인
  15. 2009.02.07 Windows Media Downloads
  16. 2009.02.07 Windows Media Downloads
  17. 2009.02.06 [펌] Window Media Player 제어 방법 (참고용임)
  18. 2009.02.06 [에러] error C2146: 구문 오류 : ';'이(가) 'PVOID64' 식별자 앞에 없습니다.
  19. 2009.02.06 Windows Media Player 속성에서 uiMode 값
  20. 2009.02.05 [에러] LINK 에러
  21. 2009.01.31 MS Platform SDK 다운로드
  22. 2009.01.31 그래프 에디터
  23. 2009.01.31 다이렉트 쇼를 시작하기
  24. 2009.01.23 오너드로우 버튼 3
  25. 2009.01.23 [API] TRACKMOUSEEVENT 구조체
  26. 2009.01.18 전방참조
  27. 2009.01.18 모달리스 대화상자 띄우기
  28. 2009.01.18 대화상자 차이점(모달 vs 모달리스)
  29. 2009.01.18 자식창 생성 초기화에서 부모창 데이터 읽어오기
  30. 2009.01.18 자식창에서 부모창으로 데이터 전달

최신 Wiznet 사의 W5500 칩을 테스트 하던중에 발견.

최신드라이버 파일이라고 잘 정리해 둔것을 보고 써보던중에 발견함.

 


uint8_t  getIMR(void)
{
   return WIZCHIP_READ(IMRw);  // 이렇게 수정함.
}

 


uint8_t  getIMR(void)
{
   return WIZCHIP_READ(IMRw);
}

 

#define IMRw               (_W5500_IO_BASE_ + (0x0016 << 8) + (WIZCHIP_CREG_BLOCK << 3))

 

RCR 도 마찬가지~

 

 

D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2861 #define  EXTI_IMR_MR10                       ((uint32_t)0x00000400)        /*!< Interrupt Mask on line 10 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2862 #define  EXTI_IMR_MR11                       ((uint32_t)0x00000800)        /*!< Interrupt Mask on line 11 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2863 #define  EXTI_IMR_MR12                       ((uint32_t)0x00001000)        /*!< Interrupt Mask on line 12 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2864 #define  EXTI_IMR_MR13                       ((uint32_t)0x00002000)        /*!< Interrupt Mask on line 13 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2865 #define  EXTI_IMR_MR14                       ((uint32_t)0x00004000)        /*!< Interrupt Mask on line 14 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2866 #define  EXTI_IMR_MR15                       ((uint32_t)0x00008000)        /*!< Interrupt Mask on line 15 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2867 #define  EXTI_IMR_MR16                       ((uint32_t)0x00010000)        /*!< Interrupt Mask on line 16 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2868 #define  EXTI_IMR_MR17                       ((uint32_t)0x00020000)        /*!< Interrupt Mask on line 17 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2869 #define  EXTI_IMR_MR18                       ((uint32_t)0x00040000)        /*!< Interrupt Mask on line 18 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 2870 #define  EXTI_IMR_MR19                       ((uint32_t)0x00080000)        /*!< Interrupt Mask on line 19 */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7511 #define ETH_MACIMR_TSTIM     ((uint32_t)0x00000200)  /* Time stamp trigger interrupt mask */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7512 #define ETH_MACIMR_PMTIM     ((uint32_t)0x00000008)  /* PMT interrupt mask */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7586 #define ETH_MMCRIMR_RGUFM    ((uint32_t)0x00020000)  /* Mask the interrupt when Rx good unicast frames counter reaches half the maximum value */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7587 #define ETH_MMCRIMR_RFAEM    ((uint32_t)0x00000040)  /* Mask the interrupt when when Rx alignment error counter reaches half the maximum value */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7588 #define ETH_MMCRIMR_RFCEM    ((uint32_t)0x00000020)  /* Mask the interrupt when Rx crc error counter reaches half the maximum value */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7591 #define ETH_MMCTIMR_TGFM     ((uint32_t)0x00200000)  /* Mask the interrupt when Tx good frame count counter reaches half the maximum value */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7592 #define ETH_MMCTIMR_TGFMSCM  ((uint32_t)0x00008000)  /* Mask the interrupt when Tx good multi col counter reaches half the maximum value */
D:\test\Libraries\CMSIS\Core\CM3\stm32f10x.h 7593 #define ETH_MMCTIMR_TGFSCM   ((uint32_t)0x00004000)  /* Mask the interrupt when Tx good single col counter reaches half the maximum value */
D:\test\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c 86 EXTI->IMR = 0x00000000;
D:\test\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c 115 EXTI->IMR &= ~EXTI_InitStruct->EXTI_Line;
D:\test\Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c 230 enablestatus =  EXTI->IMR & EXTI_Line;
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\netctrl.c 82 setIMR((uint8_t)(option_value&0x00FF)); // set interrupt mask.
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 373 void     setIMR(uint8_t imr)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 373 void     setIMR(uint8_t imr)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 375 WIZCHIP_WRITE(IMR, imr);
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 375 WIZCHIP_WRITE(IMR, imr);
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 378 uint8_t  getIMR(void)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 380 return WIZCHIP_READ(IMR);
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 393 void     setSIMR(uint8_t simr)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 393 void     setSIMR(uint8_t simr)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 395 WIZCHIP_WRITE(SIMR, simr);
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 395 WIZCHIP_WRITE(SIMR, simr);
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 398 uint8_t  getSIMR(void)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 400 return WIZCHIP_READ(SIMR);
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 547 void     setSn_IMR(uint8_t sn, uint8_t imr)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 547 void     setSn_IMR(uint8_t sn, uint8_t imr)
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 549 WIZCHIP_WRITE(Sn_IMR(sn), (imr & 0xF0));
D:\test\Libraries\W5500_iolibrary_v100\ethernet\w5500\w5500.c 549 WIZCHIP_WRITE(Sn_IMR(sn), (imr & 0xF0));

Posted by +깡통+

VB 가지고 밥먹은지 10년째..

정말 프로그래머의 인생은 끝 없는 공부의 연속이다.

 

아직 몰랐던 함수를 정리하고자 한다.

 

LSet - 메모리 복사 개념. 형식이 다른 변수를 대입하여 복사 할 수 있다.  Integer -> 2 Byte 배열

Filter - 문자열 배열에서 지정된 문자열을 포함하는 요소를 뽑아 다시 배열로 반환하는 함수.

Join - Split 반대의 개념. 나눴던 문자열 배열을 다시 결합하는 함수

StrReverse - 문자열을 역순으로 바꾸어 반환하는 함수

 

Posted by +깡통+
1.2Mb 나 되는 데이터를 읽어들였다.
1296 x 964 정도 되는 이미지 파일인데 처리를 위해서는 2차원 배열이 필요 했다.

 int cols=1296, rows=964;
 unsigned char *p  = new unsigned char [rows * cols];
 unsigned char (*pdata)[1296] = (unsigned char (*)[1296])p;   // 여기서 [] 안의 값은 1차 배열의 크기를 뜻한다.

즉..  처리 후에는 pdata[964][1296]  가 생기는 것이다.  ^^

 FILE *fp;
 fp = fopen("1.RAW", "rb");
 fread(p, 1, cols * rows, fp);



참고 자료 : http://blog.naver.com/yonguk6726/30084714204
Posted by +깡통+





threed.ocx 에서 발생했다.  헉 수많은 프로젝트가 이걸 썼는데 갑자기 실행이 안된다 ㅠㅠ
가끔 어떤 프로그램을 설치했을때.. OCX 버전 충돌이나
혹은 나처럼 디어셈블리어를 설치했더니 겪는 문제이다. ( 추측 )

문제 해결방법은..  아래 사이트에서 디자인 타임 라이센스를 변경해주는 패치를 해주면 된다.
http://support.microsoft.com/kb/195353/ko


기술 자료: 195353 - 마지막 검토: 2005년 3월 7일 월요일 - 수정: 3.3

FILE: 중지된 컨트롤에 대한 라이센스 VBUSC.EXE가 제공합니다.

모두 확대 | 모두 축소

요약
VBUSC.EXE 이전 버전의 Visual Basic 선적된 있지만 더 이상 지원되지 않으므로 및 현재 버전과 단종되지 ActiveX 컨트롤에...

VBUSC.EXE 이전 버전의 Visual Basic 선적된 있지만 더 이상 지원되지 않으므로 및 현재 버전과 단종되지 ActiveX 컨트롤에 대한 디자인 타임 라이센스 설치합니다 파일입니다.

추가 정보
Microsoft 다운로드 센터에서 다음 파일을 다운로드 할 수 있습니다: VBUSC.exe (http://download.microsoft.c...

Microsoft 다운로드 센터에서 다음 파일을 다운로드 할 수 있습니다:
VBUSC.exe (http://download.microsoft.com/download/vb60pro/install/2/win98/en-us/vbusc.exe)
2000년 8월 15일 릴리스 날짜:

Microsoft 지원 파일을 다운로드하는 방법에 대한 자세한 내용은 Microsoft 기술 자료의 다음 문서를 참조하십시오.
119591  (http://support.microsoft.com/kb/119591/EN-US/ ) 온라인 서비스로부터 Microsoft 지원 파일 구하는 방법
Microsoft는 이 파일에 대한 바이러스를 검색합니다. Microsoft는 파일을 게시한 날짜에 사용할 수 있었던 최신 바이러스 검색 소프트웨어가 사용됩니다. 해당 파일을 무단으로 변경할 수 없는 보안이 향상된 서버에 보관됩니다.
    FileName               Size
   ---------------------------------------------------------
   VBUSC.EXE                88k
				
다음 컨트롤은 Microsoft Visual Basic에서 더 이상 지원되지 않습니다:
ActiveX Control Name                Filename
------------------------------------------------
Desaware Animated Button Control    ANIBTN32.OCX
Microhelp Gauge Control             GAUGE32.OCX
Pinnacle-BPS Graph Control          GRAPH32.EXE
Microsoft Grid Control              GRID32.OCX
Microhelp Key State Control         KEYSTA32.OCX
Microsoft Outline Control           MSOUTL32.OCX
Outrider SpinButton Control         SPIN32.OCX
Sheridan 3D Controls                THREED32.OCX
				
있는 ActiveX 컨트롤 위에 나열된 더 이상 지원되지 않으며, 있지만 기존 프로젝트를 업그레이드할 때 이전 버전과의 호환성을 위해 전문가 및 엔터프라이즈 버전 중 Visual Basic 배를.

이러한 컨트롤은 학습 Edition의 Microsoft Visual Basic 함께 제공되는 수행할지 않습니다.

전문가 및 엔터프라이즈 버전 컨트롤 설치 CD 다음 위치에 있는:
Microsoft Visual Basic Edition        Location
----------------------------------------------------------------------
Professional 6.0                      \Common\Tools\VB\Controls
Enterprise 6.0                        \Common\Tools\VB\Controls
Visual Studio Professional 6.0        \Common\Tools\VB\Controls (CD2)
Visual Studio Enterprise 6.0          \Common\Tools\VB\Controls (CD3)
				
이러한 디렉터리의 각 README.TXT 디자인 타임 사용할 컨트롤을 설치하는 방법에 대한 지침이 포함되어 있습니다.

참고: Visual Basic의 이전 버전에서 개발한 프로젝트를 업그레이드하려면 학습 Edition 사용 문제가 이러한 컨트롤에 대한 라이센스 발생할 수 있습니다.

해당 VBUSC.EXE VBA 컴퓨터에서 검색된 경우 위에 나열된 컨트롤에 대한 디자인 타임 라이센스를 설치합니다.








Posted by +깡통+
※ WM_SYSCOMMAND → WM_CLOSE → WM_DESTROY → WM_QUIT




1. WM_CLOSE
   - 윈도우가 닫히기 전에 메시지가 전달 된다.
   - 아직 윈도우가 파괴된 것은 아니므로 윈도우가 파괴되는 것을 중간에 제어 할 수 있다.
   - 윈도우의 “닫기” 를 누르거나, 키보드의 “Alt + F4”를 눌렀을 경우 발생



   - WM_CLOSE 의 핸들러(OnClose) 에서 추가적인 제어를 하지 않는다면 메시지는
      DefWindowsProc 로 보내진다.
   - CDialog::OnClose() 는 내부적으로 DestroyWindow() 함수를 호출 한다.
   - DestroyWindow() 함수는 내부적으로 WM_DESTROY 메시지를 발생 시킨다.


2. DestroyWindow()
   - CWnd내부에 있는 윈도우를 destroy 한다.
   - 윈도우를 해제하고 입력 포커스를 제거하기 위한 적절한 message를 윈도에게 보낸다.
   - 윈도우의 메뉴 제거 
   - application queue를 비운다.
   - timer를 제거
   - Clipboard의 소유주 제거
   - Clipboard-viewer chain을 끊는다. ( CWnd가 viewer chain의 맨 위에 있을 경우 )
   - WM_DESTROY(OnDestroy)와 WM_NCDESTROY(OnNcDestroy) 메시지를 윈도우 에게 보낸다.
     하지만 아직 CWnd 객체는 destroy하지 않는다.


3. WM_DESTROY
   - Framework이 CWnd에게 현재 CWnd가 소멸되고 있는 중이라고 알려 주기 위하여 호출 
   - 화면에 윈도우를 숨긴 후 메시지 발생, 아직 윈도우 자체는 파괴되지 않았다
   - DestroyWindows() 함수에서 발생 시킨다.
   - WM_CREATE 에 반대되는 동작을 수행 한다.
   - 차일드 윈도우가 있다면 이 메시지를 차례대로 전달 한다.
   - 메인 윈도우에서 PostQuitMessage() 함수를 반드시 호출하여 프로세스의 메시지 루프
     를 종료시켜야 한다. 그렇지 않다면 윈도우만 파괴되고 메시지 루프는 계속 실행중인
     상태가 되므로 프로세스가 종료되지 않는다.


4. WM_NCDESTROY
   - Client 영역이 아닌 영역이 Destroy 될 때 Framework 에 의하여 불려짐.
   - 윈도우가 소멸될 때 마지막으로 호출되는 메시지
   - 핸들러를 재정의 한다면 기본 호출 함수를 가장 위에서 해주자.

  
5. PostNcDestroy()
   - 윈도우가 소멸된 후 OnNcDestroy() 함수에 의해 불려지는 함수
   - 사용자들이 상속받아 만든 클래스의 정리를 위한 코드를 넣음.


6. View가 닫혀질 때 호출되는 핸들러 순서
BOOL CAniView::DestroyWindow()
{
 
// TODO: Add your specialized code here and/or call the base class
// 윈도우가 안보여 지기전에 해야 할 작업 처리
 
 return CView::DestroyWindow();
 
}
 
void CAniView::OnDestroy()
{
 
  CView::OnDestroy();
 
  // TODO: Add your message handler code here
 
}
 
void CAniView::PostNcDestroy()
{
 
  // TODO: Add your specialized code here and/or call the base class
 
  CView::PostNcDestroy();
 
}


7. WM_QUIT
   - 응용프로그램을 종료 하라는 메시지
   - PostQuitMessage() 가 발생 시키는 메시지
   - GetMessage() 함수가 0 을 리턴하도록 함으로써 메시지 루프를 종료
   - PeekMessage() 함수는 따로 WM_QUIT 메시지를 점검해야 한다.



자료 출처 : http://six605.tistory.com/257

Posted by +깡통+

 static const unsigned int maxNum = 16;
 GLuint m_image[maxNum];


 error C2258: illegal pure syntax, must be '= 0'
 error C2252: 'maxNum' : pure specifier can only be specified for functions
 error C2065: 'maxNum' : undeclared identifier
 error C2057: expected constant expression
 warning C4200: nonstandard extension used : zero-sized array in struct/union


이거 하나로 에러가 무진장 생기네요.
일단 원인 파악중...
말 그대로...  정적 상수 부호없는 정수 maxNum    ㅋㅋㅋ

문제해결!!  위 코드는 VS2005 에서는 잘 돌아가지만 VC++ 6.0 에서는 안됩니다.

클래스 선언과 변수 초기화는 동시에 불가능 하기 때문인데..
열거형 초기화는 가능합니다.
그래서 아래와 같이 변경하면 잘 됩니다 ^^

enum { maxNum = 16 };




Posted by +깡통+
다시 오래간만에 VS2005 (MFC)를 하게 되었습니다.
약 2년을 쉬었는데 -_- 다시 하려니 머리가 썩었나봐요..

warning C4819: 현재 코드 페이지(949)에서 표시할 수 없는 문자가 파일에 들어 있습니다. 데이터가 손실되지 않게 하려면 해당 파일을 유니코드 형식으로 저장하십시오.

해결방법
메뉴 -> 프로젝트 -> 속성 -> 구성속성 -> C/C++ -> 고급 -> 특정 경고 사용안함    항목에다가..

4819 라고 적어줍니다.
추가로 더 적을땐..   다음줄에 적으시던지 아래 방법으로 ^^
4819;4996
Posted by +깡통+
출처 : http://ultrasoo.linuxtop.co.kr/bbs/view.php?id=mfc&no=7
 
MFC 소켓 프로그래밍을 하기 위해서는 처음에 프로젝트를 생성할 때 MFC 응용 프로그램
마법사(MFC application wizard)에서 “Windows 소켓” 옵션을 선택해야 한다고 했다. 그런데
만약 이 옵션을 선택하지 않고 프로젝트를 생성했는데, 나중에 네트워크 프로그램을 추가해야 할
경우엔 어떻게 해야 할까?
처음에 “Windows 소켓”을 선택하지 않았다고 해서 프로젝트를 새로 만들고 코드를 복사해 넣는
수고를 할 필요는 없다. 사실 MFC 애플리케이션 위저드에서 “Windows 소켓” 옵션을 체크했을
때 추가되는 코드는 매우 간단한 것이다. 단지 하나의 함수를 호출해주는 코드를 삽입해 줄 뿐이다.
MFC 소켓을 사용하기 위해서는 AfxSocketInit이라는 함수를 먼저 호출해 주어야 한다. MFC
애플리케이션 위저드에서 “Windows 소켓” 옵션을 체크했을 때 추가되는 코드는
AfxSocketInit 함수를 호출해주는 코드를 삽입하는 것 뿐이다.
일반적으로 그 코드가 삽입되기에 가장 적절한 곳은 CWinApp 클래스를 상속받은 여러분의
클래스 파일의 InitInstance 함수 내에서이다. 만약 여러분이 생성한 프로젝트의 이름이
Test라면 CTestApp라는 클래스가 구현되어 있을 것이며, 그 클래스의 구현 파일(.cpp)에는
InitInstance 멤버 함수가 정의되어 있을 것이다. 이 함수 내에서 AfxSocketInit 함수를
호출하도록 코드를 넣어주면 된다.
아마 MFC 애플리케이션 위저드는 다음과 같은 코드를 자동으로 넣어줄 것이다.
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
IDP_SOCKETS_INIT_FAILED라는 상수는 string table에 있는 문자열인데, “Windows 소켓
을 초기화하지 못했습니다.”라는 문자열을 가리킨다. 따라서 여러분이 MFC 애플리케이션 위저드
에서 “Windows 소켓”을 선택하지 않고 직접 AfxSocketInit 함수를 호출해주려면
IDP_SOCKETS_INIT_FAILED 대신 “AfxSocketInit 호출에 실패했습니다.”와 같이 적절한
문자열을 직접 넣어주면 될 것이다.

참고로..
stdafx.h 파일에

#include <afxsock.h>  // MFC 소켓 확장

라인을 삽입해야한다~
Posted by +깡통+

클래스는 컬렉션 클래스로 링크드 리스트를 구현한 클래스이다.
따라서 CObject로부터 계승된 모든 클래스는 이 컬렉션 클래스의 적용
대상이 된다.

주요 멤버 함수로는 아래와 같다.

class CObList : public CObject


▷ CObList::AddHead - 헤드로 요소를 더함.
▷ CObList::CObList - 비어 있는 리스트를 구성.
▷ CObList::GetAt - 주어진 위치에서 요소를 얻음.
▷ CObList::GetHead - 헤드 요소를 반환.
▷ CObList::GetNext - 반복을 위한 요소를 얻음.
▷ CObList::GetPrev - 이전의 요소를 얻음.
▷ CObList::IsEmpty - 빈 리스트 상태를 테스트함.
▷ CObList::RemoveAll - 모든 요소를 제거.
▷ CObList::RemoveAt - 한 요소를 제거.


위 자료의 출처 : http://kin.naver.com/detail/detail.php?d1id=1&dir_id=10104&eid=IuVUJA9nZFYbYJerQH6ohtb9Ayp6MB7t&qb=Q09iTGlzdA==&enc=utf8&pid=fjXdldoi5U4ssZ/bdQZsss--134044&sid=SauQgTKLq0kAABxuE@8
 

Posted by +깡통+
2009. 2. 16. 13:14

We were unable to locate this content in ko-kr.

Here is the same content in en-us.

SetWindowPos Function

Changes the size, position, and Z order of a child, pop-up, or top-level window. These windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.

Syntax

BOOL SetWindowPos(      
    HWND hWnd,     HWND hWndInsertAfter,     int X,     int Y,     int cx,     int cy,     UINT uFlags );

Parameters

hWnd
[in] A handle to the window.
hWndInsertAfter
[in] A handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values.
HWND_BOTTOM
Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
HWND_NOTOPMOST
Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
HWND_TOP
Places the window at the top of the Z order.
HWND_TOPMOST
Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.
For more information about how this parameter is used, see the following Remarks section.
X
[in] Specifies the new position of the left side of the window, in client coordinates.
Y
[in] Specifies the new position of the top of the window, in client coordinates.
cx
[in] Specifies the new width of the window, in pixels.
cy
[in] Specifies the new height of the window, in pixels.
uFlags
[in] Specifies the window sizing and positioning flags. This parameter can be a combination of the following values.
SWP_ASYNCWINDOWPOS
If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.
SWP_DEFERERASE
Prevents generation of the WM_SYNCPAINT message.
SWP_DRAWFRAME
Draws a frame (defined in the window's class description) around the window.
SWP_FRAMECHANGED
Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
SWP_HIDEWINDOW
Hides the window.
SWP_NOACTIVATE
Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
SWP_NOCOPYBITS
Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
SWP_NOMOVE
Retains the current position (ignores X and Y parameters).
SWP_NOOWNERZORDER
Does not change the owner window's position in the Z order.
SWP_NOREDRAW
Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
SWP_NOREPOSITION
Same as the SWP_NOOWNERZORDER flag.
SWP_NOSENDCHANGING
Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
Retains the current size (ignores the cx and cy parameters).
SWP_NOZORDER
Retains the current Z order (ignores the hWndInsertAfter parameter).
SWP_SHOWWINDOW
Displays the window.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

As part of the Vista re-architecture, all services were moved off the interactive desktop into Session 0. hwnd and window manager operations are only effective inside a session and cross-session attempts to manipulate the hwnd will fail. For more information, see Session 0 Isolation.

If the SWP_SHOWWINDOW or SWP_HIDEWINDOW flag is set, the window cannot be moved or sized.

If you have changed certain window data using SetWindowLong, you must call SetWindowPos for the changes to take effect. Use the following combination for uFlags: SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED.

A window can be made a topmost window either by setting the hWndInsertAfter parameter to HWND_TOPMOST and ensuring that the SWP_NOZORDER flag is not set, or by setting a window's position in the Z order so that it is above any existing topmost windows. When a non-topmost window is made topmost, its owned windows are also made topmost. Its owners, however, are not changed.

If neither the SWP_NOACTIVATE nor SWP_NOZORDER flag is specified (that is, when the application requests that a window be simultaneously activated and its position in the Z order changed), the value specified in hWndInsertAfter is used only in the following circumstances.

  • Neither the HWND_TOPMOST nor HWND_NOTOPMOST flag is specified in hWndInsertAfter.
  • The window identified by hWnd is not the active window.

An application cannot activate an inactive window without also bringing it to the top of the Z order. Applications can change an activated window's position in the Z order without restrictions, or it can activate a window and then move it to the top of the topmost or non-topmost windows.

If a topmost window is repositioned to the bottom (HWND_BOTTOM) of the Z order or after any non-topmost window, it is no longer topmost. When a topmost window is made non-topmost, its owners and its owned windows are also made non-topmost windows.

A non-topmost window can own a topmost window, but the reverse cannot occur. Any window (for example, a dialog box) owned by a topmost window is itself made a topmost window, to ensure that all owned windows stay above their owner.

If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function.

To use SetWindowPos to bring a window to the top, the process that owns the window must have SetForegroundWindow permission.

Example

For an example, see Initializing a Dialog Box.

Function Information

Minimum DLL Version user32.dll
Header Declared in Winuser.h, include Windows.h
Import library User32.lib
Minimum operating systems Windows 95, Windows NT 3.1
Unicode Implemented as Unicode version.

See Also


Posted by +깡통+
흐미~
원놈의 경고가 이렇게 많이 뜨나 했다..
sprintf 가 아니가 sprintf_s 를 사용해야 된다.  쩝.
아래는 VS2005 에서 사용해야하는 함수 목록들..

http://msdn2.microsoft.com/en-us/library/ms235384(VS.80).aspx


Run-Time Library Reference 
Deprecated CRT Functions 

Deprecated CRT functions and their recommended replacements.

Deprecated POSIX functions

The following POSIX names for functions are deprecated. In most cases, prepending an underscore character gives the standard equivalent name. Note that some functions have more secure versions ("_s" suffix).

You can also eliminate POSIX deprecation warnings by defining _CRT_NONSTDC_NO_DEPRECATE.

Deprecated function Replacement function

access

_access, _access_s

cabs

_cabs

cgets

_cgets, _cgets_s

chdir

_chdir

chmod

_chmod

chsize

_chsize, _chsize_s

close

_close

cprintf

_cprintf, _cprintf_s

cputs

_cputs

creat

_creat

cscanf

_cscanf, _cscanf_s

cwait

_cwait

dup

_dup

dup2

_dup2

ecvt

_ecvt, _ecvt_s

eof

_eof

execl

_execl

execle

_execle

execlp

_execlp

execlpe

_execlpe

execv

_execv

execve

_execve

execvp

_execvp

execvpe

_execvpe

fcloseall

_fcloseall

fcvt

_fcvt, _fcvt_s

fdopen

_fdopen

fgetchar

_fgetchar

filelength

_filelength

fileno

_fileno

flushall

_flushall

fputchar

_fputchar, _fputwchar

gcvt

_gcvt, _gcvt_s

getch

_getch

getche

_getche

getcwd

_getcwd, _wgetcwd

getpid

_getpid

getw

_getw

hypot

_hypot

inp

_inp

inpw

_inpw

isascii

__isascii

isatty

_isatty

iscsym

__iscsym

iscsymf

__iscsymf

itoa

_itoa, _itoa_s

j0

_j0

j1

_j1

jn

_jn

kbhit

_kbhit

lfind

_lfind, _lfind_s

locking

_locking

lsearch

_lsearch, _lsearch_s

lseek

_lseek

ltoa

_ltoa, _ltoa_s

memccpy

_memccpy

memicmp

_memicmp

mkdir

_mkdir

mktemp

_mktemp, _mktemp_s

open

_open

outp

_outp

outpw

_outpw

putch

_putch

putenv

_putenv, _putenv_s

putw

_putw

read

_read

rmdir

_rmdir

rmtmp

_rmtmp

setmode

_setmode

sopen

_sopen, _sopen_s

spawnl

_spawnl

spawnle

_spawnle

spawnlp

_spawnlp

spawnlpe

_spawnlpe

spawnv

_spawnv

spawnve

_spawnve

spawnvp

_spawnvp

spawnvpe

_spawnvpe

strcmpi

_stricmp

strdup

_strdup

stricmp

_stricmp

strlwr

_strlwr, _strlwr_s

strnicmp

_strnicmp

strnset

_strnset, _strnset_s

strrev

_strrev

strset

_strset, _strset_s

strupr

_strupr, _strupr_s

swab

_swab

tell

_tell

tempnam

_tempnam

toascii

__toascii

tzset

_tzset

ultoa

_ultoa, _ultoa_s

umask

_umask, _umask_s

ungetch

_ungetch

unlink

_unlink

wcsdup

_wcsdup

wcsicmp

_wcsicmp

wcsicoll

_wcsicoll

wcslwr

_wcslwr, _wcslwr_s

wcsnicmp

_wcsnicmp

wcsnset

_wcsnset, _wcsnset_s

wcsrev

_wcsrev

wcsset

_wcsset, _wcsset_s

wcsupr

_wcsupr, _wcsupr_s

write

_write

y0

_y0

y1

_y1

yn

_yn

Security-enhanced functions

The following functions should be avoided because a more secure version of the function should be used instead. For more information, see Security Enhancements in the CRT.

Deprecated function Security-enhanced replacement

_alloca

_malloca

asctime

asctime_s

_cgets, _cgetws

_cgets_s, _cgetws_s

_chsize

_chsize_s

_controlfp

_controlfp_s

_creat

_sopen_s

_cscanf

_cscanf_s

_cscanf_l

_cscanf_s_l

ctime

ctime_s

_ctime32

_ctime32_s

_ctime64

_ctime64_s

_cwscanf

_cwscanf_s

_cwscanf_l

_cwscanf_s_l

_ecvt

_ecvt_s

_fcvt

_fcvt_s

fopen

fopen_s

freopen

freopen_s

fscanf

fscanf_s

_fscanf_l

_fscanf_s_l

fwscanf

fwscanf_s

_fwscanf_l

_fwscanf_s_l

_gcvt

_gcvt_s

getenv

getenv_s

gets, _getws

gets_s, _getws_s

gmtime

_gmtime_s

_gmtime32

_gmtime32_s

_gmtime64

_gmtime64_s

_i64toa

_i64toa_s

_i64tow

_i64tow_s

_itoa

_itoa_s

_itow

_itow_s

localtime

_localtime_s

_localtime32

_localtime32_s

_localtime64

_localtime64_s

_ltoa, _ltow

_ltoa_s, _ltow_s

_mbccpy

_mbccpy_s

_mbccpy_l

_mbccpy_s_l

_mbscat

_mbscat_s

_mbscpy

_mbscpy_s

_mbslwr, _mbslwr_l

_mbslwr_s, _mbslwr_s_l

_mbsnbcat, _mbsnbcat_l

_mbsnbcat_s, _mbsnbcat_s_l

_mbsnbcpy, _mbsnbcpy_l

_mbsnbcpy_s, _mbsnbcpy_s_l

_mbsnbset

_mbsnbset_s

_mbsnbset_l

_mbsnbset_s_l

_mbsncat

_mbsncat_s

_mbsncat_l

_mbsncat_s_l

_mbsncpy

_mbsncpy_s

_mbsncpy_l

_mbsncpy_s_l

_mbsnset

_mbsnset_s

_mbsnset_l

_mbsnset_s_l

mbsrtowcs

mbsrtowcs_s

_mbsset

_mbsset_s

_mbsset_l

_mbsset_s_l

_mbstok

_mbstok_s

_mbstok_l

_mbstok_s_l

mbstowcs, _mbstowcs_l

mbstowcs_s, _mbstowcs_s_l

_mbsupr, _mbsupr_l

_mbsupr_s, _mbsupr_s_l

memcpy

memcpy_s

memmove

memmove_s

_mktemp

_mktemp_s

_open

_sopen_s

scanf

scanf_s

_scanf_l

_scanf_s_l

_searchenv

_searchenv_s

setbuf

setvbuf

_snprintf

_snprintf_s

_snprintf_l

_snprintf_s_l

_snscanf

_snscanf_s

_snscanf_l

_snscanf_s_l

_snwprintf

_snwprintf_s

_snwprintf_l

_snwprintf_s_l

_snwscanf

_snwscanf_s

_snwscanf_l

_snwscanf_s_l

_sopen

_sopen_s

_splitpath

_splitpath_s

sprintf

sprintf_s

_sprintf_l

_sprintf_s_l

sscanf

sscanf_s

_sscanf_l

_sscanf_s_l

strcat

strcat_s

strcpy

strcpy_s

_strdate

_strdate_s

strerror, _strerror

strerror_s, _strerror_s

_strlwr, _strlwr_l

_strlwr_s, _strlwr_s_l

strncat, _strncat_l

strncat_s, _strncat_s_l

strncpy, _strncpy_l

strncpy_s, _strncpy_s_l

_strnset

_strnset_s

_strnset_l

_strnset_s_l

_strset

_strset_s

_strset_l

_strset_s_l

_strtime

_strtime_s

strtok

strtok_s

_strtok_l

_strtok_s_l

_strupr, _strupr_l

_strupr_s, _strupr_s_l

swprintf

swprintf_s

_swprintf_l

_swprintf_s_l

swscanf

swscanf_s

_swscanf_l

_swscanf_s_l

tmpfile

tmpfile_s

_ui64toa, _ui64tow

_ui64toa_s, _ui64tow_s

_ultoa, _ultow

_ultoa_s, _ultow_s

_umask

_umask_s

vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l

vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l

vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l

vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l

_wasctime

_wasctime_s

_wcreat

_wsopen_s

wcrtomb

wcrtomb_s

wcscat

wcscat_s

wcscpy

wcscpy_s

_wcserror, __wcserror

_wcserror_s, __wcserror_s

_wcslwr, _wcslwr_l

_wcslwr_s, _wcslwr_s_l

wcsncat, wcsncat_l

wcsncat_s, _wcsncat_s_l

_wcsncpy, _wcsncpy_l

wcsncpy_s, _wcsncpy_s_l

_wcsnset, _wcsnset_l

_wcsnset_s, _wcsnset_s_l

wcsrtombs

wcsrtombs_s

_wcsset, _wcsset_l

_wcsset_s_wcsset_s_l

wcstok, _wcstok_l

wcstok_s, _wcstok_s_l

wcstombs, _wcstombs_l

wcstombs_s, _wcstombs_s_l

_wcsupr_l, _wcsupr

_wcsupr_s, _wcsupr_s_l

_wctime, _wctime32, _wctime64

_wctime_s, _wctime32_s, _wctime64_s

wctomb, _wctomb_l

wctomb_s, _wctomb_s_l

_wfopen

_wfopen_s

_wfreopen

_wfreopen_s

_wgetenv

_wgetenv_s

wmemcpy

wmemcpy_s

wmemmove

wmemmove_s

_wmktemp

_wmktemp_s

_wopen

_wsopen_s

_wscanf, _wscanf_l

_wscanf_s, _wscanf_s_l

_wsearchenv

_wsearchenv_s

_wsopen

_wsopen_s

_wsplitpath

_wsplitpath_s

_wstrdate

_wstrdate_s

_wstrtime

_wstrtime_s

Functions with Secure Template Overloads

Posted by +깡통+
와 장장 이틀동안 검색과 삽질의 결과물 입니다 ㅠㅠ..

누가보면 미련하기 짝이 없겠죠?

이렇게 얻은 수확물은 평생 머리속에서 빠져 나가지 않을 것입니다.

아래 구문을 잘 봐야 합니다.
SDK 에서 설명하기로는 m_Player 의 .GetCurrentMedia() 로 연결하라고 되어 있습니다.
이렇게하면 GetDuration() 에 불량한 값이 나옵니다.

double nDur = m_Player.GetControls().GetCurrentItem().GetDuration();

이렇게 시도하니 잘 됩니다.
하지만 프로그램 종료시 디버그 창을 속출합니다.


BOOL CWMP11SampleDlg::OnInitDialog()
{
 CDialog::OnInitDialog();
 ...
 m_clsWMPSettings = m_ctrWMP.GetSettings();
 m_clsWMPControl = m_ctrWMP.GetControls();
 m_clsWMPMedia = m_ctrWMP.GetCurrentMedia();  // 이렇게 하시면 낭패 입니다.
 m_clsWMPMedia = m_ctrWMPControl.GetCurrentItem();  // 이렇게 하셔도 낭패 입니다.
 ...
SetTimer(1, 1000, NULL);
}

void CWMP11SampleDlg::OpenStateChangeOcxWmp(long NewState)
{
 // TODO: 여기에 메시지 처리기 코드를 추가합니다.
 switch(NewState)
 {
 case 13: //  MediaOpen
  m_clsWMPMedia = m_clsWMPControl.GetCurrentItem(); // 이쯤에서 받아 들이십시오.  -_- 휴~
  m_ctlTime.SetRange(0, (int)m_clsWMPMedia.GetDuration(), TRUE);
  m_ctlTime.SetPos(0);
  break;
 }
 pEdit->SetWindowTextA(strTemp);
}


void CWMP11SampleDlg::OnTimer(UINT_PTR nIDEvent)
{
 // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
 switch(nIDEvent)
 {
 case 1:
  m_ctlTime.SetPos((int)m_clsWMPControl.GetCurrentPosition());
 }
 CDialog::OnTimer(nIDEvent);
}
Posted by +깡통+
 [답변]원하는 내용이 무엇인지 잘모르겠습니다면... 2002-07-10 오후 5:53:00
정용철 번호: 212603   / 평점:  (-)  
꼭 필요한 함수만 찍어드리겠습니다.
연습해보세요.

즐프~

√  double GetCurrentPosition();        //현재위치
√      void SetCurrentPosition(double newValue);    //현재위치 설정
√      double GetDuration();      // 전체길이
    long GetImageSourceWidth();
    long GetImageSourceHeight();
    long GetMarkerCount();
    BOOL GetCanScan();
    BOOL GetCanSeek();
    BOOL GetCanSeekToMarkers();
    long GetCurrentMarker();
    void SetCurrentMarker(long nNewValue);
    CString GetFileName();
√      void SetFileName(LPCTSTR lpszNewValue);    //재생할 파일이름
    CString GetSourceLink();
    DATE GetCreationDate();
    CString GetErrorCorrection();
    long GetBandwidth();
    long GetSourceProtocol();
    long GetReceivedPackets();
    long GetRecoveredPackets();
    long GetLostPackets();
    long GetReceptionQuality();
    long GetBufferingCount();
    BOOL GetIsBroadcast();
    long GetBufferingProgress();
    CString GetChannelName();
    CString GetChannelDescription();
    CString GetChannelURL();
    CString GetContactAddress();
    CString GetContactPhone();
    CString GetContactEmail();
    double GetBufferingTime();
    void SetBufferingTime(double newValue);
    BOOL GetAutoStart();
√      void SetAutoStart(BOOL bNewValue);     //자동시작
√      BOOL GetAutoRewind();                           //자동 되감기 얻기
√      void SetAutoRewind(BOOL bNewValue);      //자동되감기
√      double GetRate();                               //재생속도  0.0 < x <2.0
√      void SetRate(double newValue);         //재생속도 설정
    BOOL GetSendKeyboardEvents();
    void SetSendKeyboardEvents(BOOL bNewValue);
    BOOL GetSendMouseClickEvents();
    void SetSendMouseClickEvents(BOOL bNewValue);  
    BOOL GetSendMouseMoveEvents();
    void SetSendMouseMoveEvents(BOOL bNewValue);
    long GetPlayCount();
    void SetPlayCount(long nNewValue);
    BOOL GetClickToPlay();
√      void SetClickToPlay(BOOL bNewValue);
    BOOL GetAllowScan();
    void SetAllowScan(BOOL bNewValue);
    BOOL GetEnableContextMenu();
    void SetEnableContextMenu(BOOL bNewValue);
    long GetCursorType();
    void SetCursorType(long nNewValue);
    long GetCodecCount();
    BOOL GetAllowChangeDisplaySize();
    void SetAllowChangeDisplaySize(BOOL bNewValue);
    BOOL GetIsDurationValid();
    long GetOpenState();
    BOOL GetSendOpenStateChangeEvents();
    void SetSendOpenStateChangeEvents(BOOL bNewValue);
    BOOL GetSendWarningEvents();
    void SetSendWarningEvents(BOOL bNewValue);
    BOOL GetSendErrorEvents();
    void SetSendErrorEvents(BOOL bNewValue);
√      long GetPlayState();
    BOOL GetSendPlayStateChangeEvents();
    void SetSendPlayStateChangeEvents(BOOL bNewValue);
    long GetDisplaySize();
    void SetDisplaySize(long nNewValue);
    BOOL GetInvokeURLs();
    void SetInvokeURLs(BOOL bNewValue);
    CString GetBaseURL();
    void SetBaseURL(LPCTSTR lpszNewValue);
    CString GetDefaultFrame();
    void SetDefaultFrame(LPCTSTR lpszNewValue);
    BOOL GetHasError();
    CString GetErrorDescription();
    long GetErrorCode();
    BOOL GetAnimationAtStart();
    void SetAnimationAtStart(BOOL bNewValue);
    BOOL GetTransparentAtStart();
    void SetTransparentAtStart(BOOL bNewValue);
    long GetVolume();
    void SetVolume(long nNewValue);
    long GetBalance();
    void SetBalance(long nNewValue);
    long GetReadyState();
    double GetSelectionStart();
    void SetSelectionStart(double newValue);
    double GetSelectionEnd();
    void SetSelectionEnd(double newValue);
    BOOL GetShowDisplay();
    void SetShowDisplay(BOOL bNewValue);
    BOOL GetShowControls();
    void SetShowControls(BOOL bNewValue);
    BOOL GetShowPositionControls();
    void SetShowPositionControls(BOOL bNewValue);
    BOOL GetShowTracker();
    void SetShowTracker(BOOL bNewValue);
    BOOL GetEnablePositionControls();
    void SetEnablePositionControls(BOOL bNewValue);
    BOOL GetEnableTracker();
    void SetEnableTracker(BOOL bNewValue);
    BOOL GetEnabled();
    void SetEnabled(BOOL bNewValue);
    unsigned long GetDisplayForeColor();
    void SetDisplayForeColor(unsigned long newValue);
    unsigned long GetDisplayBackColor();
    void SetDisplayBackColor(unsigned long newValue);
    long GetDisplayMode();
    void SetDisplayMode(long nNewValue);
    BOOL GetVideoBorder3D();
    void SetVideoBorder3D(BOOL bNewValue);
    long GetVideoBorderWidth();
    void SetVideoBorderWidth(long nNewValue);
    unsigned long GetVideoBorderColor();
    void SetVideoBorderColor(unsigned long newValue);
    BOOL GetShowGotoBar();
    void SetShowGotoBar(BOOL bNewValue);
    BOOL GetShowStatusBar();
    void SetShowStatusBar(BOOL bNewValue);
    BOOL GetShowCaptioning();
    void SetShowCaptioning(BOOL bNewValue);
    BOOL GetShowAudioControls();
    void SetShowAudioControls(BOOL bNewValue);
    CString GetCaptioningID();
    void SetCaptioningID(LPCTSTR lpszNewValue);
    BOOL GetMute();
    void SetMute(BOOL bNewValue);
    BOOL GetCanPreview();
    BOOL GetPreviewMode();
    void SetPreviewMode(BOOL bNewValue);
    BOOL GetHasMultipleItems();
    long GetLanguage();
    void SetLanguage(long nNewValue);
    long GetAudioStream();
    void SetAudioStream(long nNewValue);
    CString GetSAMIStyle();
    void SetSAMIStyle(LPCTSTR lpszNewValue);
    CString GetSAMILang();
    void SetSAMILang(LPCTSTR lpszNewValue);
    CString GetSAMIFileName();
    void SetSAMIFileName(LPCTSTR lpszNewValue);
    long GetStreamCount();
    CString GetClientId();
    long GetConnectionSpeed();
    BOOL GetAutoSize();
    void SetAutoSize(BOOL bNewValue);
    BOOL GetEnableFullScreenControls();
    void SetEnableFullScreenControls(BOOL bNewValue);
    LPDISPATCH GetActiveMovie();
    LPDISPATCH GetNSPlay();
    BOOL GetWindowlessVideo();
    void SetWindowlessVideo(BOOL bNewValue);
√      void Play();
√      void Stop();
√      void Pause();
    double GetMarkerTime(long MarkerNum);
    CString GetMarkerName(long MarkerNum);
    void AboutBox();
    BOOL GetCodecInstalled(long CodecNum);
    CString GetCodecDescription(long CodecNum);
    CString GetCodecURL(long CodecNum);
    CString GetMoreInfoURL(long MoreInfoType);
    CString GetMediaInfoString(long MediaInfoType);
    void Cancel();
    void Open(LPCTSTR bstrFileName);
    BOOL IsSoundCardEnabled();
√      void Next();
√      void Previous();
    void StreamSelect(long StreamNum);
√      void FastForward();
√      void FastReverse();
    CString GetStreamName(long StreamNum);
    long GetStreamGroup(long StreamNum);
    BOOL GetStreamSelected(long StreamNum);
    CMediaPlayerDvd GetDvd();
    CString GetMediaParameter(long EntryNum, LPCTSTR bstrParameterName);
    CString GetMediaParameterName(long EntryNum, long Index);
    long GetEntryCount();
    long GetCurrentEntry();
    void SetCurrentEntry(long EntryNumber);
    void ShowDialog(long mpDialogIndex);

Posted by +깡통+
Windows Media Player SDK banner art
Previous Next

Player.playState

The playState property retrieves a value indicating the state of the Windows Media Player operation.

Syntax

player.playState

Possible Values

This property is a read-only Number (long). The C-style enumeration constant can be derived by prefixing the state value with "wmpps". For example, the constant for the Playing state is wmppsPlaying.

Value State Description
0 Undefined Windows Media Player is in an undefined state.
1 Stopped Playback of the current media item is stopped.
2 Paused Playback of the current media item is paused. When a media item is paused, resuming playback begins from the same location.
3 Playing The current media item is playing.
4 ScanForward The current media item is fast forwarding.
5 ScanReverse The current media item is fast rewinding.
6 Buffering The current media item is getting additional data from the server.
7 Waiting Connection is established, but the server is not sending data. Waiting for session to begin.
8 MediaEnded Media item has completed playback.
9 Transitioning Preparing new media item.
10 Ready Ready to begin playing.
11 Reconnecting Reconnecting to stream.

Remarks

Windows Media Player states are not guaranteed to occur in any particular order. Furthermore, not every state necessarily occurs during a sequence of events. You should not write code that relies upon state order.

Example Code

The following JScript code shows the use of the player.playState property. An HTML text element, named "myText", displays the current status. The Player object was created with ID = "Player".

// Test whether Windows Media Player is in the playing state.
if (3 == Player.playState)
    myText.value = "Windows Media Player is playing!";
else
    myText.value = "Windows Media Player is NOT playing!";

Requirements

Version: Windows Media Player version 7.0 or later.

Header: Defined in wmp.idl; include wmp.h.

Library: Use wmp.dll.

Posted by +깡통+
http://msdn.microsoft.com/ko-kr/windowsmedia/bb190309(en-us).aspx

Windows Media Downloads

Microsoft® Windows Media® consists of a number of software components that you can use to create complete streaming media solutions. Within each component is a suite of related programs, plug-ins, tools, and utilities. Together, these components provide an end-to-end solution for streaming multimedia, from content authoring to delivery and playback.

Latest Windows Media Downloads

Windows Media Rights Manager 10.1.1 SDK

Introduces new features to help you manage large numbers of licenses more easily, revoke specific licenses, and use new rights to support consumer scenarios like sharing music or burning playlists to CDs. Also use this SDK to work with portable devices that support Windows Media DRM 10 for Portable Devices. The Windows Media Rights Manager 10.1.1 SDK will be sent to you after Microsoft accepts a signed SDK license agreement from you. You will also need to obtain digital certificates to verify your identity.

Windows Media Format 11 SDK
Introduces a variety of new digital rights management features.
Windows SDK for Windows Vista
The latest versions for most Windows Media developer technologies are included in the Windows SDK for Windows Vista. Download and install the Windows SDK to get the Windows Meda Player 11 SDK, the Media Foundation SDK, Windows Portable Devices, the Core Audio APIs, and more.
Media Transfer Protocol Porting Kit
Introduces the new Media Transfer Protocol (MTP), which enables you to manage content on any portable device with storage. MTP was first shipped as part of the Windows Media Device Manager 10 SDK. This porting kit includes the complete MTP specification, design documentation, sample source code, software to implement a PC-based MTP simulator, and MTP test tools. The latest version of the MTP Porting Kit includes thoroughly updated ANSI C source code as well as a redistributable MTP driver for Windows 98 Second Edition, Windows Millennium Edition, and Windows 2000 operating systems. This driver is implemented as a Windows Media Device Manager Service Provider and supports device access through Windows Media Player 9 Series and other device applications that work on the Windows Media Format 9 Series Software Development Kit (SDK).
Windows Media Services 9 Series SDK
Part of the Microsoft Platform SDK for Windows Server 2003, the Windows Media Services 9 Series SDK enables you to programmatically control, configure, and monitor a server running Windows Media Services 9 Series.
Windows Media Device Manager 10 SDK
Introduces new features to help you work with devices that support the new Media Transfer Protocol (MTP), devices that support a modified Windows CE (Pocket PC) class driver, and mass storage devices exposed by the new Microsoft Cluster (MSC) class driver. The Windows Media Device Manager 10 SDK is included in the Windows Media Format 9.5 SDK. You will also need to obtain digital certificates to enable transfer of content protected by Windows Media digital rights management (DRM).

Older Windows Media Downloads

Windows Media Player 10 SDK
The Microsoft Windows Media Player 10 SDK provides information and tools to customize Windows Media Player and to use the Windows Media Player ActiveX® control. This documentation also provides information about using Windows Media metafiles.
Windows Media Format 9.5 SDK
This update to the Windows Meda Format 9 Seres SDK provdes several improvements including the Windows Media Video Advanced Profile codec and an improved Windows Media Video Image codec. Unlke the Windows Media Format 9 Seres SDK, this verson requires Windows XP or later.
Sample Code for Using the Windows Media Audio and Video Codec Interfaces
This package includes documentation and sample code that demonstrate how to use the Codec APIs in the Windows Media Format 9 Series SDK.
Windows Media Format 9 Series SDK
With support for the Windows Media Audio and Video codecs, the Windows Media Format SDK provides technology and documentation you can use to create and manipulate Windows Media files in your applications.
Windows Media Encoder 9 Series SDK
The Microsoft Windows Media Encoder 9 Series SDK is designed for anyone who wants to develop a Windows Media Encoder application by using a powerful automation-based application programming interface (API).
Windows Media Rights Manager 9 Series SDK
This SDK provides the tools to create an end-to-end digital rights management (DRM) system that offers content providers and retailers a flexible platform for the secure distribution of digital media files. The Windows Media Rights Manager 9 Series SDK will be sent to you after Microsoft accepts a signed SDK license agreement from you. You will also need to obtain digital certificates to verify your identity.
Windows Media Services 4.1 SDK
The Windows Media Services 4.1 SDK component enables content developers and system administrators to support Windows Media Technologies in their Web sites today.

Posted by +깡통+

http://msdn.microsoft.com/windowsmedia/downloads/default.aspx

 

Windows Media Downloads

Microsoft® Windows Media® 9 Series consists of a number of software components that you can use to create complete streaming media solutions. Within each component is a suite of related programs, plug-ins, tools, and utilities. Together, these components provide an end-to-end solution for streaming multimedia, from content authoring to delivery and playback.   


Latest Windows Media Downloads

  • Media Transfer Protocol Porting Kit

    Introduces the new Media Transfer Protocol (MTP), which enables you to manage content on any portable device with storage. MTP was first shipped as part of the Windows Media Device Manager 10 SDK. This porting kit includes the complete MTP specification, design documentation, sample source code, software to implement a PC-based MTP simulator, and MTP test tools.

    The latest version of the MTP Porting Kit includes thoroughly updated ANSI C source code as well as a redistributable MTP driver for Windows 98 Second Edition, Windows Millennium Edition, and Windows 2000 operating systems. This driver is implemented as a Windows Media Device Manager Service Provider and supports device access through Windows Media Player 9 Series and other device applications that work on the Windows Media Format 9 Series Software Development Kit (SDK).
      

  • Windows Media Services 9 Series SDK

    Part of the Microsoft Platform SDK for Windows Server 2003, the Windows Media Services 9 Series SDK enables you to programmatically control, configure, and monitor a server running Windows Media Services 9 Series.   

  • Windows Media Format 9.5 SDK

    Introduces new features to provide enhanced content security and flexibility. Includes a new version of the Windows Media Video Image codec, as well as support for the new Windows Media Video 9 Advanced Profile.   

  • Windows Media Player 10 SDK

    Introduces a range of new features and functionality for customizing Windows Media Player and using the Windows Media Player control. Some of the features represent entirely new Player technologies; others extend and update existing technologies to enable new scenarios.   

  • Windows Media Device Manager 10 SDK

    Introduces new features to help you work with devices that support the new Media Transfer Protocol (MTP), devices that support a modified Windows CE (Pocket PC) class driver, and mass storage devices exposed by the new Microsoft Cluster (MSC) class driver. The Windows Media Device Manager 10 SDK is included in the Windows Media Format 9.5 SDK. You will also need to obtain digital certificates to enable transfer of content protected by Windows Media digital rights management (DRM).   

  • Windows Media Rights Manager 10 SDK

    Introduces new features to help you manage large numbers of licenses more easily, revoke specific licenses, and use new rights to support consumer scenarios like sharing music or burning playlists to CDs. Also use this SDK to work with portable devices that support Windows Media DRM 10 for Portable Devices. The Windows Media Rights Manager 10 SDK will be sent to you after Microsoft accepts a signed SDK license agreement from you. You will also need to obtain digital certificates to verify your identity.   

Older Windows Media Downloads

  • Windows Media Device Manager 9 Series SDK

    Installed along with the Windows Media Format 9 Series SDK, the Windows Media Device Manager SDK provides technology and documentation to enable the transfer of audio content to portable audio players. The Windows Media Device Manager SDK can be used either to construct an application which transfers audio content to a portable audio player or to construct a Service Provider, a high level software driver used by Windows Media Device Manager applications to access a class of audio players.

    The Windows Media Device Manager SDK is included in the Windows Media Format 9 Series SDK which you can obtain by clicking on the link above. If your application does not need to manipulate content protected with Microsoft digital rights management, the Windows Media Format SDK click-through EULA grants use and distribution rights for applications. If your Windows Media Device Manager-based application manipulates protected content, you should request the Windows Media Device Manager SDK DRM Agreement. For more information refer to the Windows Media Licensing Form.
      

  • Sample Code for Using the Windows Media Audio and Video Codec Interfaces

    This package includes documentation and sample code that demonstrate how to use the Codec APIs in the Windows Media Format 9 Series SDK.   

  • Windows Media Format 9 Series SDK

    With support for the new Windows Media Audio and Video 9 Series codecs, the Windows Media Format SDK provides technology and documentation you can use to create and manipulate Windows Media files in your applications.

    Before you can download the SDK, you must first register with Microsoft by filling out the form at the above link. Instructions on how to download this software will then be e-mailed to you. If your application does not need to manipulate content protected with Microsoft digital rights management, you can simply accept the new Windows Media Format 9 Series SDK click-through EULA. The click-through EULA grants use and distribution rights if you do not need to manipulate DRM content. If your application needs access to protected content, you should request a Windows Media Format SDK DRM Certificate Agreement. For more information refer to the Windows Media Licensing Form.
      

  • Windows Media Player 9 Series SDK

    The Microsoft Windows Media Player 9 Series SDK provides information and tools to customize Windows Media Player and to use the Windows Media Player ActiveX® control. This documentation also provides information about using Windows Media metafiles.   

  • Windows Media Encoder 9 Series SDK

    The Microsoft Windows Media Encoder 9 Series SDK is designed for anyone who wants to develop a Windows Media Encoder application by using a powerful automation-based application programming interface (API).   

  • Windows Media Rights Manager 9 Series SDK

    This SDK provides the tools to create an end-to-end digital rights management (DRM) system that offers content providers and retailers a flexible platform for the secure distribution of digital media files. The Windows Media Rights Manager 9 Series SDK will be sent to you after Microsoft accepts a signed SDK license agreement from you. You will also need to obtain digital certificates to verify your identity.   

  • Windows Media Services 4.1 SDK

    The Windows Media Services 4.1 SDK component enables content developers and system administrators to support Windows Media Technologies in their Web sites today.    


Posted by +깡통+

 [답변]자답입니다 // 혹시 정확한 사용방법 아시는 분 계시면 꼭 알려주십시오 2005-01-18 오후 11:58:52
동구니 (nethe)  동구니님께 메시지 보내기동구니님을 내 주소록에 추가합니다.동구니님의 개인게시판 가기 번호: 494156   / 평점:  (-)  

 아무리 제가 해놓고 봐도 SDK와는 다릅니다. SDK의 이코드 저코드 끌어쓰다보니 어떻게 해결은 했습니다.

 

먼저 보통 방법처럼 windows media player ActiveX 콤포넌트를 삽입합니다. 그다음 변수지정하면 임의의 소스화일과 헤더화일이 생기는데 (CWMPPlayer4 기반입니다) 이걸 무시하고 그냥 콥포넌트를 삽입한 헤더에 CWMPPlayer [변수명] 형태로 바꾸어 줍니다.

 

다음 구현부분에서 현재의 CWMPPlaeyr 인터페이스 대신 자신이 사용하고 싶은 인터페이스를 불러옵니다. 여기서 인터페이스란 문자그대로 인터페이스 입니다. 미디어 플레이어의 다양한 기능을 각 부문별로 포장해놓은 패키지라고 생각하면 됩니다.

 

방법은 다음과 같습니다.

 

1) 지금 사용중인 미디어플레이어 개체에서 사용하고자 하는 인터페이스 포인터를 얻는다

2) queryinterface 명령으로 임의의 인터페이스에 1)에서 구한 포인터값을 넘긴다.

3) 임의의 인터페이스를 사용한다

4) 사용을 완료한 인터페이스 포인터를 반납한다.

 

 

// 헤더

 

#include "CWMPPlayer.h" // 프로젝트>클레스 추가>ActiveX의...> windows media player 에서 CWMPPlayer을 찾아추가합니다.

#include "wmp.h" // 미디어플레이어10의 SDK 에 삽입되어있습니다.

 

class Cmp10View : public CFormView

{

    ...

 

    // CNonameClass m_Player

    CWMPPlayer m_Player;

 

    ...

};

 

 

 

// 소스

void Cmp10View::OnBnClickedPlay()

{

    IDispatch *pSettings = NULL;

    IWMPControls *pSettings2 = NULL; // 임의의 인터페이스, 여기서는 컨트롤 인터페이스

    HRESULT hr = S_OK;

 

    // Get a pointer to the IDispatch interface from CWMPSettings.

    pSettings = m_Player.get_controls(); // get_controls는 컨트롤 인터페이스의 포인터를 반환합니다.

 

    if( pSettings != NULL )

    {

        // Get a pointer to the IWMPSettings2 interface.

        hr = pSettings->QueryInterface(&pSettings2); // 임의의 컨트롤 인터페이스에 현재 사용중인 컨트롤 인터페이스의 포인터를 넘깁니다

        if( SUCCEEDED( hr ) )

        {

            hr = pSettings2->play();  // 컨트롤 인터페이스를 사용합니다.

        }

 

        // Don't forget to call release through the pointers.

        if( pSettings )

        {

            pSettings->Release();

        }

 

        if( pSettings2 )

        {

            pSettings2->Release();

        }

    }

}

 

 

일단 문제 없이 작동합니다만, 이것 말고 정석이 있을것으로 사료됩니다.

 


Posted by +깡통+
error C2146: 구문 오류 : ';'이(가) 'PVOID64' 식별자 앞에 없습니다.
 
이렇게 되어 있던것을
typedef void *PVOID;
typedef void * POINTER_64 PVOID64;   
 
아래처럼 바꾸자.
typedef void* PVOID;
typedef void* POINTER_64;
typedef POINTER_64 PVOID64;

Posted by +깡통+
Player.uiMode

The uiMode property specifies or retrieves a value indicating which controls are shown in the user interface.

Syntax

player.uiMode

Possible Values

This property is a read/write String.

Value Description Audio example Video example
invisible Windows Media Player is embedded without any visible user interface (controls, video or visualization window). (Nothing is displayed.) (Nothing is displayed.)
none Windows Media Player is embedded without controls, and with only the video or visualization window displayed.
mini Windows Media Player is embedded with the status window, play/pause, stop, mute, and volume controls shown in addition to the video or visualization window.
full Default. Windows Media Player is embedded with the status window, seek bar, play/pause, stop, mute, next, previous, fast forward, fast reverse, and volume controls in addition to the video or visualization window.
custom Windows Media Player is embedded with a custom user interface. Can only be used in C++ programs. (Custom user interface is displayed.) (Custom user interface is displayed.)

Remarks

This property specifies the appearance of the embedded Windows Media Player. When uiMode is set to "none", "mini", or "full", a window is present for the display of video clips and audio visualizations. This window can be hidden in mini or full mode by setting the height attribute of the OBJECT tag to 40, which is measured from the bottom, and leaves the controls portion of the user interface visible. If no embedded interface is desired, set both the width and height attributes to zero.

If uiMode is set to "invisible", no user interface is displayed, but space is still reserved on the page as specified by width and height. This is useful for retaining page layout when uiMode can change. Additionally, the reserved space is transparent, so any elements layered behind the control will be visible.

If uiMode is set to "full" or "mini", Windows Media Player displays transport controls in full-screen mode. If uiMode is set to "none", no controls are displayed in full-screen mode.

If the window is visible and audio content is being played, the visualization displayed will be the one most recently used in Windows Media Player.

If uiMode is set to "custom" in a C++ program that implements IWMPRemoteMediaServices, the skin file indicated by IWMPRemoteMediaServices::GetCustomUIMode is displayed.

During full-screen playback, Windows Media Player hides the mouse cursor when enableContextMenu equals false and uiMode equals "none".

Example Code

The following example creates an HTML SELECT element that allows the user to change the user interface for an embedded Player object. The Player object was created with ID = "Player".

<!-- Create an HTML SELECT element. -->
<SELECT  ID = UI  LANGUAGE="JScript"

         /* Specify the UI mode the user selects. */
         onChange = "Player.uiMode = UI.value">

/* These are the four UI mode options. */
<OPTION VALUE="invisible">Invisible
<OPTION VALUE="none">No Controls
<OPTION VALUE="mini">Mini Player
<OPTION VALUE="full">Full Player
</SELECT>

Windows Media Player 10 Mobile: This property only accepts or returns values of "none" or "full". On Smartphone devices, only playback status and a counter are displayed when uiMode is set to "full".

Requirements

Version: Windows Media Player version 7.0 or later. Windows Media Player 9 Series or later for "invisible" or "custom".

Library: Use wmp.dll.

See Also


Posted by +깡통+

--------------------Configuration: Player - Win32 Debug--------------------
Compiling...
playwnd.cpp
Linking...
playwnd.obj : error LNK2001: unresolved external symbol _IID_IBasicAudio
playwnd.obj : error LNK2001: unresolved external symbol _IID_IBasicVideo
playwnd.obj : error LNK2001: unresolved external symbol _IID_IVideoWindow
playwnd.obj : error LNK2001: unresolved external symbol _IID_IMediaPosition
playwnd.obj : error LNK2001: unresolved external symbol _IID_IMediaSeeking
playwnd.obj : error LNK2001: unresolved external symbol _IID_IMediaEventEx
playwnd.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
playwnd.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
playwnd.obj : error LNK2001: unresolved external symbol _IID_IGraphBuilder
Debug/Player.exe : fatal error LNK1120: 9 unresolved externals
Error executing link.exe.

Player.exe - 10 error(s), 0 warning(s)


해결방법
Project -> Setting -> Link -> strmiids.lib 를 추가한다.

Posted by +깡통+
Posted by +깡통+

그래프에디터다 앞으로 친숙해져야 할 놈..

메모 *
비디오 렌더 필터와 오디오 렌더 필터
다이렉트쇼에서 제공하는 기본 필터 중에서 비디오 렌더(Video Renderer) 필터와 오디오 렌터(Default DirectSound Device) 필터가 가장 널리 쓰인다. 이 필터들은 비디오나 오디오 스트림에 렌더링을 수행하면 자동으로 추가되기 때문에 쉽게 구할 수 있다.
그러나 더 많은 필터가 필요하다면 필터 대화상자를 통해 필터를 추가해야 한다.
비디오 렌더 필터는 DirectShow Filters 범주에 있으며
오디오 렌더 필터는 Audio Renderers 범주에 있다.



Posted by +깡통+
다이렉트 쇼는 마이크로소프트웨어사에서 만들어 놓은 재미있는 기능이다.
신화선 님의 DirectShow 멀티미디어 프로그래밍 ( 국내 유일 ) 책을 가지고 공부하자.

Posted by +깡통+

CButton 을 상속받는 클래스를 만들어 처리합니다.


// MSNButton.cpp : 구현 파일입니다.
//

#include "stdafx.h"
#include "ImageButton.h"
#include "MSNButton.h"


// CMSNButton

IMPLEMENT_DYNAMIC(CMSNButton, CButton)

CMSNButton::CMSNButton()
{
 m_bTracking = FALSE;
 m_bHover = FALSE;
}

CMSNButton::~CMSNButton()
{
}


BEGIN_MESSAGE_MAP(CMSNButton, CButton)
 ON_WM_DRAWITEM()
 ON_MESSAGE(WM_MOUSELEAVE, OnMouseLeave)
 ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover)
 ON_WM_MOUSEMOVE()
END_MESSAGE_MAP()

 

// CMSNButton 메시지 처리기입니다.

void CMSNButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{

 // TODO:  지정된 항목을 그리는 코드를 추가합니다.
 CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
 CDC MemDC;
 MemDC.CreateCompatibleDC(pDC);

 BITMAP bmpInfo;
 CBitmap Bmp;
 CBitmap* pOldBitmap = NULL;
 Bmp.LoadBitmapW(IDB_BITMAP1);
 Bmp.GetBitmap(&bmpInfo);

 pOldBitmap = MemDC.SelectObject(&Bmp);

 // 버튼이 선택되었는가?
 if(lpDrawItemStruct->itemState & ODS_SELECTED)
 {
  // 세번째 버튼 이미지 출력
  pDC->BitBlt(0,0,bmpInfo.bmWidth, bmpInfo.bmHeight, &MemDC, 206, 0, SRCCOPY);
 }
 else
 {
  // 마우스 포인터가 버튼 위에 존재하는가?
  if(m_bHover)
  {
   // 두번째 버튼 이미지 출력!
   pDC->BitBlt(0,0, bmpInfo.bmWidth, bmpInfo.bmHeight, &MemDC, 103, 0, SRCCOPY);
   //pDC->BitBlt(0,0, bmpInfo.bmWidth, bmpInfo.bmHeight, &MemDC, 50, 0, SRCCOPY);
  }
  else
  {
   // 첫번째 버튼 이미지 출력!
   pDC->BitBlt(0,0, bmpInfo.bmWidth, bmpInfo.bmHeight, &MemDC, 0, 0, SRCCOPY);
  }
 }

 MemDC.SelectObject(pOldBitmap);
}

void CMSNButton::OnMouseMove(UINT nFlags, CPoint point)
{
 // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
 
 // 마우스 트래킹이 시작되었는가???
 if(!m_bTracking)
 {
  TRACKMOUSEEVENT tme;
  tme.cbSize = sizeof(tme);
  tme.hwndTrack = m_hWnd;
  tme.dwFlags = TME_LEAVE | TME_HOVER;
  tme.dwHoverTime = 1;
  m_bTracking = _TrackMouseEvent(&tme);
 }
 
 CButton::OnMouseMove(nFlags, point);
}

LRESULT CMSNButton::OnMouseHover(WPARAM wparam, LPARAM lparam)
{
 // 마우스 포인터가 버튼 위에서 움직이고 있음.
 m_bHover = TRUE;
 RedrawWindow();
 return 0;
}

LRESULT CMSNButton::OnMouseLeave(WPARAM wparam, LPARAM lparam)
{
 // 마우스 포인터가 버튼 밖으로 나갔음.
 m_bTracking = FALSE;
 m_bHover = FALSE;
 RedrawWindow();
 return 0;
}


출처 : Windows MFC 정복 (가남사)

Posted by +깡통+

TRACKMOUSEEVENT 구조체

 희한하게 검색해보니, TRACKMOUSEEVENT구조체를 이용하는 팁이 하나도 안올라와 있더군요. 그래서 팁 비슷하게 올려봅니다.
예를 든다면, 윈도우에서 마우스 포인터의 위치가 클라이언트에 있는지 아닌지를 알려주는 간단한 팁입니다.
일단 TRACKMOUSEEVENT 구조체를 보면 다음과 같이 정의 되어 있습니다.

typedef struct tagTRACKMOUSEEVENT {
    DWORD cbSize; // 구조체의 크기
    DWORD dwFlags; // TME_HOVER, TME_LEAVE등 지정할 수 있다.
    HWND  hwndTrack; // 실지로 이벤트를 받을 윈도우 핸들
    DWORD dwHoverTime; // 밀리세칸단위의 hover 타임아웃을 지정한다.
} TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT; 

사용할 함수는 BOOL _TrackMouseEvent(LPTRACKMOUSEEVENT lptrack);
윈도우 95에서는 안되고, 98이상에서만 되고, NT에서는 당근이 됩니다.

그럼 간단하게 예를 들어보겠습니다. 
먼저 WM_MOUSEMOVE 이벤트를 정의합니다.
int m_Flag = 1;

..CMyDlg::OnMouseMove(...)
{
    MouseEvent(); //새로 정의할 함수입니다.
}

void CMyDlg::MouseEvent()
{
   TRACKMOUSEEVENT tme;
   tme.cbSize = sizeof(TRACKMOUSEEVENT);
   if(m_Flag == 0)  tme.dwFlags = TME_LEAVE;
   else tme.dwFlags = TME_HOVER;
   tme.hwndTrack = m_hWnd; // 현재 자신의 윈도우 핸들 지정
   tme.dwHoverTime = 10; //10 밀리세칸으로 지정

   _TrackMouseEvent( &tme );
}

여기서 tme.dwFlags=TME_HOVER 이렇게 정의해놓으면, 즉 마우스가 클라이언트영역으로 들어올때, WM_MOUSEHOVER 이벤트를 발산시킵니다. 발산? 그럼 여기에 맞게, 이벤트 부분을 정의합니다.
먼저 헤더에 다음과 같이 정의합니다.
afx_msg UINT OnMouseHover(WPARAM, LPARAM);
그리고 cpp에다가 ON_MESSAGE(WM_MOUSEHOVER, OnMouseHover)
이렇게 선언합니다.
그리고, 함수를 정의합니다.

UINT MyDlg::OnMouseHover(WPARAM, LPARAM)
{
   m_Flag = 0;
   m_edit.ShowWindow(TRUE);
   return 0;
}
마찬가지로 OnMouseLeave도 같은 방식으로 정의해줍니다.
UINT MyDlg::OnMouseLeave(WPARAM, LPARAM)
{  m_Flag = 1;
   m_edit.ShowWindow(FALSE);
   return 0;
}
위와 같이 정의하시고, 컴파일해보십시오.
아마 클라이언트로 마우스가 위치되면, 에디트박스가 보이고
그렇지 않으면, 에디트가 사라질겁니다.
반응속도도 빠르고, 깜빡임도 없고, 무리없이 잘돌아가더군요.
이걸로, hotButton기능을 구현해봐도 되겠더라고요.
참고로 SetCapture, ReleaseCapture도 이런 기능을 충분히 구현해주지만, 모든 이벤트를 잡아먹어버리는 그런식의 기능은 않습니다. 참 편리합니다만 더 나은 방법이 있으면, 더 글을 올려주세요.

 

http://www.devpia.com/Forum/BoardView.aspx?no=1025&ref=545&forumname=VC_LEC&stype=VCF&KeyW=TRACKMOUSEEVENT&KeyR=titlecontent

Posted by +깡통+
2009. 1. 18. 23:59

1>d:\vc2005\mfcexam\modaless\modaless\modalessdlg.h(34) : error C2143: 구문 오류 : ';'이(가) '*' 앞에 없습니다.
1>d:\vc2005\mfcexam\modaless\modaless\modalessdlg.h(34) : error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.
1>d:\vc2005\mfcexam\modaless\modaless\modalessdlg.h(34) : error C4430: 형식 지정자가 없습니다. int로 가정합니다. 참고: C++에서는 기본 int를 지원하지 않습니다.



이러한 에러가 발생하였다.
이것은 서로 다른 클래스가 서로를 참조하고 있을때 발생한다.
따라서 이런경우 해결책은 '전방참조'라고 하는 방법을 사용한다.

어느 한쪽의 클래스 선언문 위에 다른 클래스의 이름을 적어준다.


// ModalessDlg.h : 헤더 파일
//

#pragma once
#include "childdlg.h"

class CChildDlg; // 전방참조

// CModalessDlg 대화 상자
class CModalessDlg : public CDialog
{
// 생성입니다.
public:
 CModalessDlg(CWnd* pParent = NULL); // 표준 생성자입니다.

// 대화 상자 데이터입니다.
 enum { IDD = IDD_MODALESS_DIALOG };

 protected:
 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다.


// 구현입니다.
protected:
 HICON m_hIcon;

 // 생성된 메시지 맵 함수
 virtual BOOL OnInitDialog();
 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
 afx_msg void OnPaint();
 afx_msg HCURSOR OnQueryDragIcon();
 DECLARE_MESSAGE_MAP()
public:
 CChildDlg *m_pDlg;
public:
 afx_msg void OnBnClickedShowDialog();
};

Posted by +깡통+
부모창의 클래스 선언부에서 아래와 같이 포인트 변수를 추가해야한다.
public:
 CChildDlg *m_pDlg;

어떠한 버튼을 클릭하면 모달리스 창을 띄우는데..
주의할것은 NULL 체크를 하지 않으면 새로운 창이 여러개 생긴다는 것이다.


void CModalessDlg::OnBnClickedShowDialog()
{
 // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
 if(m_pDlg != NULL)
  m_pDlg->SetFocus();
 else {
  m_pDlg = new CChildDlg;
  m_pDlg->Create(IDD_CHILD_DIALOG);
  m_pDlg->ShowWindow(SW_SHOW);
 }
}

이렇게 하면.. 생성은 된다.
하지만 모달리스는 힙에 생성되기 때문에 메모리에서 소멸을 시켜주지 않으면 메모리 누수가 발생한다.
따라서 아래의 코드가 필수적이다.

void CChildDlg::OnBnClickedExit()
{
 // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
 DestroyWindow();
}

이렇게하면 모달리스로 생성된 자식창은 한번은 닫기지만 두번째 생성은 불가능하다.
이미 부모창에서 생성시킨 포인터 변수를 초기화 못했기 때문이다.
그럼 또 아래와 같은 코드가 필요하다.

void CChildDlg::PostNcDestroy()
{
 // TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.
 CDialog::PostNcDestroy();
 
 CModalessDlg *pMainWnd = (CModalessDlg *)AfxGetMainWnd();
 pMainWnd->m_pDlg = NULL;
 delete this; 
}


부모창을 호출해서 m_pDlg 를 초기화 하고.  자신을 delete 시켜준다.
만약 CModalessDlg 를 참조하기 위해 부모헤더 참조하였다면 에러가 발생할수 있다.
그러면 '전방참조' 라는 글을 참조하기 바란다.
Posted by +깡통+

  모달 모달리스 
 생성  CDialog::DoModal()  CDialog::Create()
 소멸  CDialog::EndDialog()  CDialog::DestoryWindow()
 생성 위치  스택에 생성  힙에 생성
     
     



Posted by +깡통+

먼저 선언되어 있지 않은 OnIntitDialog 를 재정의 통해서 추가한다.

자식창 코드
BOOL CNewDialog::OnInitDialog()
{
 CDialog::OnInitDialog();

 // TODO:  여기에 추가 초기화 작업을 추가합니다.

// 부모창의 포인터를 얻어서 GetValue 라는 사용자 정의 함수를 호출한다.
 CString m_str;
 CModalDlg *pMainWnd = (CModalDlg *)AfxGetMainWnd();
 m_str = pMainWnd->GetValue();
 TRACE(L"GET = %s\n", m_str);
 CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
 pEdit->SetWindowTextW(m_str);

 return TRUE;  // return TRUE unless you set the focus to a control
 // 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다.
}


부모창 코드.
CString CModalDlg::GetValue(void)
{
 CString m_str;
 CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
 pEdit->GetWindowTextW(m_str);
 TRACE("GetValue = %s \n", m_str);
 return m_str;
}

Posted by +깡통+

포인터 캐스팅을 이용하여 자식창에서 부모창의 포인터 주소를 얻어 처리합니다.

자식창에 입력 버튼을 만들고 아래와 같이 코딩합니다.
void CNewDialog::OnBnClickedInput()
{
 // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
 CString m_strTemp;
 CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
 pEdit->GetWindowText(m_strTemp);
 TRACE(L"%s \n", m_strTemp);

 CModalDlg *pMainWnd = (CModalDlg *)AfxGetMainWnd();
 pMainWnd->m_str2 = m_strTemp;
 pMainWnd->ShowValue();

}

부모창에는 m_str2 전역변수를 만들고 아래와 같이 추가합니다.
void CModalDlg::ShowValue(void)
{
 CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
 pEdit->SetWindowTextW(m_str2);
}

위는 동강으로 배운 내용이고 응용하자면...
// 부모창에는
void CNewDialog::OnBnClickedInput()
{
 // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
 CString m_strTemp;
 CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
 pEdit->GetWindowText(m_strTemp);
 TRACE(L"%s \n", m_strTemp);

 CModalDlg *pMainWnd = (CModalDlg *)AfxGetMainWnd();
 //pMainWnd->m_str2 = m_strTemp;
 pMainWnd->ShowValue2(m_strTemp);

}

// 자식창에는
void CModalDlg::ShowValue2(CString m_str)
{
 CEdit *pEdit = (CEdit *)GetDlgItem(IDC_EDIT1);
 pEdit->SetWindowTextW(m_str);
}


이렇게 하는것이 효과적이지 않을까?  굳이 전역변수를 만들 필요까지는 없을듯...
물론 문제는 있다.
예를들어 어떠한 옵션창을 오픈하여 여러 옵션을 선택한뒤 사용자가 저장 버튼을 눌렀다고 가정한다면
그건 부모창에서 처리하는 옵션데이터 struct 변수에 저장해야 하지 않을까?

Posted by +깡통+
이전버튼 1 2 3 이전버튼