回调函数依然失败,就没人能解决吗?uses shlobj;function  BrowseCallbackProc(hwnd:HWND;uMsg:UINT;lp:LPARAM;pData:LPARAM ):longint stdcall;function MySHDPath5(mindex:longint):string;
var
  BrowseInfo: TBrowseInfo;
  DisplayName: array[0..MAX_PATH] of char;
  idBrowse,idl : PItemIDList;
  tmp : PChar;
  i:longint;
begin
Result:='';
try
Getmem(tmp, 255);
i:=sizeof(longint);
SHGetSpecialFolderLocation(application.Handle,mindex, idl);
  with BrowseInfo do
  begin
    hWndOwner:=application.Handle;
    pidlRoot:=idl;
    pszDisplayName:=DisplayName;
    lpszTitle:='目录选择';
    ulFlags:=BIF_STATUSTEXT+80;
lpfn:=@BrowseCallbackProc;lParam:=0;
  end;
  idBrowse:=SHBrowseForFolder(BrowseInfo);
  if assigned(idBrowse) then
  Begin
     SHGetPathFromIDList(idBrowse,tmp);
     Result :=strpas(tmp);
  end;
 finally
  Freemem(tmp);
 end;
end;
function  BrowseCallbackProc(hwnd:HWND;uMsg:UINT;lp:LPARAM;pData:LPARAM ):longint;
begin
   case uMsg of
     BFFM_INITIALIZED:
       begin//1
       SendMessage(hwnd,BFFM_SETSELECTION,lp,LPARAM(shroot));///shroot为全局变量
       end;//1
   end;
   Result:=0;//这里运行时错误了看下面图片//http://www.bwkj.net/ddiscussion/huidiaocuowu2.jpgend;