23 lines
469 B
C
23 lines
469 B
C
#include <windows.h>
|
|
#include <commdlg.h>
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
char file[MAX_PATH] = {0};
|
|
|
|
OPENFILENAME ofn = {
|
|
.lStructSize = sizeof(ofn),
|
|
.lpstrFilter = "All Files\0*.*\0",
|
|
.lpstrFile = file,
|
|
.nMaxFile = MAX_PATH,
|
|
.lpstrTitle = "Select File",
|
|
.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST
|
|
};
|
|
|
|
int res = GetOpenFileName(&ofn);
|
|
|
|
if (res) printf("%s\n", file);
|
|
|
|
return res != 0;
|
|
}
|