0
콘솔 응용 프로그램에서 ChooseColor 함수를 사용하려고합니다. http://msdn.microsoft.com/en-us/library/windows/desktop/ms646912(v=vs.85).aspxwindows.h 사용시 정의되지 않은 참조
나는 그것을 테스트하기 위해 자신의 샘플 코드를 사용하고, 그들이 나에게 말했다처럼 나는 WINDOWS.H 포함했다, 그러나 나는 오류를 얻을 :
undefined reference to '[email protected]'
undefined reference to '[email protected]'
내가 코드를 사용하고 있습니다를 :: 블록, 그리고 "Windows.h"및 "Commdlg.h"포함하여 시도했지만 행운을하지 않고. windows.h를 사용하기 위해 링커 설정을 사용해야합니까? 내 코드 :
#include <windows.h>
int main()
{
CHOOSECOLOR cc; // common dialog box structure
static COLORREF acrCustClr[16]; // array of custom colors
HWND hwnd; // owner window
HBRUSH hbrush; // brush handle
static DWORD rgbCurrent; // initial color selection
// Initialize CHOOSECOLOR
ZeroMemory(&cc, sizeof(cc));
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hwnd;
cc.lpCustColors = (LPDWORD) acrCustClr;
cc.rgbResult = rgbCurrent;
cc.Flags = CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)==TRUE)
{
hbrush = CreateSolidBrush(cc.rgbResult);
rgbCurrent = cc.rgbResult;
}
return 0;
}
해당 기능에 대한 문서를 참조하십시오. 그것은 말할 것이다 : * 도서관 : gdi32.lib *와 * 도서관 : comdlg32.lib *. 그렇습니다, 연결은 좋은 것입니다. Windows.h를 컴파일하지 않고 이미 오래 걸릴 것입니다. – chris
ChooseColor의 결과를 잘못 테스트하고 있습니다. 더 자세히 문서를 읽으십시오. –
콘솔 응용 프로그램에서 브러시로 무엇을 할 것입니까? –