블로그 이미지
훅크선장

카테고리

분류 전체보기 (362)
사진이야기 (23)
펭귄컴퓨팅 (121)
컴퓨터보안 (84)
절름발이 프로그래머 (59)
하드웨어개조 (23)
멀알려줄까 (35)
홈베이킹&홈쿠킹 (2)
잡다한것들 (15)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

태그목록

최근에 올라온 글

델파이에서
Win32 API 대부분은 쉽게 사용할 수 있게 되어 있다.

그 이유는 
windows.pas 파일에서 함수들을 모두 제공하기 때문이다.

uses 
   windows; 
위 구문만 소스에 추가하면 Win32 API 함수를 모두 사용할 수 있다.

그런데, 최근에 SetFilePointerEx 라는 Win32 API가 필요했는데,
이것은 Delphi 2007, 2009에서도 제공하지 않고 있다. 즉, Windows.pas 파일에 내용이 없는 것이었다.

해결방법은 windows.pas에서와 같이, Win32 API를 import 하는 것이다.

실제로 windows.pas를 보면,
가장 비슷한 함수인 SetFilePointer라는 Win32 API가 다음과 같이 import 되어 있음을 알 수 있다.

interface
...
...
function SetFilePointer(hFile: THandle; lDistanceToMove: Longint;
  lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall;
{$EXTERNALSYM SetFilePointer}
...
...
implementation
...
...
function SetFilePointer; external kernel32 name 'SetFilePointer';

그렇다면 아주 간단하게 다음과 같이, SetFilePointerEx 를 import  할 수 있다.
interface
...
...
function SetFilePointerEx(hFile: THandle; lDistanceToMove: LARGE_INTEGER;
  lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetFilePointerEx}
...
...

implementation
...
...
function SetFilePointerEx; external kernel32 name 'SetFilePointerEx';
Posted by 훅크선장
, |