此代码应该编译没有错误,您应该-lcomdlg32
为对话框链接。程序返回:0x22fcd8
或者68
如果我使用指针。并且应该(我认为)在对话框中返回文件用户类型的名称。
#include <windows.h>
#include <iostream>
int main() {
wchar_t szFileName[MAX_PATH] = {0};
OPENFILENAMEW ofn;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFile = szFileName;
GetSaveFileNameW(&ofn);
using namespace std;
cout << szFileName << endl;
cout << *szFileName << endl; // also a number not a string
}