1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2010-2011 - 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
,
46 UNREFERENCED_PARAMETER(hPrevInstance
);
50 if(_tcslen(lpCmdLine
) == 0)
53 //GetLongPathName(lpCmdLine,longname,MAX_PATH);
55 if(lpCmdLine
[0] == '\"')
58 for(size_t i
=0;i
<_tcslen(lpCmdLine
);i
++)
59 if(lpCmdLine
[i
]== '\"')
65 HANDLE handle
=CreateFile(lpCmdLine
,GENERIC_READ
| GENERIC_WRITE
, 0,NULL
,OPEN_ALWAYS
,0,NULL
);
66 if(handle
== INVALID_HANDLE_VALUE
)
70 DWORD attr
=GetFileAttributes(lpCmdLine
);
71 SetFileAttributes(lpCmdLine
,attr
);
76 // FUNCTION: MyRegisterClass()
78 // PURPOSE: Registers the window class.
82 // This function and its usage are only necessary if you want this code
83 // to be compatible with Win32 systems prior to the 'RegisterClassEx'
84 // function that was added to Windows 95. It is important to call this function
85 // so that the application will get 'well formed' small icons associated
88 ATOM
MyRegisterClass(HINSTANCE hInstance
)
92 wcex
.cbSize
= sizeof(WNDCLASSEX
);
94 wcex
.style
= CS_HREDRAW
| CS_VREDRAW
;
95 wcex
.lpfnWndProc
= WndProc
;
98 wcex
.hInstance
= hInstance
;
99 wcex
.hIcon
= LoadIcon(hInstance
, MAKEINTRESOURCE(IDI_TOUCH
));
100 wcex
.hCursor
= LoadCursor(NULL
, IDC_ARROW
);
101 wcex
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+1);
102 wcex
.lpszMenuName
= MAKEINTRESOURCE(IDC_TOUCH
);
103 wcex
.lpszClassName
= szWindowClass
;
104 wcex
.hIconSm
= LoadIcon(wcex
.hInstance
, MAKEINTRESOURCE(IDI_SMALL
));
106 return RegisterClassEx(&wcex
);
110 // FUNCTION: InitInstance(HINSTANCE, int)
112 // PURPOSE: Saves instance handle and creates main window
116 // In this function, we save the instance handle in a global variable and
117 // create and display the main program window.
119 BOOL
InitInstance(HINSTANCE hInstance
, int nCmdShow
)
123 hInst
= hInstance
; // Store instance handle in our global variable
125 hWnd
= CreateWindow(szWindowClass
, szTitle
, WS_OVERLAPPEDWINDOW
,
126 CW_USEDEFAULT
, 0, CW_USEDEFAULT
, 0, NULL
, NULL
, hInstance
, NULL
);
133 ShowWindow(hWnd
, nCmdShow
);
140 // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
142 // PURPOSE: Processes messages for the main window.
144 // WM_COMMAND - process the application menu
145 // WM_PAINT - Paint the main window
146 // WM_DESTROY - post a quit message and return
149 LRESULT CALLBACK
WndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
158 wmId
= LOWORD(wParam
);
159 wmEvent
= HIWORD(wParam
);
160 // Parse the menu selections:
164 DialogBox(hInst
, MAKEINTRESOURCE(IDD_ABOUTBOX
), hWnd
, About
);
170 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
174 hdc
= BeginPaint(hWnd
, &ps
);
175 // Add any drawing code here...
182 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
187 // Message handler for about box.
188 INT_PTR CALLBACK
About(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
190 UNREFERENCED_PARAMETER(lParam
);
194 return (INT_PTR
)TRUE
;
197 if (LOWORD(wParam
) == IDOK
|| LOWORD(wParam
) == IDCANCEL
)
199 EndDialog(hDlg
, LOWORD(wParam
));
200 return (INT_PTR
)TRUE
;
204 return (INT_PTR
)FALSE
;