| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 837 人关注过本帖
标题:求助Delphi的源码用c#实现
只看楼主 加入收藏
meisbrother
Rank: 2
等 级:论坛游民
帖 子:100
专家分:29
注 册:2007-5-11
结帖率:84.62%
收藏
 问题点数:0 回复次数:2 
求助Delphi的源码用c#实现

unit P2KApi3;

interface

type
    TFilelistItem=record
        dwFileLength:Cardinal;
        dwAttr1,dwAttr2:Word;
        Name:array[0..$1f7] of Char;
    end;
    TP2KApi2Callback=procedure(Status:Integer) stdcall;
    TP2KApi3Callback=procedure(Status:Integer; lpszIFName:PChar) stdcall;
    TP2KApiProgressFunc=procedure(var fl:array of TFileListItem; CurIndex,TotalCount:Integer) stdcall;

const
    P2KAPIDLL='p2kapi3.dll';
   
function P2K_Init(StatusProc:TP2KApi2Callback): Integer; stdcall; external P2KAPIDLL;
function P2K3_Init(StatusProc:TP2KApi3Callback): Integer; stdcall; external P2KAPIDLL;
function P2K_GetStatus: Integer; stdcall; external P2KAPIDLL;
function File_List(var Buf:array of TFilelistItem; Count: Longword): Integer; stdcall; external P2KAPIDLL;
function File_Count: Integer; stdcall;external P2KAPIDLL;
function File_CountEx(PathAndMask:string): Integer; stdcall; external P2KAPIDLL;
function P2K_Restart: Integer; stdcall;external P2KAPIDLL;
function File_VolInfo(var Data: array of Byte): Integer; stdcall; external P2KAPIDLL;
function Mode_SwitchToAT:integer; stdcall;external P2KAPIDLL;
function Mode_SwitchToP2K(StatusProc:pointer):integer; external P2KAPIDLL;
function Mode_SwitchToTF:integer; stdcall; external P2KAPIDLL;
function Seem_Read(SeemNo, RecordNo, StartOffset, Bytes: Integer; var Data): Integer; stdcall; external P2KAPIDLL;
function Seem_Write(SeemNo, RecordNo, StartOffset, Bytes: Integer; var Data): Integer; stdcall; external P2KAPIDLL;
function File_Delete(FileName:String): Integer; stdcall; external P2KAPIDLL;
function File_Close: Integer; stdcall; external P2KAPIDLL;
function File_Write(Buffer:  array of byte; Size: Word): integer; stdcall; external P2KAPIDLL;
function File_Create(FileName:String;Attribute:Integer): Integer; stdcall; external P2KAPIDLL;
function File_Read(Buffer: array of byte;Size:Cardinal): Integer; stdcall; external P2KAPIDLL;
function File_SetPointer(Offset:Cardinal; MoveMethod: Cardinal): integer; stdcall; external P2KAPIDLL;
function P2K_Suspend: Integer; stdcall;external P2KAPIDLL;
function File_CreateDir(Dir:string;Attribute: Integer): Integer; stdcall; external P2KAPIDLL;
function File_DeleteDir(Dir:string): Integer; stdcall;external P2KAPIDLL;
function SetCOMPort(Port:string):Integer; stdcall; external P2KAPIDLL;
function P2K_SuspendEx(mode:Integer):Integer; stdcall; external P2KAPIDLL;
function P2K_PowerOff:Integer; stdcall; external P2KAPIDLL;
function P2K_SendCMD(Opcode:Cardinal; const SendData; cbSend:Integer; var RecvBuff; var cbRecv:Integer):Integer; stdcall; external P2KAPIDLL;
function File_ListEx(var Buf:array of TFileListItem; Count: Cardinal; ProgressFunc:TP2KApiProgressFunc):Integer; stdcall; external P2KAPIDLL;
function File_GetFreeSpace(lpstrDisk:PChar):Cardinal; stdcall; external P2KAPIDLL;
function USB_WriteData(const Buff; var Size:Cardinal):Integer; stdcall; external P2KAPIDLL;
function USB_ReadData(var Buff; var Size:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_WriteData(const Buff; var Size:Cardinal; dwTimeout:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_ReadData(var Buff; var Size:Cardinal; dwTimeout:Cardinal):Integer; stdcall; external P2KAPIDLL;
function P2K_GetIFHandle:Cardinal; stdcall; external P2KAPIDLL;
function P2K_GetInterface(var Buff; cbBuff:Integer):Integer; stdcall; external P2KAPIDLL;
function Flash_SendCmd(lpszCmdName:PChar; lpArgs:Pointer; cbArgs:Cardinal; var RecvBuff; var RecvSize:Cardinal; dwTimeout:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Addr(dwAddr:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Jump(dwAddr:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Bin(var Data; cbData:Cardinal):Integer; stdcall; external P2KAPIDLL;
function Flash_Dump(Base:Cardinal; var Buff):Integer; stdcall; external P2KAPIDLL;

implementation

end.
搜索更多相关主题的帖子: Delphi 源码 
2008-12-10 18:46
ecjob
Rank: 3Rank: 3
等 级:论坛游侠
威 望:8
帖 子:321
专家分:110
注 册:2006-10-15
收藏
得分:0 
调用 'p2kapi3.dll' 这个dll里面的函数而已.

找 C# 调用API

86年出生,广东求 女人/项目/工作 ,见广告即有效.论坛PM
2008-12-10 19:09
meisbrother
Rank: 2
等 级:论坛游民
帖 子:100
专家分:29
注 册:2007-5-11
收藏
得分:0 
道理是明白,但Delphi的这段不知怎么转换的C#中

type
    TFilelistItem=record
        dwFileLength:Cardinal;
        dwAttr1,dwAttr2:Word;
        Name:array[0..$1f7] of Char;
    end;
    TP2KApi2Callback=procedure(Status:Integer) stdcall;
    TP2KApi3Callback=procedure(Status:Integer; lpszIFName:PChar) stdcall;
    TP2KApiProgressFunc=procedure(var fl:array of TFileListItem; CurIndex,TotalCount:Integer) stdcall;

const
2008-12-11 08:37
快速回复:求助Delphi的源码用c#实现
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018946 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved