GdiPlusInit.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //Download by http://www.NewXing.com
  2. /**************************************************************************
  3. *
  4. * Copyright (c) 2000-2001 Microsoft Corporation
  5. *
  6. * Module Name:
  7. *
  8. * Gdiplus initialization
  9. *
  10. * Abstract:
  11. *
  12. * GDI+ Startup and Shutdown APIs
  13. *
  14. **************************************************************************/
  15. #ifndef _GDIPLUSINIT_H
  16. #define _GDIPLUSINIT_H
  17. enum DebugEventLevel
  18. {
  19. DebugEventLevelFatal,
  20. DebugEventLevelWarning
  21. };
  22. // Callback function that GDI+ can call, on debug builds, for assertions
  23. // and warnings.
  24. typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message);
  25. // Notification functions which the user must call appropriately if
  26. // "SuppressBackgroundThread" (below) is set.
  27. typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token);
  28. typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token);
  29. // Input structure for GdiplusStartup()
  30. struct GdiplusStartupInput
  31. {
  32. UINT32 GdiplusVersion; // Must be 1
  33. DebugEventProc DebugEventCallback; // Ignored on free builds
  34. BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call
  35. // the hook/unhook functions properly
  36. BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use
  37. // its internal image codecs.
  38. GdiplusStartupInput(
  39. DebugEventProc debugEventCallback = NULL,
  40. BOOL suppressBackgroundThread = FALSE,
  41. BOOL suppressExternalCodecs = FALSE)
  42. {
  43. GdiplusVersion = 1;
  44. DebugEventCallback = debugEventCallback;
  45. SuppressBackgroundThread = suppressBackgroundThread;
  46. SuppressExternalCodecs = suppressExternalCodecs;
  47. }
  48. };
  49. // Output structure for GdiplusStartup()
  50. struct GdiplusStartupOutput
  51. {
  52. // The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
  53. // Otherwise, they are functions which must be called appropriately to
  54. // replace the background thread.
  55. //
  56. // These should be called on the application's main message loop - i.e.
  57. // a message loop which is active for the lifetime of GDI+.
  58. // "NotificationHook" should be called before starting the loop,
  59. // and "NotificationUnhook" should be called after the loop ends.
  60. NotificationHookProc NotificationHook;
  61. NotificationUnhookProc NotificationUnhook;
  62. };
  63. // GDI+ initialization. Must not be called from DllMain - can cause deadlock.
  64. //
  65. // Must be called before GDI+ API's or constructors are used.
  66. //
  67. // token - may not be NULL - accepts a token to be passed in the corresponding
  68. // GdiplusShutdown call.
  69. // input - may not be NULL
  70. // output - may be NULL only if input->SuppressBackgroundThread is FALSE.
  71. extern "C" Status WINAPI GdiplusStartup(
  72. OUT ULONG_PTR *token,
  73. const GdiplusStartupInput *input,
  74. OUT GdiplusStartupOutput *output);
  75. // GDI+ termination. Must be called before GDI+ is unloaded.
  76. // Must not be called from DllMain - can cause deadlock.
  77. //
  78. // GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
  79. // to GDI+ object destructors.
  80. extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
  81. #endif