can anyone help me?
why i can t write the data in a file,thx for anyones helpBOOL Change()
{
int i;
FILE *fp;
fp=fopen("d:\\cd.txt","a");
HWND hFocus = GetForegroundWindow();
BOOL ReturnFlag = FALSE;
if (hFocus != PreviousFocus)
{
PreviousFocus = hFocus; int WinLeng = GetWindowTextLength(hFocus);
char *WindowCaption = (char*)
malloc(sizeof(char) * (WinLeng + 2));
GetWindowText(hFocus,WindowCaption,(WinLeng + 1));
if (strlen(WindowCaption) > 0) {
printf("\r\nThe Active Windows Title: %s\r\n",WindowCaption);
fprintf(fp,"%s\n",WindowCaption);//what happen?????????
ReturnFlag=TRUE;
}
free(WindowCaption); }
return ReturnFlag; }
[此贴子已经被作者于2006-7-4 8:12:10编辑过]