C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[70966] Re:Re:io.dll 사용법좀봐주세요....
답변 감사드립니다. [] 2613 읽음    2014-02-28 09:38
그 생각을 못했네요....
일단 한단계는 넘어갔네요..
정말 감사드립니다.

kylix 님이 쓰신 글 :
: C는 잘 모르지만.... 아래 코드가 아닐런지...
: hio = LoadLibrary("c:\\...어쩌고...\\io.dll");
:
: 맙소사 님이 쓰신 글 :
: : 일단 너무 기초적인것 같아 .... 웃지마시고 지도 좀 부탁드립니다.
: :
: : 제가 터보익스플로러를 사용 하는 어마어마한 초보 입니다.
: :
: : 제가 하려고 하는것은
: :
: : io.dll 사용하여 프린트포트로 1출력하고 1초후 다시 0출력하려고 합니다.
: :
: : > implib io io.dll  해서 lib 말들어서 .lib  .h  .dll 파일 3개를 소스 폴더에 복사후
: :
: : add to project 에 lib 파일 선택했습니다.
: :
: : 폼위에 T버튼과 Tedit 1개씩 있습니다.
: :
: : 버튼을 누르면 dll 로드해서 실패하면  에디트창에 실패라고쓰고 끝
: : 성공하면 프린트포트로 1출력하고 1초후 다시 0출력
: :
: : 이렇게 하려고 하는데 계속 실패만 나옵니다.
: :
: : 잘못된 부분좀 알려 주세요...
: :
: : 아래는 제가 수정한 Unit1.cpp 파일의 내용 입니다.  다른파일은 건드릴게 없습니다.
: :
: :
: : #include <vcl.h>
: : #pragma hdrstop
: :
: : #include "Unit1.h"
: :
: : #include "io.h"
: : #include <dos.h>
: :
: : #define LPT1add 0x378
: :
: : PORTOUT PortOut;
: : PORTWORDOUT PortWordOut;
: : PORTDWORDOUT PortDWordOut;
: : PORTIN PortIn;
: : PORTWORDIN PortWordIn;
: : PORTDWORDIN PortDWordIn;
: : SETPORTBIT SetPortBit;
: : CLRPORTBIT ClrPortBit;
: : NOTPORTBIT NotPortBit;
: : GETPORTBIT GetPortBit;
: : RIGHTPORTSHIFT RightPortShift;
: : LEFTPORTSHIFT LeftPortShift;
: : ISDRIVERINSTALLED IsDriverInstalled;
: :
: :
: : HMODULE hio;
: :
: : void UnloadIODLL()
: : {
: :    FreeLibrary(hio);
: : }
: : int LoadIODLL()
: : {
: :    hio = LoadLibrary("io");
: :    if (hio == NULL) return 1;
: :
: :    PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");
: :    PortWordOut = (PORTWORDOUT)GetProcAddress(hio, "PortWordOut");
: :    PortDWordOut = (PORTDWORDOUT)GetProcAddress(hio, "PortDWordOut");
: :    PortIn = (PORTIN)GetProcAddress(hio, "PortIn");
: :    PortWordIn = (PORTWORDIN)GetProcAddress(hio, "PortWordIn");
: :    PortDWordIn = (PORTDWORDIN)GetProcAddress(hio, "PortDWordIn");
: :    SetPortBit = (SETPORTBIT)GetProcAddress(hio, "SetPortBit");
: :    ClrPortBit = (CLRPORTBIT)GetProcAddress(hio, "ClrPortBit");
: :    NotPortBit = (NOTPORTBIT)GetProcAddress(hio, "NotPortBit");
: :    GetPortBit = (GETPORTBIT)GetProcAddress(hio, "GetPortBit");
: :    RightPortShift = (RIGHTPORTSHIFT)GetProcAddress(hio, "RightPortShift");
: :    LeftPortShift = (LEFTPORTSHIFT)GetProcAddress(hio, "LeftPortShift");
: :    IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");
: :
: :    atexit(UnloadIODLL);
: :
: :    return 0;
: : }
: :
: : //---------------------------------------------------------------------------
: : #pragma package(smart_init)
: : #pragma resource "*.dfm"
: : TForm1 *Form1;
: : //---------------------------------------------------------------------------
: : __fastcall TForm1::TForm1(TComponent* Owner)
: :     : TForm(Owner)
: : {
: : }
: : //---------------------------------------------------------------------------
: : void __fastcall TForm1::Button1Click(TObject *Sender)
: : {
: :    unsigned char ttt;
: :
: :    if(LoadIODLL())
: :       Edit1->Text="DLL 링크 실패";
: :    else {
: :       Edit1->Text="DLL 링크 성공";
: :
: :       ttt=0x01;
: :       PortOut(LPT1add, ttt);
: :
: :       Sleep(1);
: :
: :       ttt=0x00;
: :       PortOut(LPT1add, ttt);
: :    //
: :    };
: : }
: : //---------------------------------------------------------------------------

+ -

관련 글 리스트
70927 io.dll 사용법좀봐주세요.... 맙소사 5559 2014/02/20
70932     Re:io.dll 사용법좀봐주세요.... kylix 5674 2014/02/21
70966         Re:Re:io.dll 사용법좀봐주세요.... 답변 감사드립니다. 2613 2014/02/28
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.