I think you might need to replace 'Byval lpNumberofBytesWritten as int32' to ByRef lpNumberofBytesWritten as int32' The API will return a value in this parameter telling you how bytes have been written

NOTE: fsmSortGetFrontMemory should only be called by the above mentioned call back functions.
NOTE: fsmSortGetBackMemory should only be called by the above mentioned call back functions.

Get the memory locations for the front from struct SortCallBack pointed to by lParam. fsnSortGetBackMemory gets the memory location for the back image.
NOTE: It is the user’s responsibility to allocate enough memory for the images. We suggest 128,000 for TIFF (bitonal, black/white images) and 8 * 128,000 for gray scale (JPEG, 25% quality). Obviously, these are extremely generous sizes for the files. Smaller will work but we do not guarantee the results.

NOTE: On the 5180 when fsmScanImageFirst is called, the image call back function will return the image in memory.
Syntax

Gets the memory pointers for the document from struct SortCallBack pointed to by lParam.

Arguments

lParam lParam passed to the call back function. Pass lParam in the call back function directly to this function without modification.

plFrontFileSize Size in bytes of front image in memory.
plBackFileSize Size in bytes of back image in memory.

Returns

Return functions points to pcFront or memory location for the front image or pcBack or memory location for the back image. If return is NULL, then no image is available in memory or if *plFrontSize or *plBackSize = 0, then an image is not available.

I think you might need to replace 'Byval lpNumberofBytesWritten as int32' to ByRef lpNumberofBytesWritten as int32' The API will return a value in this parameter telling you how bytes have been written to the file.

Featured Post

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way.
I've always enjoyed working with graphics, but it's never too clever to re-invent …

1.0 - Introduction
Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET).
If ever there was a subject full of murkiness and bad decisions, it is this one! The first problem seems to be that people considering this task of converting…

Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…