Russian Qt Forum
Апрель 20, 2024, 00:24 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
 
  Начало   Форум  WIKI (Вики)FAQ Помощь Поиск Войти Регистрация  

Страниц: [1]   Вниз
  Печать  
Автор Тема: error C2660: 'CreateSolidBrush' : function does not take 3 arguments  (Прочитано 10142 раз)
malor
Гость
« : Ноябрь 05, 2007, 11:12 »

При попытке компиляции программы Hello2 из книги “Win32 API Эффективная разработка приложений”( Ю.Щупак), стр.54, выдало :
error C2660: 'CreateSolidBrush' : function does not take 3 arguments   c:\documents and settings\malor\мои документы\vc_projects\win32api\ch_01\hello2\hello2.cpp   
про строку со словом  SetClassLong:
Код:
case WM_CREATE:
SetClassLong(hWnd,GCL_HBRBACKGROUND,(LONG)CreateSolidBrush(200,160,255));
   break;
Как быть?
Про error C2660  из MSDN:
Код:
SYMPTOMS
When using the Microsoft Foundation Classes (MFC), the following error may occur when making a Windows application
programming interface (API) call from within a member function of a window class:
   C2660: 'function' : function does not take 'number' parameters

CAUSE
Many of the Windows API calls are accessed in the Microsoft Foundation Classes through member functions of the same
name as the API calls. This means that the name will be recognized, but because most member functions require fewer parameters
than their API counterparts, the C2660 error occurs.
RESOLUTION
Either of the following two methods eliminates the error:
Adjust the function call to conform to the format of the member:
function call.
   -or-
Use the scope resolution operator (::) to tell the compiler to look for the function name in the global name space.
SetClassLong Function
DWORD SetClassLong(     
    HWND hWnd,
    int nIndex,
    LONG dwNewLong
);


“…but because most member functions require fewer parameters than their API counterparts, the C2660 error occurs.”
“…но т.к. большинство функций-членов(эмэфцэшных, по-видимому) требует меньшее количество параметров, чем их API-аналоги, то происходит C2660 error” 

Согласно ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vccomp/html/2e01a1db-4f00-4df6-a04d-cb6f70a6922b.htm  :
Код:
Error Message 
[i]'function' : function does not take number parameters[/i]
The function is called with an incorrect number of parameters.
C2660 can occur if you accidentally call a Windows API function rather than an MFC member function of the same name. To solve
this problem:
-- Adjust the function call to conform to the format of the member function call.
-- Use the scope resolution operator (::) to tell the compiler to seek the function name in the global name space.
Т.е. VStudio ждет что я буду использовать функцию из MFC ? Что дальше предпринимать?

MS VisualStudio 2005
« Последнее редактирование: Ноябрь 05, 2007, 11:16 от malor » Записан
Tonal
Гость
« Ответ #1 : Ноябрь 06, 2007, 07:08 »

Тебе же ангийским по белому написали что:
error C2660: 'CreateSolidBrush' : function does not take 3 arguments

Вот и смотри, сколько должно быть аргументов и каких. ;-)
Записан
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  


Страница сгенерирована за 0.045 секунд. Запросов: 21.