此脚本在2000下运行ok,在XP下编辑就出错了,请指教!
void DKGY(char * text1)
{
#pragma code ("comdlg32.dll")
#include "commdlg.h"
#pragma code()
BOOL bRet;
OPENFILENAME ofn;
char szFilter[] = "DL files*.dlAll DL Files*.dl";
char* psz;
char szFile[_MAX_PATH+1];
char szInitialDir[_MAX_PATH+1] = "C:\\";
char Gname[_MAX_PATH+10]="";
char Gname2[_MAX_PATH+10]="";
int mm,nn,j;
char * psz2;
char Gname3[_MAX_PATH+10]="";
BOOL GetProjectPath(char * lpstrProjectPath);
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = FindWindow(NULL,text1);
for (psz = szFilter; *psz; psz++)
{
if (*psz == '')
{
*psz = 0;
}
}
ofn.lpstrFilter = szFilter;
ofn.lpstrFile = szFile;
ofn.nMaxFile = _MAX_PATH+1;
GetProjectPath(szInitialDir); //if function fails initial//directory is "C:\\"
ofn.lpstrInitialDir = szInitialDir;
bRet = GetOpenFileName(&ofn);
{
FILE* pFile = NULL;
char szFile1[_MAX_PATH+10];
int i;
strcpy(szFile1,ofn.lpstrFile);
strcpy(Gname,szFile1);
strcpy(Gname2,"");
if ((psz2=strrchr(Gname,'.'))!=NULL)
{
* psz2=0;
nn=strlen(Gname);
SetTagSDWord("strlen",nn);
}
if ((psz2=strrchr(Gname,'\\'))!=NULL)
{
mm=psz2-Gname+1;
}
for (j=mm;j<=nn+1;j++)
{
Gname2[j-mm]=* (Gname+j);
}
SetTagChar("gyName",Gname2);
SetTagChar("ProPath",szFile1);
}