Delphi/간단하게 Delphi/간단하게 간단하게 IP 가져오기 uses .., IdStack; function GetLocalAddress: string; begin TIdStack.IncUsage; try Result := GStack.LocalAddress; finally TIdStack.DecUsage; end; end; Delphi/간단하게 간단하게 PC의 전원상태 체크하기 PC의 전원 상태를 체크하여 절전모드 이후 처리해야 될 로직이 있어 찾아보니, 친절하게 윈도우에 관련 API가 있어 가져와봤습니다. type TForm1 = class(TForm) .. private procedure WindowPowerState(var AMsg: TMesage); message WM_POWERBROADCAST; .. public .. end; procedure TForm1.WindowPowerState(var AMsg: TMessage); begin case AMsg.WParam of //AC, DC등 전원방식이 변경 되었을 때 PBT_APMPOWERSTATUSCHANGE: begin end; //윈도우가 절전상태에서 돌아왔을 때 PBT_APMRESUMEAUTOMATIC: begin .. Delphi/간단하게 간단하게 Helper로 Enumerated Types 맘대로 변환하기 사용할 Enum Type을 만듭니다. type TMyType = (mtType1, mtType2, mtType3); TMyType의 Helper를 만들어줍니다. type TMyTypeHelper = record Helper for TMyType function ToIndex: Integer; inline; function ToName: string; end; implementation { TMyTypeHelper } function TMyTypeHelper.ToIndex: Integer; begin Result := Integer(Self); end; function TMyTypeHelper.ToName: string; const arrMyType: array[TMyType] of string = ('타.. 이전 1 2 3 4 5 ··· 13 다음