A have to print from VB not using printer object (such code does not work in ocx under delphi - don't know why). I have IPicture object and i need to print it to printer device context created previously by CreateDC. I am able to print rectangles, but IPicture does not want to print (it does not appear on printer).
I use for example following code:
hDC = CreateDC("WINSPOOL", "\\SERVER\HP LaserJet 5MP", "", 0)
StartDoc hDC, docInf
printerWidth = GetDeviceCaps(hDC, HORZRES)
printerHeight = GetDeviceCaps(hDC, VERTRES)
'----- this rectangle does print
Rectangle hDC, printerLeft, printerTop, printerLeft + printerWidth, printerTop + printerHeight
'----- this does not print
pic.Render hdc, 0, 0, printerWidth, printerHeight, 0, 0, pic.width, pic.height, Null
I also tried drawing picture using StretchBlt, but didn't suceed. Picture is o.k., as i am able to save it to file using SavePicture or print it using printer object.
Can someone please tell me, how to print IPictures on device context?