现在卡在这里了,不知道是缺少头文件还是不能在CEGUI里面用这俩函数。
请高手指点一下
3 个解决方案
#1
http://topameng.spaces.live.com/blog/cns!F962D4854A8233D!192.entry
#2
#include <Windows.h>
#include <stdio.h>
#pragma comment(lib,"Comdlg32.lib")
#pragma comment(lib,"user32")
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HANDLE hf; // file handle
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
// Display the Open dialog box.
if (GetOpenFileName(&ofn)==TRUE)
{
MessageBox(NULL,ofn.lpstrFile,"你选择的文件",MB_OK);
}
}
#3
一万个感谢!心中的巨石落下了!!
#1
http://topameng.spaces.live.com/blog/cns!F962D4854A8233D!192.entry
#2
#include <Windows.h>
#include <stdio.h>
#pragma comment(lib,"Comdlg32.lib")
#pragma comment(lib,"user32")
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HANDLE hf; // file handle
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
//
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
//
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
// Display the Open dialog box.
if (GetOpenFileName(&ofn)==TRUE)
{
MessageBox(NULL,ofn.lpstrFile,"你选择的文件",MB_OK);
}
}
#3
一万个感谢!心中的巨石落下了!!