PDA

View Full Version : آموزش: برنامه ای به زبان ++c که آدرس پورت های موازی را پیدا می کند



dominic programmer
سه شنبه 12 مرداد 1389, 12:23 عصر
#include <iostream>
using namespace std;


void searchParallelPorts()
}
unsigned int *paddr; // pointer of addresses
unsigned int address; //address of port
int i; //a counter
paddr=(unsiged int *)0x00000408;


for(i=0;i<=3;i++)
}
address=*paddr;
if(address == 0)
cout<<"no find a port for LPT"<<i<<endl;
else
cout<<"find port for LPT"<<i<<" that is: "<<address<<endl;
*paddr++;
{
{

khafan_bat
سه شنبه 12 مرداد 1389, 13:29 عصر
خوب حالا آدرس رو پیدا کردیم....چه فایده ؟؟؟ مگه ویندوز اجازه دسترسی مستقیم یک برنامه رئ به درگاه موازی رو میده ؟؟؟ فکر نمی کنم. قبلا یک بار تست کرده بودم.



البته اینجا یکی با وقفه کار کرده میگه کار میکنه :


http://www.mattjustice.com/parport/par_vc.html


اینجا هم همینطور :


http://electrosofts.com/parallel/parallelwin.html



تو وی بی که مطمئنم در حالت عادی کار نمیکنه ، DLL میخواد !

http://www.aaroncake.net/electronics/vblpt.htm

B cannot directly access the hardware on a system. All hardware requests must go through Windows. Because of this, the closest we can get to manipulating the parallel port is wit the Printer object. While this is all fine and good when you want to actually print something, it is useless when we want direct hardware control. There may be API calls to get round this, but as of yet I have been unable to find any. In order to control the port directly, we must use something external to our program. It just so happens that there is a great, free product that does exactly what we want. It is a DLL from a company called SoftCircuits (http://www.softcircuits.com/). You can download this DLL from their Programming Tools and Libraries (http://www.softcircuits.com/sw_tools.htm) page. Use VBASM.DLL (in the VBASM.ZIP package) for VB1, VB2, VB3 or VB4 16Bit. Use WIN95IO.DLL (in the WIN95IO.ZIP package) for VB4 32bit, VB5 or VB6. No matter which one you choose, the DLL file itself must be in the windows\system directory in any machine the interface control software is to be used or developed on. Please note that no matter which DLL you use, this won't work under Windows NT (due to security).

dominic programmer
سه شنبه 12 مرداد 1389, 17:21 عصر
با سلام و تشکر از آقای khafan_bat
باید در پاسخ بگویم بله و نحوه این کار را در سایت خواهم گذاشت. و نشان می دهم چگونه می توان از پورت موازی به عنوان یک ورودی و خروجی اطلاعات استفاده کرد و از آن در برنامه ای به ++c که متنی را به چاپگر می فرستد و چاپ می کند و همینطور وضعیت چاپگر مثل اتمام کاغذ را خبر می دهد استفاده می کنم.