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 .