2011-11-08 2 views
1

어떤 이유로 AdjustWindowRect 또는 GetClientRect를 호출하려고하는데 제공 한 매개 변수가 문제가되지 않습니다. 약 30 개의 오류가 발생하며 WinAPI 기능 호출과 관련이 없습니다.여러 WinAPI 함수를 호출하면 약 30 개의 오류가 발생합니다.

어떻게 될까요?

감사

예를 들어

:

다음 코드 :

case WM_GETMINMAXINFO: 
      { 
       LPMINMAXINFO p_info = (LPMINMAXINFO)lParam; 
       RECT rc = {0,0,d->w,d->h}; 
       DWORD dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE) ; 
       AdjustWindowRect(&rc,dwStyle,FALSE); 
       int total_border_width = 2 * GetSystemMetrics(SM_CXFRAME) + 4; 
       int total_border_height = 2 * GetSystemMetrics(SM_CYFRAME) + 
       GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYBORDER) + 5; 
       POINT min,max; 

       min.x = d->min_w > 0 ? d->min_w + total_border_width : p_info->ptMinTrackSize.x; 
       min.y = d->min_h > 0 ? d->min_h + total_border_height : p_info->ptMinTrackSize.y; 
       max.x = d->max_w > 0 ? d->max_w + total_border_width : p_info->ptMaxTrackSize.x; 
       max.y = d->max_h > 0 ? d->max_h + total_border_height : p_info->ptMaxTrackSize.y; 

       p_info->ptMinTrackSize = min; 
       p_info->ptMaxTrackSize = max; 
      } 

가 생산 :

Error 6 error C2065: 'max' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 844 
Error 13 error C2065: 'max' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 848 
Error 16 error C2065: 'max' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 849 
Error 21 error C2065: 'max' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 852 
Error 5 error C2065: 'min' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 844 
Error 7 error C2065: 'min' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 846 
Error 10 error C2065: 'min' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 847 
Error 19 error C2065: 'min' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 851 
Error 12 error C2065: 'total_border_height' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 847 
Error 18 error C2065: 'total_border_height' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 849 
Error 9 error C2065: 'total_border_width' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 846 
Error 15 error C2065: 'total_border_width' : undeclared identifier c:\Users\Josh\Documents\AL51\src\win\wwindow.c 848 
Error 1 error C2143: syntax error : missing ';' before 'type' c:\Users\Josh\Documents\AL51\src\win\wwindow.c 841 
Error 2 error C2143: syntax error : missing ';' before 'type' c:\Users\Josh\Documents\AL51\src\win\wwindow.c 842 
Error 4 error C2146: syntax error : missing ';' before identifier 'min' c:\Users\Josh\Documents\AL51\src\win\wwindow.c 844 
Error 8 error C2224: left of '.x' must have struct/union type c:\Users\Josh\Documents\AL51\src\win\wwindow.c 846 
Error 14 error C2224: left of '.x' must have struct/union type c:\Users\Josh\Documents\AL51\src\win\wwindow.c 848 
Error 11 error C2224: left of '.y' must have struct/union type c:\Users\Josh\Documents\AL51\src\win\wwindow.c 847 
Error 17 error C2224: left of '.y' must have struct/union type c:\Users\Josh\Documents\AL51\src\win\wwindow.c 849 
Error 3 error C2275: 'POINT' : illegal use of this type as an expression c:\Users\Josh\Documents\AL51\src\win\wwindow.c 844 
Error 20 error C2440: '=' : cannot convert from 'int' to 'POINT' c:\Users\Josh\Documents\AL51\src\win\wwindow.c 851 
Error 22 error C2440: '=' : cannot convert from 'int' to 'POINT' c:\Users\Josh\Documents\AL51\src\win\wwindow.c 852 
+0

이 코드는 .c 파일 또는 .cpp의 일부입니까? –

+0

이것은 c 파일의 일부입니다 – jmasterx

+0

그런 다음 James McNellis가 아래에 표시된 것처럼 모든 변수 선언을 블록 맨 위로 이동해야합니다. –

답변

2

비주얼 C++에만 C90 (안 C99)이 때문에 컴파일시 지원 C 프로그램을 사용하려면 모든 변수 선언을 블록의 맨 위에 놓아야합니다. atements.

min, max, total_border_heighttotal_border_width의 선언은 모두 블록에서 하나 이상의 문구 뒤에옵니다.

+0

아니, AdjustRect 또는 다른 winapi 함수의 간단한 제거와 함께 매력처럼 구축, 나는 또한 min 및 max, 행운을 바꿉니다. – jmasterx

관련 문제