이 MAKEINTRESOURCE, GetClassLong, LOWORD ((LPSTR) cursor_name) 및 LoadCursor에서 64 비트와 호환되지 않는 것이 있습니까? 그렇다면 해결책은 무엇입니까? 내 코드는 32 비트에서는 잘 작동하지만 64 비트에서는 작동하지 않습니다. 코드는 거대한 응용 프로그램이며 사용되는 주요 기능은 위에 나열되어 있습니다. 함수에는 매개 변수 mouse_form이 있습니다.
HCURSOR c_cursor, n_cursor;
LPSTR cursor_name;
switch( mouse_form )
{
case MOUSE_WIN_ARROW:
cursor_name = (LPSTR)IDC_ARROW;
break;
case MOUSE_ARROW:
cursor_name = (LPSTR)IDC_ARROW;
#if (!(defined WIN32) && !(defined WIN64))
if( environ_get_window_id() != -1 ) cursor_name = (LPSTR)IDCC_ELXHND;
#endif
break;
case MOUSE_CURSOR:
cursor_name = (LPSTR)IDC_IBEAM;
break;
case MOUSE_HOURGLASS:
cursor_name = (LPSTR)IDC_WAIT;
break;
case MOUSE_POINTING_HAND:
#if ((defined WIN32) || (defined WIN64))
cursor_name = (LPSTR)IDC_ARROW;
#else
cursor_name = (LPSTR)IDCC_ELXHND;
#endif
break;
case MOUSE_OPEN_HAND:
cursor_name = (LPSTR)IDC_ARROW;
break;
case MOUSE_THIN_CROSS:
cursor_name = (LPSTR)IDC_CROSS;
break;
case MOUSE_THICK_CROSS:
cursor_name = (LPSTR)IDC_CROSS;
break;
case MOUSE_OUTLINED_CROSS:
cursor_name = (LPSTR)IDC_SIZE;
break;
case MOUSE_MENU_ARROW:
cursor_name = (LPSTR)IDCC_ELXMEN;
break;
default:
cursor_name=(LPSTR)MAKEINTRESOURCE( mouse_form );
}
n_cursor = environ_wload_cursor( cursor_name );
#if ((defined WIN32) || (defined WIN64))
if( environ_control->w_param)
c_cursor = (HCURSOR)GetClassLong( environ_control->w_param->awindow,(ELX_LONG) GCLP_HCURSOR );
else
c_cursor = (HCURSOR)GetWindowLong( GetForegroundWindow(),(ELX_LONG) GCLP_HCURSOR );
#else
c_cursor = GetClassWord( environ_control->w_param->awindow, GCW_HCURSOR );
#endif
#if ((defined WIN32) || (defined WIN64))
if( environ_control->w_param)
{
#endif
if( !n_cursor )
{
if( environ_control->win_cptr->window_id == -1 )
{
n_cursor = ewcore_control.orig_cclient;
}
else
{
n_cursor = ewcore_control.orig_cchild;
}
}
else environ_control->win_cptr->prev_cursor = c_cursor;
#if ((defined WIN32) || (defined WIN64))
}
else
{
if( !n_cursor )
{
n_cursor = ewcore_control.orig_cclient;
}
//else
//environ_control->win_cptr->prev_cursor = c_cursor;
}
#endif
#if ((defined WIN32) || (defined WIN64))
if(environ_control->w_param)
SetClassLong( environ_control->w_param->awindow, GCLP_HCURSOR,(ELX_LONG)n_cursor );
else
SetWindowLong( GetForegroundWindow(), GCLP_HCURSOR, (ELX_LONG)n_cursor );
#else
SetClassWord( environ_control->w_param->awindow,GCW_HCURSOR, n_cursor );
#endif
SetCursor( n_cursor );
}
에 대한 MSDN 설명서에서 GetClassLong
:
포인터 나 핸들을 검색하는 경우이 함수는 GetClassLongPtr 함수로 대체되었습니다. (포인터와 핸들은 32 비트 Windows에서 32 비트이고 64 비트 Windows에서 64 비트입니다.)
요컨대 : GetClassLongPtr
대신 사용하십시오 .
에 대한 MSDN 설명서에서 GetClassWord
:
이 함수는 GCW_ATOM으로 설정된 nIndex 이외의 용도로 더 이상 사용되지 않습니다. 이 기능은 Windows 16 비트 버전과의 호환성을 위해서만 제공됩니다. 응용 프로그램은 GetClassLongPtr 또는 GetClassLongPtr 함수를 사용해야합니다.
SetClassLong
, GetWindowLong
및 에도 동일하게 적용됩니다 SetWindowLong
. *Ptr
32 비트 64 비트 버전의 Windows와 호환되는 코드를 작성 하려면 이들 모두를 각각의 변형 으로 바꿔야합니다 .
또한, 당신의 모든 임무 cursor_name
는 다소 어색합니다. non-const 에는 캐스트가 있어서는 안됩니다 LPSTR
. 미리 정의 된 커서 ID의 경우 간단한 할당이면 충분합니다 (예 : cursor_name = IDC_ARROW;
. 사용자 정의 ID의 경우 MAKEINTRESOURCE
.
실제로 커서를로드하는 코드도 잘못되었습니다 (32 비트 및 64 비트 빌드의 경우). 미리 정의 된 모양 ( IDC_ARROW
) 또는 사용자 정의 ( IDCC_ELXMEN
) 인 커서 리소스를로드하려고합니다 . 사전 정의 및 사용자 정의 커서에는 HINSTANCE
결국에 전달되는 다른 매개 변수가 필요 합니다 LoadCursor
. 게시 한 코드의 경우는 해당되지 않는 것 같습니다 (코드의 해당 부분을 생략했지만).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다