Using GDI Plus with Win32Lib
- Posted by buzzo Jan 09, 2012
- 1319 views
Have attempted to use GDI Plus for displaying images reusing Al Getz's code from his example program. This example runs fine, and will display my jpeg's just fine; resizeing to boot.
Lifted Al's code, and adapted it to my project. My main window is created with Win32Lib.. However, the image does not appear in the main window. Seems there may be a problem with the handle(s) This is a portion of my code:
integer wH --wH=getHandle(win) -- no image --wH=getHandle("win") -- win32lib error message, but "continue" puts partial image is on desktop --wH=getHWND(win) -- no image --wH=getHWND("win") -- error wH=getId(win) -- partial image is on desktop --wH=getMainWindow() -- partial image is on desktop --wH=getIdName(win) -- error --wH=getIdName("win") -- error --wH=getNameId(win) -- error --wH=getNameId("win") -- partial image is on desktop --wH=getNameIdInContext("win", win) -- partial image is on desktop status=GdipCreateFromHWND(wH,ppGraphics) .......... more code, omited ......... The code does get the height and with properly: puts(1,w32ToString(Width)) puts(1,CrLf) puts(1,w32ToString(Height)) puts(1,CrLf) status=GdipDrawImageRectI(pGraphics,pImage, 40,20,Width,Height) -- returns 0
When the partial image is displayed, it is placed at 40, 20 on the desktop... "behind" the main window..
The image is never placed in the Main Window.. other "parts" of the project(in excess of 1400 lines of compact code) work fine..
Is GDI Plus not compatible with Win32Lib or am I missing something? Suggested fix?
This is on a Win 7 box..
Buzzo