c++.windows.32-bits - More attempts with GDI+
- gourlay physics.uq.net.au (118/118) Jan 19 2004 Hi there,
- Walter (5/10) Jan 20 2004 line
Hi there, Thanks Walter for your interest in this problem. I'm sure there must be quite a few others out there using GDI+. GDIplus comes in Microsoft Platform Core SDK so I guess it's in COFF [http://msdn.microsoft.com/library/ ] There are also some older "gdiplus.zip" files on the web which have the .h,.lib and .dll files, e.g. http://research.apiit.edu.my/gecko/ and www.codeguru.com/gdi/GDIPlus.zip which are much easier to download. With COFF2OMF on gdiplus.lib the file size shrinks from 200480 to 38400 bytes. Is that normal for COFF2OMF? I had a go at linking the simple example below, with the following command line and got a huge number of errors processing the headers. While I haven't looked at these headers in detail, I can't believe there would be simple errors in them. Any suggestions would be more that welcome. Malcolm BTW I've commented out all references to GDIPLUS except the #include <gdiplus.h> line. If this is also commented out, it compiles, links and runs OK. C:\Temp2>c:\dm\bin\dmc gdiplus_line.cpp -mn -o -6 -WA -Ic:\gdiplus_guru\gdiplus\includes /L/EXETYPE:NT /L/SUBSYSTEM:WINDOWS c:\dm\lib\snn+user32+gdi32+kernel32+comdlg32.lib c:\gdiplus_guru\lgdiplus\lib\gdiplus_omf.lib c:\gdiplus_guru\gdiplus.dll typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token); ^ c:\gdiplus_guru\gdiplus\includes\GdiplusInit.h(39) : Error: ')' expected to close function parameter list with typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token); ^ c:\gdiplus_guru\gdiplus\includes\GdiplusInit.h(40) : Error: parameter list is out of context UINT32 GdiplusVersion; // Must be 1 ^ c:\gdiplus_guru\gdiplus\includes\GdiplusInit.h(46) : Error: ';' expected following declaration of struct member c:\gdiplus_guru\gdiplus\includes\GdiplusInit.h(57) : Error: type of 'ULONG_PTR' does not match function prototype Had: int and: void (*std func)(int enum Gdiplus::DebugEventLevel,char *) c:\gdiplus_guru\gdiplus\includes\GdiplusInit.h(58) : Error: undefined identifier 'GdiplusVersion' Fatal error: too many errors --- errorlevel 1 source //**************************************************************************** //gdiplus_line.cpp. From Microsoft //**************************************************************************** #define UNICODE #include <windows.h> #include <gdiplus.h> using namespace Gdiplus; //VOID OnPaint(HDC hdc) //{ // Graphics graphics(hdc); // Pen pen(Color(255, 0, 0, 255)); // graphics.DrawLine(&pen, 0, 0, 200, 100); //} LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, INT iCmdShow) { HWND hWnd; MSG msg; WNDCLASS wndClass; // GdiplusStartupInput gdiplusStartupInput; // ULONG_PTR gdiplusToken; // Initialize GDI+. // GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); wndClass.style = CS_HREDRAW | CS_VREDRAW; wndClass.lpfnWndProc = WndProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hInstance = hInstance; wndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); wndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wndClass.lpszMenuName = NULL; wndClass.lpszClassName = TEXT("GettingStarted"); RegisterClass(&wndClass); hWnd = CreateWindow( TEXT("GettingStarted"), // window class name TEXT("Getting Started"), // window caption WS_OVERLAPPEDWINDOW, // window style CW_USEDEFAULT, // initial x position CW_USEDEFAULT, // initial y position CW_USEDEFAULT, // initial x size CW_USEDEFAULT, // initial y size NULL, // parent window handle NULL, // window menu handle hInstance, // program instance handle NULL); // creation parameters ShowWindow(hWnd, iCmdShow); UpdateWindow(hWnd); while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } // GdiplusShutdown(gdiplusToken); return msg.wParam; } // WinMain LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; switch(message) { case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // OnPaint(hdc); EndPaint(hWnd, &ps); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProc(hWnd, message, wParam, lParam); } } // WndProc
Jan 19 2004
<gourlay physics.uq.net.au> wrote in message news:buiiag$1bbv$1 digitaldaemon.com...I had a go at linking the simple example below, with the following commandlineand got a huge number of errors processing the headers. While I haven't looked at these headers in detail, I can't believe therewouldbe simple errors in them. Any suggestions would be more that welcome.See www.digitalmars.com/faq.html#error
Jan 20 2004