Maison > base de données > tutoriel mysql > le corps du texte

How can I access Parallel Port through a printer to print RF

WBOY
Libérer: 2016-06-07 15:38:34
original
1072 Les gens l'ont consulté

Using CreateFile and WriteFile from win32 api: [DllImport( " kernel32.dll " )] private static extern int CreateFile( string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlags

Using CreateFile and WriteFile from win32 api:

[DllImport(<span>"</span><span>kernel32.dll </span><span>"</span><span>)]
</span><span>private</span> <span>static</span> <span>extern</span> <span>int</span><span> CreateFile(
    </span><span>string</span><span> lpFileName,
    </span><span>uint</span><span> dwDesiredAccess,
    </span><span>int</span><span> dwShareMode,
    </span><span>int</span><span> lpSecurityAttributes,
    </span><span>int</span><span> dwCreationDisposition,
    </span><span>int</span><span> dwFlagsAndAttributes,
    </span><span>int</span><span> hTemplateFile);

[DllImport(</span><span>"</span><span>kernel32.dll </span><span>"</span><span>)]
privatestaticextern </span><span>bool</span><span> WriteFile(
    </span><span>int</span><span> hFile,
    </span><span>byte</span><span>[] lpBuffer,
    </span><span>int</span><span> nNumberOfBytesToWrite,
    </span><span>ref</span> <span>int</span><span> lpNumberOfBytesWritten,
    </span><span>ref</span><span>   OVERLAPPED lpOverlapped
  );
iHandle </span>=CreateFile(<span>"</span><span>lpt1 </span><span>"</span>,<span>0x40000000</span>,<span>0</span>,<span>0</span>,<span>3</span>,<span>0</span>,<span>0</span>);<br><br><span>byte</span>[] mybyte =<span>System.Text.Encoding.Default.GetBytes(Mystring);
</span><span>bool</span> b =WriteFile(iHandle, mybyte, mybyte.Length,<span>ref</span>   i,<span>ref</span>   x);
Copier après la connexion

 

It can transport barcode command and print barcode well, but it can not read the status from the parallel port.

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal