下面的程序谁能读懂,C++的程序转成DELPHI(100分)

  • 主题发起人 主题发起人 songyp
  • 开始时间 开始时间
S

songyp

Unregistered / Unconfirmed
GUEST, unregistred user!
[:)]下面的程序是用c++写的,它的功能是将图像给扫描到内存中,我如何把下面的程序改
成delphi的并且存成一个文件
代码:
    int nline = 100; // number of line in one scan buffer
    HGLOBAL hBuf = GlobalAlloc(GMEM_FIXED, lLineByte* nline);
    LPBYTE lpBuf = NULL;
    if(hBuf) lpBuf = (LPBYTE)GlobalLock(hBuf);
    else return;

    // start to get image from scanner
    // check if the total lines are reaching our desired number and
    // check if the return lines are zero, if SS_Scan return zero,it
    // means the scanning is finished or error occurs
    int nScanLine;
    int nTotalLine=0;
    while(nTotalLine < BIH.biHeight &amp;&amp; (nScanLine = SS_Scan(lpBuf, nline))) {

        // ToDo: save image here for lpBuf, or move image to user's buf from lpBuf

        nTotalLine+=nScanLine;
    }
 
SS_Scan()函数是?
 
var nline:integer;
hBuf:HGLOBAL;
lpBuf:LPBYTE;
nScanLine:Integer;
nToTalLine:Integer;
begin
nline:=100;
hBuf := GlobalAlloc(GMEM_FIXED, lIinebyte*nline);
lpBuf := nil;
if assigned(hBuf) then lpBuf:=LPBYTE(GlobalLock(hBuf)) else Exit;
// start to get image from scanner
// check if the total lines are reaching our desired number and
// check if the return lines are zero, if SS_Scan return zero,it
// means the scanning is finished or error occurs
while (nTotalLine < BIH.biHeight) and (nScanLine = SS_Scan(lpBuf, nline)) do
// ToDo: save image here for lpBuf, or move image to user's buf from lpBuf
inc(nTotalLine,nScanLine);
 
这是它的函数原型
DLLEXPORT short SS_Scan(BYTE huge *buf,short bufnline);
 
while(nTotalLine < BIH.biHeight &amp;&amp; (nScanLine = SS_Scan(lpBuf, nline)))
{
nTotalLine+=nScanLine;
}
这两行语句看明白了吗? 这里的=号的含义应该是赋值吧
LPBYTE是一个指针的byte,在delphi中应该是pbyte吧
assigned(hBuf)这个不明白
 
后退
顶部