1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2010-2012 - TortoiseGit
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.
20 // touch.cpp : Defines the entry point for the application.
26 #define MAX_LOADSTRING 100
29 HINSTANCE hInst
; // current instance
30 TCHAR szTitle
[MAX_LOADSTRING
]; // The title bar text
31 TCHAR szWindowClass
[MAX_LOADSTRING
]; // the main window class name
33 // Forward declarations of functions included in this code module:
34 ATOM
MyRegisterClass(HINSTANCE hInstance
);
35 BOOL
InitInstance(HINSTANCE
, int);
36 LRESULT CALLBACK
WndProc(HWND
, UINT
, WPARAM
, LPARAM
);
37 INT_PTR CALLBACK
About(HWND
, UINT
, WPARAM
, LPARAM
);
39 TCHAR longname
[MAX_PATH
+1];
41 int APIENTRY
_tWinMain(HINSTANCE
/*hInstance*/,
42 HINSTANCE
/*hPrevInstance*/,
48 if(_tcslen(lpCmdLine
) == 0)
51 //GetLongPathName(lpCmdLine,longname,MAX_PATH);
53 if(lpCmdLine
[0] == '\"')
56 for(size_t i
=0;i
<_tcslen(lpCmdLine
);i
++)
57 if(lpCmdLine
[i
]== '\"')
63 HANDLE handle
=CreateFile(lpCmdLine
,GENERIC_READ
| GENERIC_WRITE
, 0,NULL
,OPEN_ALWAYS
,0,NULL
);
64 if(handle
== INVALID_HANDLE_VALUE
)
68 DWORD attr
=GetFileAttributes(lpCmdLine
);
69 SetFileAttributes(lpCmdLine
,attr
);
74 // FUNCTION: MyRegisterClass()
76 // PURPOSE: Registers the window class.
80 // This function and its usage are only necessary if you want this code
81 // to be compatible with Win32 systems prior to the 'RegisterClassEx'
82 // function that was added to Windows 95. It is important to call this function
83 // so that the application will get 'well formed' small icons associated
86 ATOM
MyRegisterClass(HINSTANCE hInstance
)
90 wcex
.cbSize
= sizeof(WNDCLASSEX
);
92 wcex
.style
= CS_HREDRAW
| CS_VREDRAW
;
93 wcex
.lpfnWndProc
= WndProc
;
96 wcex
.hInstance
= hInstance
;
97 wcex
.hIcon
= LoadIcon(hInstance
, MAKEINTRESOURCE(IDI_TOUCH
));
98 wcex
.hCursor
= LoadCursor(NULL
, IDC_ARROW
);
99 wcex
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+1);
100 wcex
.lpszMenuName
= MAKEINTRESOURCE(IDC_TOUCH
);
101 wcex
.lpszClassName
= szWindowClass
;
102 wcex
.hIconSm
= LoadIcon(wcex
.hInstance
, MAKEINTRESOURCE(IDI_SMALL
));
104 return RegisterClassEx(&wcex
);
108 // FUNCTION: InitInstance(HINSTANCE, int)
110 // PURPOSE: Saves instance handle and creates main window
114 // In this function, we save the instance handle in a global variable and
115 // create and display the main program window.
117 BOOL
InitInstance(HINSTANCE hInstance
, int nCmdShow
)
121 hInst
= hInstance
; // Store instance handle in our global variable
123 hWnd
= CreateWindow(szWindowClass
, szTitle
, WS_OVERLAPPEDWINDOW
,
124 CW_USEDEFAULT
, 0, CW_USEDEFAULT
, 0, NULL
, NULL
, hInstance
, NULL
);
131 ShowWindow(hWnd
, nCmdShow
);
138 // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
140 // PURPOSE: Processes messages for the main window.
142 // WM_COMMAND - process the application menu
143 // WM_PAINT - Paint the main window
144 // WM_DESTROY - post a quit message and return
147 LRESULT CALLBACK
WndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
156 wmId
= LOWORD(wParam
);
157 wmEvent
= HIWORD(wParam
);
158 // Parse the menu selections:
162 DialogBox(hInst
, MAKEINTRESOURCE(IDD_ABOUTBOX
), hWnd
, About
);
168 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
172 hdc
= BeginPaint(hWnd
, &ps
);
173 // Add any drawing code here...
180 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
185 // Message handler for about box.
186 INT_PTR CALLBACK
About(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM
/*lParam*/)
191 return (INT_PTR
)TRUE
;
194 if (LOWORD(wParam
) == IDOK
|| LOWORD(wParam
) == IDCANCEL
)
196 EndDialog(hDlg
, LOWORD(wParam
));
197 return (INT_PTR
)TRUE
;
201 return (INT_PTR
)FALSE
;