468,253 Members | 1,255 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,253 developers. It's quick & easy.

problem in inpout32.dll

i make project control by parallel port, to make that i added file called inpout32.dll to system folder in windows folder but when i went to my project and make add reference error message appear and tell me(c cannot added reference and make sure that the file is accessible and that is avalid assembly or com component)
how can i solve this problem.
Feb 10 '09 #1
6 6042
229 Expert 100+
Inpout32.dll in an unmanaged dll. It is not an assembly, and it is not a COM component.

To use unmanaged APIs from .NET you will have to use P/Invoke. This means that you have to add your function signatures manually:

Expand|Select|Wrap|Line Numbers
  1. [DllImport("inpout32.dll", EntryPoint="Out32")]
  2. public static extern void Output(int adress, int value);
Google for "inpout32.dll c#" and you will find several examples.
Feb 11 '09 #2
i want to ask another question
i want to use kbhit function in c#
to make control by pc.
how can i declared it ?
Feb 11 '09 #3
344 100+
If you use windows forms you can add event handler to the form's events, keydown, keyup, keypressed... etc.
1) Right click on the form -> Properties
2) Select events (small icon) from properties explorer
3) Double click on any event you want to make an event handler for it, it'll make the event handler method in the code behind, impelement it as you want.
Feb 11 '09 #4
i use windows form app,i made what you said,but i want to execute some instruction when i press keyboard so i need function to tell me if keyboard pressed or not,what is this function??
this is the code i wrote it in form _keypress

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
if (KeyPress ==1)
int n;
switch (n)
case 0:
accessport.Output(888, 0);
case 1:
accessport.Output(888, 1);
case 2:
accessport.Output(888, 2);
case 3:
accessport.Output(888, 3);
case 4:
accessport.Output(888, 4);
case 5:
accessport.Output(888, 5);
case 6:
accessport.Output(888, 6);
case 7:
accessport.Output(888, 7);
case 8:
accessport.Output(888, 8);
case 9:
accessport.Output(888, 9);

Feb 11 '09 #5
3,525 Expert 2GB
A) Please use [code] tags
B) Reacting to key presses is something I know has been covered here on Bytes many times as well as numerous other tutorials on the 'net. As someone starting out the burden is on you to do some research of your own, as well as some trial and error experimentation to learn.

The people here are happy to help when you have "hit a wall", but shouldn't be the first place you go... "Oh it didn't work, I'll get someone to tell me the answer." You need to take it upon yourself to read tutorials, books, on-line references and tear apart the source code of thousands of projects available. Reading through working source code by more experienced coders will teach you LOTS!
Feb 11 '09 #6
344 100+
What is KeyPress? looks like a field, but for what reason you use it.
Form1_KeyPress will not be executed until a key is pressed, so don't ask again about the key is pressed or not. I mean that I think
Expand|Select|Wrap|Line Numbers
  1. if (KeyPress ==1)
is redundant.
Expand|Select|Wrap|Line Numbers
  1. switch (n)
How n will has a value, execute this statement will make an exception to ocuurs.
If there is an error occurs
some trial and error experimentation to learn
As tlhintoq said.
Good Luck
Feb 13 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Kostatus | last post: by
117 posts views Thread by Peter Olcott | last post: by
28 posts views Thread by Jon Davis | last post: by
4 posts views Thread by Nurchi BECHED | last post: by
1 post views Thread by vertigo | last post: by
6 posts views Thread by Ammar | last post: by
3 posts views Thread by Fr33dan | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.