Я видел следующий код , который делает снимок экрана и сохраняет его как jpg, мне удалось скомпилировать и запустить его как приложение win32 CONSOLE,
Но когда я попыталсяЧтобы использовать следующий код в проекте WindowsForm / CLI (есть только кнопка, которая должна сделать снимок экрана), я получил следующие ошибки:
1>screenshoter.obj : warning LNK4248: unresolved typeref token (0100002C) for 'Gdiplus.GpCachedBitmap'; image may not run
1>screenshoter.obj : error LNK2028: unresolved token (0A000017) "extern "C" int __stdcall ReleaseDC(struct HWND__ *,struct HDC__ *)" (?ReleaseDC@@$$J18YGHPAUHWND__@@PAUHDC__@@@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A000018) "extern "C" int __stdcall DeleteObject(void *)" (?DeleteObject@@$$J14YGHPAX@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A000019) "extern "C" int __stdcall BitBlt(struct HDC__ *,int,int,int,int,struct HDC__ *,int,int,unsigned long)" (?BitBlt@@$$J236YGHPAUHDC__@@HHHH0HHK@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A00001A) "extern "C" void * __stdcall SelectObject(struct HDC__ *,void *)" (?SelectObject@@$$J18YGPAXPAUHDC__@@PAX@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A00001B) "extern "C" struct HBITMAP__ * __stdcall CreateCompatibleBitmap(struct HDC__ *,int,int)" (?CreateCompatibleBitmap@@$$J212YGPAUHBITMAP__@@PAUHDC__@@HH@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A00001C) "extern "C" struct HDC__ * __stdcall CreateCompatibleDC(struct HDC__ *)" (?CreateCompatibleDC@@$$J14YGPAUHDC__@@PAU1@@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A00001D) "extern "C" int __stdcall GetSystemMetrics(int)" (?GetSystemMetrics@@$$J14YGHH@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2028: unresolved token (0A00001E) "extern "C" struct HDC__ * __stdcall GetDC(struct HWND__ *)" (?GetDC@@$$J14YGPAUHDC__@@PAUHWND__@@@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall ReleaseDC(struct HWND__ *,struct HDC__ *)" (?ReleaseDC@@$$J18YGHPAUHWND__@@PAUHDC__@@@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall DeleteObject(void *)" (?DeleteObject@@$$J14YGHPAX@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall BitBlt(struct HDC__ *,int,int,int,int,struct HDC__ *,int,int,unsigned long)" (?BitBlt@@$$J236YGHPAUHDC__@@HHHH0HHK@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" void * __stdcall SelectObject(struct HDC__ *,void *)" (?SelectObject@@$$J18YGPAXPAUHDC__@@PAX@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" struct HBITMAP__ * __stdcall CreateCompatibleBitmap(struct HDC__ *,int,int)" (?CreateCompatibleBitmap@@$$J212YGPAUHBITMAP__@@PAUHDC__@@HH@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" struct HDC__ * __stdcall CreateCompatibleDC(struct HDC__ *)" (?CreateCompatibleDC@@$$J14YGPAUHDC__@@PAU1@@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall GetSystemMetrics(int)" (?GetSystemMetrics@@$$J14YGHH@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
1>screenshoter.obj : error LNK2019: unresolved external symbol "extern "C" struct HDC__ * __stdcall GetDC(struct HWND__ *)" (?GetDC@@$$J14YGPAUHDC__@@PAUHWND__@@@Z) referenced in function "private: void __clrcall screenshoter::Form1::gdiscreen(void)" (?gdiscreen@Form1@screenshoter@@$$FA$AAMXXZ)
Примечание : То, что я 'я включил все необходимые файлы
Я посмотрел в MSDN, но не смог понять сообщения об ошибках.Более того, я сталкивался с подобными сообщениями в прошлом, я решил их, но добавил файл .lib
На этот раз я попытался добавить, однако это не решило проблему
#pragma comment( lib, "GdiPlus.lib" )