Exemplo n.º 1
0
long GetLinestoFit( HWND hDlg, short win )
{
	long bh,h,t;
	RECT	rc;
	long numlines;
	HWND	hctrl = GetDlgItem(hDlg, IDC_FILEVIEW);

	AddToListView( hctrl, 0, "x" );
	ListView_GetItemRect( hctrl, 0, &rc, LVIR_BOUNDS );
	ListView_DeleteItem( hctrl, 0 );

	t = ListView_GetItemCount(hctrl);
	bh = rc.bottom - rc.top;

	GetControlRect( hDlg, hctrl, &rc );
	h = rc.bottom - rc.top;

	numlines = (h/bh)-1;
	if ( numlines != winStats[win].linesInWin )
	{
		// Changed the size of the window (vertically)
		winStats[win].resetScroll = 1;
		winStats[win].linesInWin = numlines;
	}

	return numlines;
}
Exemplo n.º 2
0
void AddLinetoFileView( HWND hDlg , char *text, int deletefirst )
{
	if ( strlen( text ) > 0 ){
		//ListDelString( IDC_VIEWLINES, 0 );
		//ListAddString( IDC_VIEWLINES, text );
		HWND hlst = GetDlgItem(hDlg, IDC_FILEVIEW);
		if ( deletefirst )
			ListView_DeleteItem( hlst, 1 );
		AddToListView( hlst, ListView_GetItemCount(hlst), text );
	}
}
Exemplo n.º 3
0
UINT CPage6::AddDirectoryNodes(HTREEITEM hItem, CString &strPathName)
{
	WCHAR wBuf[60];
	DWORD    bytesReturned=0;
	ULONG   num=0;
	PDIRECTORY_INFO   temp={0};
	DIRECTORY_INFO_EX  DIRECTORY_INFO_b;
	CString str,str1,strFileSpec = strPathName;
	if (strFileSpec.Right (1) != "\\")
		strFileSpec += "\\";
	char  a[MAX_PATH];
	
	str1=strFileSpec;
	CMySystem::WCHARToChar(a,strFileSpec.GetBuffer(strFileSpec.GetLength()));

	strFileSpec += "*.*";
	DeviceIoControl(hDevice,(DWORD)IOCTL_MT_GETDIRNUMINF,a,sizeof(a),&num,sizeof(ULONG),&bytesReturned,NULL);
	if(num==0)
	{
		AfxMessageBox(L"驱动未加载,列举出错!");
		return 0;
	}
	temp=(PDIRECTORY_INFO)calloc(num,sizeof(DIRECTORY_INFO));
	if(temp==NULL)
	{

		return 0;
	}
	DeviceIoControl(hDevice,(DWORD)IOCTL_MT_GETDIRINF,a,sizeof(a),temp,num*sizeof(DIRECTORY_INFO),&bytesReturned,NULL);	
	CWaitCursor wait;
	WCHAR wTemp[MAX_PATH]={'\0'};
	m_FileList.DeleteAllItems();
   	index=0;
	SetPath(str1,hDevice);
	for(ULONG i=0;i<num;i++)
	{
		TRACE("AddDirectoryNode:%d\n",i);
		CMySystem::CharToWCHAR(wTemp,temp[i].FileName);
		str.Format(L"%s",wTemp);
		str=str1+str;
		CString strFileName = (LPCTSTR) &temp[i].FileName;
		if(PathIsDirectory(str))
		{
			if(strcmp(temp[i].FileName,"."))
			{
				if(strcmp(temp[i].FileName,".."))
				{
					CMySystem::CharToWCHAR(wTemp,temp[i].FileName);
					HTREEITEM hChild =
						m_FileTree.InsertItem ((LPCTSTR) wTemp,//&fd.cFileName,
						ILI_CLSDFLD , ILI_OPENFLD , hItem , TVI_SORT);

					CString strNewPathName = strPathName;
					if (strNewPathName.Right (1) != "\\")
					{strNewPathName += "\\";}
					CMySystem::CharToWCHAR(wBuf,temp[i].FileName);

					strNewPathName += wBuf;//fd.cFileName;
					SetButtonState (hChild, strNewPathName);	
					
				}

			}
		}
		else
		{
			DIRECTORY_INFO_b.DirectoryInfo=temp[i];
			DIRECTORY_INFO_b.path=str1;
		
			AddToListView(&DIRECTORY_INFO_b);	
		}
	} 
	delete temp;
	return num;
}