본문 바로가기

삽질인생61

[Delphi] InnoSetup : event 함수들 [Setup event functions] function InitializeSetup(): Boolean;Called during Setup's initialization. Return False to abort Setup, True otherwise.procedure InitializeWizard();Use this event function to make changes to the wizard or wizard pages at startup. You can't use theInitializeSetup event function for this since at the time it is triggered, the wizard form does not yet exist.procedure Deinitia.. 2013. 8. 7.
[Delphi] InnoSetup : 방화벽 추가 InnoSetup [Code] 부분에 이대로 추가하면 된다설치할때 추가하고 삭제할때 제거된다 검색해서 나오는 자료들은 죄다 예전 소스들이라 힘들었음 ㄱ- [Code] constNET_FW_SCOPE_ALL = 0;NET_FW_IP_VERSION_ANY = 2;NET_FW_ACTION_ALLOW = 1; procedure SetFirewallExceptionXP(AppName,FileName:string);var FirewallObject: Variant; FirewallManager: Variant; FirewallProfile: Variant;begin tryFirewallObject := CreateOleObject('HNetCfg.FwAuthorizedApplication');FirewallObje.. 2013. 8. 7.
[Delphi] InnoSetup : 설치/제거 할 때 프로그램 종료하기 InnoSetup [Code] 부분에 이렇게 넣으면 설치하거나 제거할 때 강제로 프로세스를 종료한다! [Code]constWM_CLOSE = $0010; // 프로그램 설치 시 function InitializeSetup: Boolean;varWnd: HWND;beginwhile(true) dobeginWnd := FindWindowByClassName('메인폼클래스명');if Wnd 0 thenbeginSendMessage(Wnd, WM_CLOSE, 0, 0);endelsebeginbreak;end;end; Result := True;end; // 프로그램 제거 시 function InitializeUninstall: Boolean;varWnd: HWND;beginwhile(true) dobeginWn.. 2013. 8. 7.
[Delphi] 윈도우 높은 권한에서 낮은 권한 메시지 받기 ChangeWindowMessageFilter 를 이용한다.이 소스 진짜 원 출처는 어딘지 모르겠지만 일단 적어놓기. type FCHANGEWINDOWMESSAGEFILTER = function(message: UINT; dwFlag: DWORD) : boolean; stdcall; procedure TForm.FormCreate(Sender: TObject);var h: HWND; MessageFilter: FCHANGEWINDOWMESSAGEFILTER;begin h := LoadLibrary('USER32.DLL'); if h 0 then begin try @MessageFilter := GetProcAddress(h, 'ChangeWindowMessageFilter'); if @MessageFil.. 2013. 8. 2.
[Delphi] 작업표시줄 시계부분 위치찾기 작업표시줄 위치에 상관없이시계부분에 팝업을 띄우기 위해서 var h: HWND; WorkRect: TRect; BarData: TAppBarData; begin h := FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'TrayNotifyWnd', nil); GetWindowRect(h, &WorkRect); BarData.HWND := 0; BarData.cbSize := sizeof(BarData); SHAppBarMessage(ABM_GETTASKBARPOS, BarData); case BarData.uEdge of 0: // ABE_LEFT begin self.Left := WorkRect.Right; self.Top := WorkRect.Bottom - .. 2013. 7. 30.
[Delphi] 작업표시줄 위치 찾기 uses shellapi; var pData: TAppBarData;begin pData.hWnd := 0; pData.cbSize := sizeof(pData); SHAppBarMessage(ABM_GETTASKBARPOS, pData); case pData.uEdge of 0: ShowMessage('ABE_LEFT'); 1: ShowMessage('ABE_TOP'); 2: ShowMessage('ABE_RIGHT'); 3: ShowMessage('ABE_BOTTOM'); end; end; 2013. 7. 22.
[Delphi] IdFTP 한글 인코딩 오류 기억력 나쁜 내가 또 까먹고 indy 업데이트 할까봐 급히 메모.. IdFTP.pas 수정하면 됨. 1) TIdFTP = class(TIdExplicitTLSClient)에 프로퍼티 하나 만들고 FUTFMode: boolean; property UTFMode : boolean read FUTFMode write FUTFMode; 2) 소스 수정 procedure TIdFTP.List(ADest: TStrings; const ASpecifier: string = ''; ADetails: Boolean = True); {do not localize}var LDest: TMemoryStream; LTrans : TIdFTPTransferType;begin if ADetails and UseMLIS and FC.. 2013. 4. 5.
[WP7] 윈도우폰 TextBlock New Line 추가 TextBlock Text="첫번째 문장 
 두번째 문장"/> 2012. 7. 27.
[WP7] 윈도우폰 설정 된 테마 색상 가져오기 - Background : Dark(Black), Light(White) 1) Color themeColor = (Color)Application.Current.Resources["PhoneBackgroundColor"]; if (themeColor.ToString() == "#FF000000") ; // "Dark"; else if (themeColor.ToString() == "#FFFFFFFF") ; // "Light"; 2) // 글자 색상이 흰색이라면 현재 테마는 Dark, 검은색이라면 Light Color themeColor = (Color)Application.Current.Resources[" PhoneForegroundColor "]; if (themeColor.ToString() == .. 2012. 4. 4.
[WP7] 문자와 문자 사이의 문자 가져오기 public static string GetMiddleString(string str, string begin, string end){ if (string.IsNullOrEmpty(str)) { return null; } string result = null; // 해당 글자부터 끝까지 찾는거면 if (end == "") { str = str.Substring(str.IndexOf(begin) + begin.Length); if (str.Length > -1) result = str.Substring(0, str.Length); else result = str; return result; .. 2012. 4. 4.
[WP7] Visual Studio 2010 자주쓰는 단축키 Ctrl + K + C : 주석처리Ctrl + K + U : 주석해제Ctrl + K + D : 자동정렬Ctrl + M + M : 코드블록 접기, 열기Ctrl + K + K : 북마크 기능, 해제Ctrl + K + N : 다음 북마크로 이동Ctrl + HOME : 문서 처음Ctrl + END : 문서 끝Ctrl + ] : 괄호의 짝 찾기Ctrl + L : 한 라인 잘라내기Ctrl + F3 : 현재 커서의 문자열 찾기 (forward)Ctrl + Shift + F3 : 현재 커서의 문자열 찾기 (backward) F9 : 현재 라인 Breakpoint 지정/해제 F12 : 선언부로 가기Alt + 마우스드래그 : 세로 영역 선택 2012. 4. 4.
[Delphi] StringGrid - Mouse move Cell hint procedure TFm_Test.AdvStringGridMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var ACol, ARow: Integer; begin AdvStringGrid.ShowHint := False; AdvStringGrid.MouseToCell(X, Y, ACol, ARow); if (ACol < 2) or (ARow < 1) then Exit; // fix and checkbox AdvStringGrid.ShowHint := True; AdvStringGrid.Hint := AdvStringGrid.Cells[ACol, ARow]; end; 2012. 1. 11.
[Delphi] 문자열의 너비 구하기 uses Graphics; Canvas.TextWidth(str); ex) if Canvas.TextWidth(Cells[5, J]) > 220 then RowHeights[J] := 16 * ((Canvas.TextWidth(Cells[5, J]) div 220) + 1); 2012. 1. 11.
[Delphi] Socket Error 10004 The operation is canceled. 10013 The requested address is a broadcast address, but flag is not set. 10014 Invalid argument. 10022 Socket not bound, invalid address or listen is not invoked prior to accept. 10024 No more file descriptors are available, accept queue is empty. 10035 Socket is non-blocking and the specified operation will block. 10036 A blocking Winsock operation is in progres.. 2011. 8. 31.
[Delphi] 델파이 예외 처리 클래스 EAbort 메시지 상자를 출력하지 않고 현재의 코드 블록을 취소할때 발생 EOutOfMemory 애플리케이션을 실행하기 위한 메모리 부족시 발생 EAccessViolation 메모리가 할당되지 않은 상황에서 연산을 하거나 메모리 할당 후 해제하지 않고 다시 할당할때 발생 EstackOverflow 현재의 스레드 수행이 더이상 메모리에 할당될 수 없을 경우 ElnOutError 파일 입출력시에 에러가 나는 경우 ElntError 정수 연산시 발생하는 에러 EDeivByZero 정수를 0으로 나누었을 때 발생 ERangeError 정수형의 범위를 벗어나는 값이 할당 됐을 경우 ElnvalidPointer 부적절한 포인터 연산이 수행됐을 경우 ElnvalidCast as연산자를 이용하여 부적절한 형변환이 발.. 2011. 8. 3.
[Delphi] 파일 확장자 알아내기 function GetExt(FileName: string): string; var TempArray: TStringList; begin Result := ''; TempArray := TStringList.Create; ExtractStrings(['.'], [' '], PChar(FileName), TempArray); if Pos('.', FileName) 0 then Result := TempArray.Strings[TempArray.Count - 1]; TempArray.Clear; TempArray.Free; end; 2011. 7. 22.
[Delphi] ListBox 내용을 클립보드에 복사하기 uses절에 Clipbrd; 추가하고 ClipBoard.SetTextBuf( PChar(복사 할 내용) ); ex) ClipBoard.SetTextBuf( PChar( Listbox.Items.Strings[Listbox.ItemIndex] ) ); ClipBoard.SetTextBuf( PChar( Listbox.Items.Text ) ); 2011. 7. 15.
[Delphi] 델파이에서 파일쓰기 var F: TextFile; FileName: string;begin FileName := '파일명'; try try AssignFile(F, FileName); // 파일이 없으면 파일을 생성 if FileExists(FileName) then Append(F) // 기존 내용에 추가하기 else Rewrite(F); // 기존 내용을 덮어쓰기 Writeln(F, '작성 할 내용'); except on E: Exception do ; end; finally CloseFile(F); end; end; 2011. 6. 15.
[Delphi] 최상위 윈도우가 전체화면인지 확인하기 function IsMaxWindow: boolean; var Hnd: HWND; Rect: TRect; begin Result := False; Hnd := GetForegroundWindow(); // 현재 작업중인 윈도우를 알아내는 함수 GetWindowRect(Hnd, Rect); if (Rect.Left Rect.Top) then exit; if (Rect.Right = Screen.Width) and (Rect.Bottom = Screen.Height) then Result := True; // 전체화면 end; 2011. 5. 16.
[Delphi] 폼 드래그해서 이동하기 MouseDown 이벤트에서 ReleaseCapture; SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); 2011. 5. 16.