i created the app and all the plugins written for it should draw on special place on my form that will be random or specially selected for plugin, so everytime the coordinates is random. Also they should use standard windows GDI functions like Rectangle(), FillRect(), TextOutA() and other. What is the better method to accomplish this? I know i should make drawing engine 开发者_运维技巧inside my program, i have 2 choices: to use named pipes or to use windows messages. Maybe someone have another methods implemented and tested?
In order to use GDI functions, they need access to an HDC
handle. If your app sets aside a TPanel
or other suitable windowed container for drawing, then it can pass the container's HWND
handle to the plugin and then the plugin can obtain the HDC
manually via GetDC()
or GetWindowDC()
when needed. If you chose to pass the actual HDC
to the plugin instead, then you can set aside a TPaintBox
or other suitable non-windowed container instead, which does not require a dedicated HWND
and associated resources.
精彩评论