请问需要引用什么单元,才能够识别PITEMIDLIST,BROWSEINFO...?

cokegirl 2002-01-22 01:09:36
请教高手,我copy了一段程序,其中用到了
PITEMIDLIST
BROWSEINFO
SHGetSpecialFolderLocation
CSIDL_NETWORK
TBrowseInfo
这些东东导致我的程序无法编译,总是提示Undeclared indentifier:"xxx"。
这是怎么回事?
...全文
252 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
王集鹄 2002-01-22
  • 打赏
  • 举报
回复
当不知道标识是什么单元声明的时候
最有效的方法是
用Win系统的 "查找文件"

名称="*.pas"
包含文字="<未知标识>"
搜索="C:\Program Files\Borland\Delphi6"

除非是在dcu中
试试,很管用
王集鹄 2002-01-22
  • 打赏
  • 举报
回复
uses
ShellApi, ShlObj;
MFC打开文件和文件夹 一、利用API实现打开文件对话框和利用MFC来实现打开文件对话框。 方法一:API部分: // OPENFILENAME ofn; // TCHAR szFile[MAX_PATH]; // ZeroMemory(&ofn,sizeof(ofn)); // ofn.lStructSize = sizeof(ofn); // ofn.lpstrFile = szFile; // ofn.lpstrFile[0] = TEXT('/0'); // ofn.nMaxFile = sizeof(szFile); // ofn.lpstrFilter = TEXT("all/0*.*/0jpg/0*.jpg/0bmp/0*.bmp/0"); //定义三个选项,all,text和exe // ofn.nFilterIndex = 1; //定义首选项是哪一个 // ofn.lpstrFileTitle = NULL; // ofn.nMaxFileTitle = 0; // ofn.lpstrInitialDir = NULL; // ofn.Flags = OFN_EXPLORER |OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; // if(GetOpenFileName(&ofn)) // { // ::SetDlgItemText(this->m_hWnd,IDC_EDIT1,szFile); // } 方法二、MFC实现 // CFileDialog dlg(TRUE, NULL, NULL, // OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, // NULL); // // if(dlg.DoModal() == IDOK) // { // szFilename = dlg.GetPathName(); // ::MessageBox(NULL,szFilename,NULL,MB_OK); // } 注意:打开文件的方式和打开文件夹的方式是不同的。打开文件的方式是不断的打开直到出现末端为文件,否则遇到文件夹还要继续打开。而打开文件夹则是只要选择到一个路径的文件夹就打开。 下面的这种方式是打开文件夹:MFC实现。 static TCHAR strDirName[MAX_PATH]; BROWSEINFO bi; CString szString = TEXT("选择一个源文件子文件夹"); bi.hwndOwner = ::GetFocus(); bi.pidlRoot = NULL; bi.pszDisplayName = strDirName; bi.lpszTitle = szString; bi.ulFlags = BIF_BROWSEFORCOMPUTER | BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS; bi.lpfn = NULL; bi.lParam = 0; bi.iImage = 0; LPITEMIDLIST pItemIDList = ::SHBrowseForFolder(&bi); if(pItemIDList == NULL) { return ; } ::SHGetPathFromIDList(pItemIDList, strDirName); CString str = strDirName; if(str != "" && str.Right(1) != '//') str += '//'; ::SetDlgItemText(this->m_hWnd,IDC_EDIT1,str);
unit uMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, RzEdit, RzButton, ExtCtrls, IniFiles, RzTabs, ComCtrls, RzListVw, RzShellCtrls, ImgList, RzShellDialogs, RzCmboBx, QRCtrls, QuickRpt, jpeg, ShlObj, RzPanel, RzSplit, RzTreeVw, DB, ADODB, Provider, DBClient, GridsEh, DBGridEh, RzStatus; type PShellItem = ^TShellItem; TShellItem = record FullID, ID: PItemIDList; Empty: Boolean; DisplayName, TypeName: string; ImageIndex, Size, Attributes: Integer; ModDate: string; end; TfrmMain = class(TForm) RzPageControl1: TRzPageControl; TabSheet1: TRzTabSheet; TabSheet2: TRzTabSheet; lbl1: TLabel; edt_Path1: TRzEdit; btn_o2: TButton; Button1: TButton; SplPreview: TRzSplitter; img1: TImage; RzToolbar1: TRzToolbar; RzSpacer1: TRzSpacer; ClientDS_PicCap: TClientDataSet; DataSP_PicCap: TDataSetProvider; Qry_PicCap: TADOQuery; Ds_PicCap: TDataSource; DBGridEh1: TDBGridEh; ClientDataSetH: TClientDataSet; DataSetProviderH: TDataSetProvider; QueryH: TADOQuery; DataSourceH: TDataSource; RzBtn_0: TRzBitBtn; RzBtn_1: TRzBitBtn; ImageList1: TImageList; Memo1: TMemo; ClientDS_PicCapacc_id_only: TStringField; ClientDS_PicCapname: TStringField; ClientDS_PicCapplate_num: TStringField; ClientDS_PicCapplate_type: TStringField; ClientDS_PicCapInsDate: TDateTimeField; ClientDS_PicCapAcc_ID_Only_1: TStringField; ClientDS_PicCapfDateTime: TDateTimeField; ClientDS_PicCapPicturePath1: TStringField; ClientDS_PicCapPicturePath2: TStringField; ClientDS_PicCapPicturePath3: TStringField; ClientDS_PicCapPicturePath4: TStringField; ClientDS_PicCapPicturePath5: TStringField; ClientDS_PicCapPicturePath6: TStringField; ClientDS_PicCapPicturePath7: TStringField; ClientDS_PicCapPrintCount: TIntegerField; ClientDataSetHAutoID: TAu

829

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧