Use angle brackets for system headers
[TortoiseGit.git] / src / TortoiseGitSetup / CustomActions / CustomActions.cpp
blob71b95b85ece372e92b43caf4c22fcc4ee1d2c3d4
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 /* BIG FAT WARNING: Do not use any functions which require the C-Runtime library
22 in this custom action dll! The runtimes might not be installed yet!
25 #include "stdafx.h"
26 #include <shlwapi.h>
27 #include <shellapi.h>
28 #pragma comment(lib, "shlwapi")
29 #pragma comment(lib, "shell32")
31 #define TGIT_CACHE_WINDOW_NAME _T("TGitCacheWindow")
33 BOOL APIENTRY DllMain( HANDLE hModule,
34 DWORD ul_reason_for_call,
35 LPVOID lpReserved
38 return TRUE;
41 UINT __stdcall TerminateCache(MSIHANDLE hModule)
43 HWND hWnd = FindWindow(TGIT_CACHE_WINDOW_NAME, TGIT_CACHE_WINDOW_NAME);
44 if (hWnd)
46 PostMessage(hWnd, WM_CLOSE, NULL, NULL);
47 for (int i=0; i<10; ++i)
49 Sleep(500);
50 if (!IsWindow(hWnd))
52 // Cache is gone!
53 return ERROR_SUCCESS;
56 // Don't return ERROR_FUNCTION_FAILED, because even if the cache is still
57 // running, the installer will overwrite the file, and we require a
58 // reboot anyway after upgrading.
59 return ERROR_SUCCESS;
61 // cache wasn't even running
62 return ERROR_SUCCESS;
65 UINT __stdcall OpenDonatePage(MSIHANDLE hModule)
67 ShellExecute(NULL, _T("open"), _T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=GJGTG75GV5PL6&lc=C2&item_name=Donate%20To%20The%20TortoiseGit%20Project&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"), NULL,NULL, SW_SHOW);
68 return ERROR_SUCCESS;
71 UINT __stdcall MsgBox(MSIHANDLE hModule)
73 MessageBox(NULL, _T("CustomAction \"MsgBox\" running"), _T("Installer"), MB_ICONINFORMATION);
74 return ERROR_SUCCESS;