Thema: Delphi From C to delphi

Einzelnen Beitrag anzeigen

mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#5

Re: From C to delphi

  Alt 9. Okt 2009, 19:44
I use and declare the function FilterConnectCommunicationPort as follows :
function FilterConnectCommunicationPort(lpPortName: pWideChar; dwOptions: DWORD;
lpContect: pBYTE; wSizeOfContext: WORD; lpSecurityAttributes: PSECURITY_ATTRIBUTES; hPort: PHANDLE): HRESULT;stdcall; external 'FLTLIB.dll';


Use :
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
hport: THANDLE;
hr: HRESULT;
ScannerPortName:pWideChar;
begin
ScannerPortName:='\\ScannerPort';
hr:=FilterConnectCommunicationPort(ScannerPortName,0, Nil, 0, Nil,,@hport);
if hr=s_ok then
showmessage('Connected') else
showmessage('Not Connected'); //-->
end;
But always the result is 'Not Connected'.
is there any error in my Delphi Code .
  Mit Zitat antworten Zitat