GdiplusStartupOutput type
The two functions that GDI+ returns when it is started without its background thread.
When SuppressBackgroundThread is True, GDI+ runs no thread of its own for its background work, and the program must call a hook function before it enters its message loop and an unhook function after it leaves it. GDI+ returns the two functions in a GdiplusStartupOutput, which the GdiPlusUser constructor fills in. It mirrors the GdiplusStartupOutput structure of GDI+ and has two fields and no methods.
A program that leaves the background thread on never needs this type.
Fields
NotificationHook
A NotificationHookProc. 0 until GDI+ has been started with the output.
NotificationUnhook
A NotificationUnhookProc. 0 until GDI+ has been started with the output.
Delegates
NotificationHookProc
Function( token As ULONG ) As GpStatus. Starts the background work and returns a token.
NotificationUnhookProc
Sub( token As ULONG ). Stops it. Pass the token that the hook returned.
Warning 0.9.45.0
The token is declared as a 32-bit Long, and in a 64-bit program GDI+ writes a 64-bit value into it. NotificationHookProc overwrites the four bytes after the variable. Pass the first element of an array of two Long values, as in the sample below, so that the four bytes it overwrites belong to nothing else.
Module functions
Syntax: NotificationHook( token As LongPtr ) As GpStatus
Syntax: NotificationUnhook( token As LongPtr )
Warning 0.9.45.0
NotificationHook returns status 1, GenericError, and leaves the token 0, also after GDI+ was started with a GdiplusStartupInput whose SuppressBackgroundThread is True through the constructor that takes an output. The function it declares is not the one in the output. Call the NotificationHook and NotificationUnhook fields of the output, as in the sample below.
Dim settings As GdiplusStartupInput
settings.GdiplusVersion = 1
settings.SuppressBackgroundThread = True
Dim output As GdiplusStartupOutput
Dim user As GdiPlusUser = GdiPlusUser(settings, output)
Debug.Print user.LastResult ' 0
Debug.Print output.NotificationHook <> 0 ' True
Debug.Print output.NotificationUnhook <> 0 ' True
Dim slot(0 To 1) As Long
Dim status As GpStatus = output.NotificationHook(slot(0))
Debug.Print status ' 0
' ... the program's message loop runs here ...
output.NotificationUnhook slot(0)
See Also
- GdiplusStartupInput type – the settings, including SuppressBackgroundThread
- GdiPlusUser class – starts GDI+
- Types – the types of the package
- GdiplusStartupOutput – the GDI+ structure on Microsoft Learn