{******************************************************************} { EyDSL.dpr } { } { Author : A.Nasir Senturk } { Home Page : http://www.shenturk.com } { Email : shenturk@gmail.com } { } { Date : 21.01.2007 } { } { Sizden iki şey rica edicem: } { 1. Lutfen bu baslik kismini kaldirmayiniz. } { 2. Mumkunse bagis yapininiz. } { *****************************************************************} program EyDSL; uses Windows, Forms, SysUtils, Main in 'Main.pas' {EyMainForm}, AboutDlg in 'AboutDlg.pas' {AboutForm}, ModiLess in 'ModiLess.pas' {ModiLessForm}, OptnsDlg in 'OptnsDlg.pas' {OptionsForm}, PswdDlg in 'PswdDlg.pas' {PasswordForm}, TraffDlg in 'TraffDlg.pas' {TrafficForm}, NtfyDlg in 'NtfyDlg.pas' {NotifierForm}, DtlsDlg in 'DtlsDlg.pas' {DetailsForm}, HbrntDlg in 'HbrntDlg.pas' {HibernateForm}, EyWizard in 'EyWizard.pas' {WizardForm}, ConstDef in 'ConstDef.pas'; {$R *.res} {.$R Cipher.res} var g_hMutex: THANDLE; g_hWndFound: HWND = INVALID_HANDLE_VALUE; g_szClassName: string = 'TEyMainForm'; function EnumFindProc(hWnd: THANDLE; lpszModule: PChar): BOOL stdcall; var strClass, strModule: array[0..MAX_PATH] of Char; hInstance: HINST; begin Result := True; FillChar( strClass, SizeOf(strClass), 0 ); GetClassName( hWnd, strClass, MAX_PATH ); if lstrcmp( strClass, PChar(g_szClassName) ) = 0 then begin FillChar( strModule, SizeOf(strModule), 0 ); hInstance := GetWindowLong( hWnd, GWL_HINSTANCE ); GetModuleFileName( hInstance, strModule, MAX_PATH ); if lstrcmp( strModule, lpszModule ) = 0 then begin g_hWndFound := hWnd; Result := False; end; end; end; function CheckPrevInstance: BOOL; var strModule: array[0..MAX_PATH] of Char; dwLastError: DWORD; begin g_hMutex := CreateMutex( nil, False, 'EyDSL10_globalUniqueMutexHandle' ); dwLastError := GetLastError; FillChar( strModule, SizeOf(strModule), 0 ); GetModuleFileName( MainInstance, strModule, MAX_PATH ); OemToAnsi( strModule, strModule ); EnumWindows( @EnumFindProc, Integer(@strModule) ); Result := ( dwLastError = ERROR_ALREADY_EXISTS ) and ( g_hWndFound <> INVALID_HANDLE_VALUE ); FileSetReadOnly(strModule, False); end; begin if not CheckWin32Version(5, 1) then // 5.1 = WindowsXP begin MessageBox(0, 'Üzgünüm! Bu program ancak Windows XP veya üzeri işletim ' + 'sistemlerinde çalışabilmektedir.', 'Hata', MB_OK or MB_ICONERROR); Exit; end; g_szClassName := TEyMainForm.ClassName; if not CheckPrevInstance() then begin Application.Initialize; SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW); Application.Title := 'Ey DSL! - Kota Ajanı'; Application.CreateForm(TEyMainForm, EyMainForm); Application.Run; end else begin PostMessage( g_hWndFound, CM_RESTORE, 0, 0 ); SetForeGroundWindow( g_hWndFound ); end; WaitForSingleObject( g_hMutex, 0 ); if g_hMutex <> 0 then CloseHandle( g_hMutex ); end.