Hi,
I am using streatchblt() and SetStretchBltMode() functions of unmanaged code in C# for printing image. For doing that I am calling the external gdi32.dll (form windows folder) file.
I am new in doing this sort of platform invoke operation. Plz tell me if my software is run in any windows version ranges form windows 95 to vista or any upcoming version, will this be problematic?
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]static extern bool StretchBlt(IntPtr hdcDest, int nXOriginDest, int nYOriginDest,int nWidthDest, int nHeightDest, IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, Int32 dwRop);
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
static extern bool SetStretchBltMode(IntPtr hdc, int iStretchMode);
>> I have tried to add this dll file as a reference in my code but failed to do so as this file is unaccessible.
Plz tell me if I have any alternative for doing the work of the above mensioned functions with managed code.
thanks in advance,
Faysal
AlanPosted Apr 24, 2008, 2:29 PM
To the best of my knowledge, there are no managed alternatives to the unmanaged functions StretchBlt() or SetStretchBltMode().
.NET applications will not run on Windows 95 at all.
However, apart from an issue with some versions of Window 98 (see link below) these functions work with all subsequent versions of Windows up to and including Windows Vista and will probably continue to do so in the next version at least.
http://support.microsoft.com/kb/q138105/
I wouldn't worry too much about using unmanaged functions in C# as I do it all the time. It's just not feasible to wrap all unmanaged libraries and functions within the .NET Framework and keep the latter to a reasonable size.
HasanPosted Apr 24, 2008, 4:43 AM
Plz tell me if you know about any such function in C# or any other way to obtain a better print out quality of image in C#. (I really want to avoid unmanaged code in C#)
Faysal