質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -147,3 +147,95 @@
|
|
147
147
|
|
148
148
|
|
149
149
|
```
|
150
|
+
|
151
|
+
#追記1
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
#include <windows.h>
|
156
|
+
|
157
|
+
#include <tchar.h>
|
158
|
+
|
159
|
+
#define aFILE _T("a.txt")
|
160
|
+
|
161
|
+
static TCHAR msgbuf[257];
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
166
|
+
|
167
|
+
PSTR lpCmdLine, int nCmdShow) {
|
168
|
+
|
169
|
+
HANDLE hFile;
|
170
|
+
|
171
|
+
HANDLE findHandle;
|
172
|
+
|
173
|
+
TCHAR Path[260];
|
174
|
+
|
175
|
+
TCHAR Path2[260];
|
176
|
+
|
177
|
+
WIN32_FIND_DATA findData;
|
178
|
+
|
179
|
+
TCHAR *File;
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
GetCurrentDirectory(sizeof Path, (LPTSTR)Path);
|
184
|
+
|
185
|
+
_stprintf_s(Path2, lstrlen(Path2) + 30, _T("\%s\%s"), Path, aFILE);
|
186
|
+
|
187
|
+
MessageBox(NULL, Path2, NULL, MB_OK);
|
188
|
+
|
189
|
+
findHandle = FindFirstFile(Path2, &findData);
|
190
|
+
|
191
|
+
if (findHandle == INVALID_HANDLE_VALUE) {
|
192
|
+
|
193
|
+
MessageBox(NULL, Path2, NULL, MB_OK);
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
if (!SearchPath(NULL, aFILE, NULL, sizeof(Path), Path, &File)) {
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
_stprintf_s(msgbuf,lstrlen(msgbuf)+30 ,_T("%s was not found."), aFILE);
|
202
|
+
|
203
|
+
MessageBox(NULL, msgbuf, NULL, MB_OK);
|
204
|
+
|
205
|
+
/*return Abort(hWnd, msgbuf);*/
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
else
|
210
|
+
|
211
|
+
{
|
212
|
+
|
213
|
+
MessageBox(NULL, _T("error"), NULL, MB_OK);
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
else
|
224
|
+
|
225
|
+
{
|
226
|
+
|
227
|
+
FindClose(findHandle);
|
228
|
+
|
229
|
+
MessageBox(NULL, _T("success"), NULL, MB_OK);
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
return 0;
|
240
|
+
|
241
|
+
}
|