본문 바로가기

델파이

(7)
Delphi TChart 에서 마우스 Wheel 이벤트 사용하기. TChart 에서 OnMouseWheel 이벤트를 사용하려면...1) TeeChart unit 에서 갖고 있는 global const "TeeUseMouseWheel" 이놈이 True 로 설정되야하고,2) 해당하는 TChart 가 focused 되어 있어야 OnMouseWheel 이벤트를 받을 수 있습니다. 소스코드 시작부분 아무데나, 적당히 form_create 이벤트 정도에서... TeeUseMouseWheel := True; // 이렇게 True 설정 해줘야 하고.Tchart1.TabStop := True; // 콤포넌트 property true 로 설정되야 하고, 그래도 원활히 안되면, 해당 form 에서 wheel 이벤트를 받을때,Chart1.SetFocus; // 를 불러서 강제로 포커싱 해주..
32bit dll 이 64bit OS 에러 안돌아갈때..? Codegear C++ builder 에서 컴파일한 32bit dll 이 64bit OS 에서 안돌아갈때 ? cc32100.dll 을 찾아서 같이 넣어 놓으면 돌아간다.
최신 델파이에서 NI 함수 사용하기. NI 에서 제공하는 DLL wrapper 의 예는 아래와 같습니다. // DAQmxLoadTask 함수의 원형... function DAQmxLoadTask(taskName:PChar; taskHandle:PLongint):Longint; stdcall; // DAQmxLoadTask 함수는 nicaiu.dll 에 있음... function DAQmxLoadTask; external 'nicaiu.dll'; 근데 Delphi7 에서는 그냥 사용하면 되는데.. Delphi 2010 또는 최신의 델파이를 사용하면, PChar 또는 String 으로 선언한 taskName 이 unicode (2byte 문자열) 로 잡혀서 위의 함수들이 call 될때 제대로된 taskName 을 함수로 전달하지 못하는 문제가 ..
Execute a DOS command and capture the output 아래는 함수 구현부... 외부 DOS 프로그램을 실행시키고, 결과를 Capture 해서 핸들링하는데 유용하다. function GetDosOutput(CommandLine: string; Work: string = 'C:\'): string; var SA: TSecurityAttributes; SI: TStartupInfo; PI: TProcessInformation; StdOutPipeRead, StdOutPipeWrite: THandle; WasOK: Boolean; Buffer: array[0..255] of AnsiChar; BytesRead: Cardinal; WorkDir: string; Handle: Boolean; begin Result := ''; with SA do begin nLeng..
문자열에서 필요한 내용들을 Parsing 할때? "ExtractStrings" "Hello World 34:32:11:345:32" 이라는 문자열에서.. "Hello","World","34","32","11","345","32" 로 문자열에서 내부 문자열을 쪼개서 가져오고 싶을때, 쉽게 쓸수 있는 함수입니다.function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings): Integer;예제는 구글링으로 쉽게 찾을 수 있습니다.
Delphi + Rave Report + tChart 델파이에 언젠가 부터 들어간 Rave Report... 도대체 어떻게 프린트를 하라는건지....-_-; 개 고 생... 5시간 끝에 겨우겨우... 텍스트 접근되고 그래프 프린트가 된다... 영원히 잃어버리지 않으려고 여기다 올린다. 보고싶으신분 언제든지 가져가세요. T_T
StringGrid 에 두줄넣기 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids; type TForm1 = class(TForm) StringGrid1: TStringGrid; Button1: TButton; procedure Button1Click(Sender: TObject); procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); private { Private declarations } public { Public decl..