

HIMETRIC_PER_INCH / 2) / HIMETRIC_PER_INCH SizeInPix.cx = (nPixelsPerInchX * sizeInHiMetric.cx + _ If hr=E_UNEXPECTED then errmess="Unexpect Error" If hr=E_OUTOFMEMORY then errmess="Out of Memeory" If hr=E_NOINTERFACE then errmess=" The object does not support the interface specified in riid" If hr=E_POINTER then errmess = "The address in ppvRet is NULL" ''''''''''''''''''''''''''''''''''''''''''begin funcs/subsįunction OpenGraphic(byval strname as zstring ptr) as any ptrĭim as integer nPixelsPerInchX = GetDeviceCaps(hDCScreen, LOGPIXELSX)ĭim as integer nPixelsPerInchY = GetDeviceCaps(hDCScreen, LOGPIXELSY)


OpenGraphic(exepath & "\sample.jpg") 'change this Thread As Sub(ByVal Running_Event As HANDLE)Įxtern FB_Win32 Alias "fb_win32" As WIN32DRIVER WindowClass(0 To WINDOW_TITLE_SIZE + Len(WINDOW_CLASS_PREFIX)-1) As uByte #define WINDOW_CLASS_PREFIX "fbgfxclass_"īlitter As Sub(ByVal As uByte Ptr, ByVal As Integer) PDC = FBGDI_ScreenDC() 'this must follow screen init, '#include "windows.bi" 'this is included via fbgdiĭeclare function OpenGraphic(byval strname as zstring ptr) as any ptrĭeclare sub DisplayGraphic(byval vhwnd as HWND, byval pDC as HDC)ĭeclare sub CloseImage(byval Ipict as any ptr)
Ipicture msdn code#
You'll need to change the "sample.jpg" filename near line 60 in the code to reflect your image file name.Ĭode: Select all 'Load gif/jpg/bmp from file to image sprite a bitmap (JPEG, GIF, or BMP.) larger than 250x250 to test, placed in the same dir as the compiled exe. Please follow his succinct instructions for installationĢ. I have a very light grasp of how this all works - I cannot answer any questions, MSDN be your friend. So at coderJeff's suggestion I've mixed the two methods and stripped-out the WinMain() blah blah (as another proof-of-concept). That said, what I wanted from their code was the ability to load bitmaps from disk into something I could use with standard fb GFX windows. I consider CreateWindow to be the antithesis of FreeBASIC. I don't want to mix event and message based programming/code if it is at all possible to avoid (my opinion, solely). I'll include the links to both sources in this. The invisible code, fbgdi, is all jofers', and presents methods to mix fb GFX and the Window DC methods. The visible code below is almost all from coderJeff, it was a proof of concept to load/display bitmaps into/on a CreateWindow DC. It appears that this should also be able to resize upwards, small bitmap to larger screen, but the one test I tried didn't work (surely my problem, but again I don't want to resize images).īefore I continue: 99% of this code was written by coderJeff and jofers (presented alphabetically). The reduction (larger bitmap to smaller screen) works well (I have no need for scrunched images, but.). Optionally resizes said bitmaps to the fb GFX screen size (which is the only reason to care that this'll load a BMP). M$ says it (the OleLoadPicturePath method) will work with ICO and WMF formats also, but my very limited testing with these failed. Loads GIF, JPEG, and BMP format files from disk to an fb-type image ("sprite") without need for external dlls. If ActiveDocument.Shapes(iLoop).WrapFormat.Type wdWrapInline ThenĪctiveDocument.Shapes(iLoop).ConvertToInlineShapeĪctiveDocument.Shapes(iLoop).ScaleHeight 0.8, msoTrueĪctiveDocument.Shapes(iLoop).ScaleWidth 0.What this code does (only tested with fb v0.15 on XP Pro):ġ. If MsgBox("resize shape & convert to inline?", vbYesNo) = vbYes Then In case you DO have images that are not inline with text you should be able to fix them with this: Sub resizeImage()įor iLoop = 1 To Set myIlsh = (FileName:=imgPath, LinkToFile:=False, SaveWithDocument:=True) This could be addressed by changing the paragraph alignment BEFORE adding the image. The problem now seems to be that when you change the paragraph formatting you actually deselect the image. please try this then, (the comment about the image being behind text was confusing.).
