Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    60

    [c] in che cartella copiare inpout32.dll??

    salve
    volendo provare a utilizzare la porta parallela per controllare un motore passo-passo mi sono messo a cercare nel forum ed ho visto che è stato consigliato ad u utente con il mio stesso problema questo link:http://www.hytherion.com:80/beattidp/comput/pport.htm.
    Qui c'è un programmino in c :

    /**************************************************/
    /*** ***/
    /*** TEST.c -- test interface to inpout32.dll ***/
    /*** ( http://www.logix4u.net/inpout32.htm ) ***/
    /*** ***/
    /*** Copyright (C) 2003, Douglas Beattie Jr. ***/
    /*** ***/
    /*** <beattidp@ieee.org> ***/
    /*** http://www.hytherion.com/beattidp/ ***/
    /*** ***/
    /**************************************************/
    /* Last Update: 2006.05.14
    */

    /************************************************** *****/
    /* */
    /* Builds with Borland's Command-line C Compiler */
    /* (free for public download from Borland.com, at */
    /* http://www.borland.com/bcppbuilder/freecompiler ) */
    /* */
    /* Compile with: */
    /* */
    /* BCC32 -IC:\BORLAND\BCC55\INCLUDE TEST.C */
    /* */
    /* */
    /* Be sure to change the Port addresses */
    /* accordingly if your LPT port is addressed */
    /* elsewhere. */
    /* */
    /************************************************** *****/




    #include <stdio.h>
    #include <conio.h>
    #include <windows.h>


    /* Definitions in the build of inpout32.dll are: */
    /* short _stdcall Inp32(short PortAddress); */
    /* void _stdcall Out32(short PortAddress, short data); */


    /* prototype (function typedef) for DLL function Inp32: */

    typedef short (_stdcall *inpfuncPtr)(short portaddr);
    typedef void (_stdcall *oupfuncPtr)(short portaddr, short datum);

    int main(void)
    {
    HINSTANCE hLib;
    inpfuncPtr inp32;
    oupfuncPtr oup32;

    short x;
    int i;

    /* Load the library */
    hLib = LoadLibrary("inpout32.dll");

    if (hLib == NULL) {
    printf("LoadLibrary Failed.\n");
    return -1;
    }

    /* get the address of the function */

    inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");

    if (inp32 == NULL) {
    printf("GetProcAddress for Inp32 Failed.\n");
    return -1;
    }


    oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");

    if (oup32 == NULL) {
    printf("GetProcAddress for Oup32 Failed.\n");
    return -1;
    }


    /************************************************** *************/
    /* now test the functions */

    /* Try to read 0x378..0x37F, LPT1: */

    for (i=0x378; (i<0x380); i++) {

    x = (inp32)(i);

    printf("port read (%04X)= %04X\n",i,x);
    }



    /***** Write the data register */

    i=0x378;
    x=0x77;

    (oup32)(i,x);

    printf("port write to 0x%X, datum=0x%2X\n" ,i ,x);

    /***** And read back to verify */
    x = (inp32)(i);
    printf("port read (%04X)= %04X\n",i,x);



    e anche la libreria inpout32.dll.
    la mia domanda è in che cartella devo copiare questa libreria???ho provato a metterla in
    system,system32,WINDOWS ma quando vado ad eseguire il programma ho:

    LoadLibrary Failed

    come posso fare???
    ho compilato ed eseguito con visual c++..............

  2. #2
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    Nella LoadLibrary inserisci il path completo della dll.

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    60
    ok grazie

  4. #4
    Puoi anche lasciare la LoadLibrary() così com'è
    e metti la dll nella stessa cartella dov'è l'eseguile.
    01010011 01100001 01101101 01110101 01100101 01101100 01100101 01011111 00110111 00110000
    All errors are undocumented features waiting to be discovered.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.