本帖最后由 z93620104 于 2010-09-16 09:43:12 编辑

解决方案 »

  1.   

    试试换个顺序:
    type
      
      TInstanceBlock = packed record
      Next: PInstanceBlock;
      Code: array[1..2] of Byte;
      WndProcPtr: Pointer;
      Instances: array[0..InstanceCount] of TObjectInstance;
      end;  PInstanceBlock = ^TInstanceBlock;
      

  2.   

    顺序错了吧。
    先TInstanceBlock = packed record
      Next: PInstanceBlock;
      Code: array[1..2] of Byte;
      WndProcPtr: Pointer;
      Instances: array[0..InstanceCount] of TObjectInstance;
      end;后PInstanceBlock = ^TInstanceBlock;
      

  3.   

    那个顺序是Classes里面Delphi自己定义的,而且我也尝试改变顺序了,一样报错,纠结ING,请高手不吝赐教
      

  4.   

    那个代码是Classes里面的定义啦,呵呵。下面是我的function TNbTools.AddNameToAll(plenum:PLanaEnum; name:PChar; bGroup:Integer=1;RetArr:PInteger=Nil):Integer;
    label ENDFUNC ;
    Var
      i,iRet:DWORD ;
      dwSize:DWORD ;
      InstBlckLst:PInstanceBlock ; 
    begin
    iRet := 1;  dwSize := sizeof(PHANDLE) * DWORD(plenum.length) ;
      InstBlckLst := VirtualAlloc(Nil, dwSize, MEM_COMMIT,PAGE_READWRITE) ; for i:=0 to Integer(plenum.length)-1 do
    begin
    Cardinal(InstBlckLst[i]):= CreateEvent(Nil,true,false,Nil); if(Boolean(bGroup)) then m_ncb[i].ncb_command := AnsiChar(NCBADDGRNAME or ASYNCH)
    else    m_ncb[i].ncb_command := AnsiChar(NCBADDNAME or ASYNCH); m_ncb[i].ncb_event := InstBlckLst[i]; m_ncb[i].ncb_lana_num := plenum.lana[i];
    MakeNetbiosName (@m_ncb[i].ncb_name, PAnsiChar(name));
    Netbios (@m_ncb[i]);
    end; i := WaitForMultipleObjects(plenum.length,InstBlckLst,true,10000);
    if((i=WAIT_TIMEOUT) or (i=WAIT_FAILED)) then
      begin
        iRet:=0;
        goto ENDFUNC;
      end; for i:=0 to Integer(plenum.length) do
    begin
    if(m_ncb[i].ncb_retcode <>NRC_GOODRET) then
    begin
    iRet:=0;
    if(Boolean(RetArr)) then RetArr[i] := - @m_ncb[i].ncb_retcode;
    end
    else if(Boolean(RetArr)) then RetArr[i]:= @m_ncb[i].ncb_num;
    end;ENDFUNC:
    for i:=0 to plenum.length do
    CloseHandle(InstBlckLst[i]);
    //free(InstBlckLst);
    VirtualFree(InstBlckLst,0,MEM_RELEASE);
    result := iRet;end;
      

  5.   

    你的这段是否和自己的代码不再同一单元中?
      PInstanceBlock = ^TInstanceBlock;
      TInstanceBlock = packed record
      Next: PInstanceBlock;
      Code: array[1..2] of Byte;
      WndProcPtr: Pointer;
      Instances: array[0..InstanceCount] of TObjectInstance;
      end;看这段代码在哪个单元里面,(假设是unit  x)
    然后在你的代码上面的uses中加上这个单元 x,
    uses  x
    就好了
      

  6.   

    谢谢楼上的,它是在Delphi2010的Classes单元里,而且在我的单元里我肯定uses Classes单元了
      

  7.   

    还有就是,Classes中没有这样的定义type
      PObjectInstance = ^TObjectInstance;
      TObjectInstance = packed record
      Code: Byte;
      Offset: Integer;
      case Integer of
      0: (Next: PObjectInstance);
      1: (FMethod: TWndMethod);
      end;type
      PInstanceBlock = ^TInstanceBlock;
      TInstanceBlock = packed record
      Next: PInstanceBlock;
      Code: array[1..2] of Byte;
      WndProcPtr: Pointer;
      Instances: array[0..InstanceCount] of TObjectInstance;
      end;
    我刚看了,所以你之前说的有点。
      

  8.   

    哦,你用的delphi2010哦?我用D5看的。误会
      

  9.   

      2010呀,这我可就费劲了,选中PInstanceBlock按F1,弹出的帮助里面有一个unit吧?那下面写的也是Classes?
      

  10.   

    那个是在classes单元内部使用的,你要使用在自己的单元重新再声明一次就好了
      

  11.   


    像这样的我怎么声明,我是要把它在Classes里的定义整个搬到我自己的单元里吗?