Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

inpout.dll and Visual C++

Status
Not open for further replies.

gastonanthony

New Member
hi, just got a problem that's buggin' me for a while now. I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs, the exact link of the code i'm trying to do is this

**broken link removed**
 
gastonanthony said:
hi, just got a problem that's buggin' me for a while now. I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs, the exact link of the code i'm trying to do is this

Can't help you on that DLL, but if you download the driver DLL that I use with WinPicProg it comes with examples in C.

BTW, did you install the program?, the one I use requires installing.
 
gastonanthony said:
hi, just got a problem that's buggin' me for a while now. I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs, the exact link of the code i'm trying to do is this

**broken link removed**

Try putting it in either c:\windows or c:\windows\system32 instead. we normally dun put driver in C:\windows\system. If problem still persist, try putting that driver in the same directory where you run your program.
 
the instructions only told me to put the inpout32.dll in the C:\windows\system folder, it doesn't need to be installed (i think), it is located here http://www.logix4u.net I already ...icrosoft, I attached the details of the error
 

Attachments

  • xperror.gif
    xperror.gif
    20.7 KB · Views: 1,321
I'm trying to do camera that follows a moving object (it must be pc based), so i'll need to experiment on the parallel port, after the program sees where the object is going, the motor beneath the camera must rotate in order for the camera to catch up.
Nigel, can the driver you mentioned be used in this project?
 
gastonanthony said:
the instructions only told me to put the inpout32.dll in the C:\windows\system folder, it doesn't need to be installed (i think), it is located here http://www.logix4u.net I already ..., most prob your error come from programming.
 
i've already tried it with visual basic and it went fine, got it running in VB6 a few months ago. but my project needs to be done in visual C++ right now because the image processing will be done in C++, and I would like to have a uniform language in my project so as not to have problems with the delay in processing instructions, etc...I chose C++ for the speed of image processing. The problem is, I have no experience in using inpout32.dll for visual C++.
 
gastonanthony said:
i've already tried it with visual basic and it went fine, got it running in VB6 a few months ago. but my project needs to be done in visual C++ right now because the image processing will be done in C++, and I would like to have a uniform language in my project so as not to have problems with the delay in processing instructions, etc...I chose C++ for the speed of image processing. The problem is, I have no experience in using inpout32.dll for visual C++.

Well, i just went and download the package again. It include a VC6++ source code inside. I compile it and run. It went fine without any crash. Here is the source

Code:
// InpoutTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
/* ----Prototypes of Inp and Outp--- */

short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);

/*--------------------------------*/

int main(int argc, char* argv[])
{

	int data;

	if(argc<3)
	{
		//too few command line arguments, show usage
		printf("Error : too few arguments\n\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
	} 
	else if(!strcmp(argv[1],"read"))
	{

		data = Inp32(atoi(argv[2]));

		printf("Data read from address %s is %d \n\n\n\n",argv[2],data);
	
	}
	else if(!strcmp(argv[1],"write"))
	{
		if(argc<4)
		{
			printf("Error in arguments supplied");
			printf("\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
		}
		else
		{
		Out32(atoi(argv[2]),atoi(argv[3]));
		printf("data written to %s\n\n\n",argv[2]);
		}
	}



	return 0;
}

Remember to include stdafx.h & stdafx.cpp in your project. I believe wat u need is only 2 function, "Inp32()" & "Out32()". Run the example again. If you can run VB6 example fine, i see no reason why you cannot do the same for VC6++
 
what operating system are you using? I'm using windows XP and I had a problem talking to my parallel port because there was something in the O.S. that blocked me from accessing it.

I dunno if this is your problem or not, but I thought I'd throw it out there.

....edit: Nevermind, just scrolled through your link there and saw that the problem was fixed inside that DLL file.
 
a DLL is the windows equivelent of a .so file for Linux

basically a shared libary of functions
say you write a program and in that program you want to have a dialog box for choosing a file you can do two things

1) write one from scratch yourself
2) use the one provided by your operating system/Desktop manager

number 2 is perfered since it simplifies your code by re-using someone elses code/function


So you want to write a program that accesses the parallel port (linux this would be very easy btw).
So you can do two things

1) write a low-level access to the BIOS to access and enumerate the parallel port
2) take advantage of someone elses hardwork and use their functions

now this inpout32.dll will do this, it provides the nessacary fucntions to use the parallel port easily.
To use it you need a header file (probably call inpout32.h) and do a #include at the start of your code

This will give your code access to the functions contained within the DLL.

Shared libaries aid in keeping things simple, why bother re-inventing/re-coding something that someone else has done


I am a python programmer and the equiv is the import declaration to load in the ability to use functions that other ppl have written
 
Styx said:
1) write a low-level access to the BIOS to access and enumerate the parallel port

This isn't quite true, you can't use low level access to ports under Win32 (NT and above), the OS prevents you doing it. What the port drivers do is allow you to access the ports in a 'legal' way by using a Windows driver.

If you want to see more about it, have a look at **broken link removed** for details, including a link to the source code.
 
Nigel Goodwin said:
Styx said:
1) write a low-level access to the BIOS to access and enumerate the parallel port

This isn't quite true, you can't use low level access to ports under Win32 (NT and above), the OS prevents you doing it. What the port drivers do is allow you to access the ports in a 'legal' way by using a Windows driver.

If you want to see more about it, have a look at **broken link removed** for details, including a link to the source code.

Fair enough I am a linux-head and it is easy really, we access the kernel-driver to enable full kernel control of a port, or just access the /dev/ps0 for direct access.

Been a while since coding for windows and low-level (windows 3.1)

So sounds like you need to have kernel-access to code one yourself (very hard from what I have heard with the NT kernel) so use the code someone else has done
 
gastonanthony said:
I still don't understand, may someone please tell me what a dll does and what inpout32.dll does?I really have no clue yet

A DLL is a Dynamically Loaded Library.

It's a library of code you can access in your programs by dynamically loading it at runtime. In your case, inpout32.dll implements all the Windows specifics so you can easily access the ports with only 2 different functions. Simple as that.

https://en.wikipedia.org/wiki/Library_(computer_science)#Dynamic_linking
 
all you need to do is inport these 2 files (in the zip) to the project!!!
 

Attachments

  • inpout32_120.zip
    12.4 KB · Views: 347
danielsmusic said:
all you need to do is inport these 2 files (in the zip) to the project!!!

Not quite. The .lib needs to be linked to the final executable. The .dll only needs to reside someplace where Windows will be able to find it during execution, namely the Windows\System32 folder on NT/2000/XP systems and Windows\System on 95/98/ME.

gastonanthony appears to have done just that judging from the previous posts, so he'd already have the required files. If the DLL was missing, he'd get a more friendly error message, and if the .lib wasn't linked during the build stage, he wouldn't have an .exe
 
Joel Rainville said:
[
Not quite. The .lib needs to be linked to the final executable. The .dll only needs to reside someplace where Windows will be able to find it during execution, namely the Windows\System32 folder on NT/2000/XP systems and Windows\System on 95/98/ME.
or in the present working directory

IT is very bad practice to start putting DLL's into the system32 folder that did not come with the OS.

It was that kind of practice that has lead to DLL-hell


DLL-Hell: When a programmer customises a system-dll and puts that in the system folder. Another programmer customises the same dll (for another program) as a result program1 no longer works

Have that on a OS-scale modification and you start to see why Windows-95, Windows-NT, Windows-98, Windows-ME were soo unstable.
2k and XP overcame this to some extent by protecting SYSTEM-dependant DLL from replacement (except during a SP or patch).

Other DLL's can still be perverted.

RPM-based linux distrobutions have something called RPM-Hell or (dependancy-hell) where there is no disctict link between the dependacy of one DLL to another.

Linux does not have the equiv of DLL-hell (as in programmers customising DLL's) since it is all open-source and If they want something in a *.SO they just submitt it, otherwise they will just make their own shared libary.

Leave the DLL in the working directory to ensure no pain later
 
Styx said:
Been a while since coding for windows and low-level (windows 3.1)

In 3.1, or 95 based Windows, you can 'bash the hardware' as much as you like :lol:

No drivers needed!.

However, the driver I use works under 95 upwards, and although I could have written it so it's not required for Win95, I didn't see the point. So WinPicProg requires it's driver DLL for ALL supported OS's - Win16 isn't supported, as it's a 32 bit program.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top