博文

排序CStringArray类[网络资料收集](2007-01-07 22:42:00)

摘要:举例:    CSortStringArray sortArray;    sortArray.Add(CString("Zebra\r\n"));   sortArray.Add(CString("Bat\r\n"));   sortArray.Add(CString("Apple\r\n"));   sortArray.Add(CString("Mango\r\n"));    sortArray.Sort(); /*************************************************************************/ // CSortStringArray.cpp: implementation of the CSortStringArray class.////////////////////////////////////////////////////////////////////////#include "stdafx.h"#include "CSortStringArray.h" void CSortStringArray::Sort(){   BOOL bNotDone = TRUE;    while (bNotDone)   {      bNotDone = FALSE;      for(int pos = 0;pos < GetUpperBound();pos++)         bNotDone |= CompareAndSwap(pos);   }   return;} BOOL CSortStringArray::CompareAndSwap(int pos){   CString temp;   int posFirst ......

阅读全文(3510) | 评论:0

打开目录对话框类[网络资料收集](2007-01-07 20:19:00)

摘要:举例: CFoldersDialog cFolderDlg; cFolderDlg.BrowseFolder(m_hWnd,&m_strDirPath,_T("请选择文件夹"));浏览文件夹的对话框会显示“请选择文件夹”提示字符,确定之后的文件夹路径会返回到m_strDirPath中,取消后不返回。 // FoldersDialog.cpp: implementation of the CFoldersDialog class.////////////////////////////////////////////////////////////////////////#include "stdafx.h"#include "FoldersDialog.h" //////////////////////////////////////////////////////////////////////// Construction/Destruction////////////////////////////////////////////////////////////////////// CFoldersDialog::CFoldersDialog(){ } CFoldersDialog::~CFoldersDialog(){ }   int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) { switch(uMsg)  {   case BFFM_INITIALIZED:    ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);     break;   default:     break; }  return 0;} int CFoldersDialog::BrowseFolder(HWND hWnd, CString* pBrowsePath, LPS......

阅读全文(2996) | 评论:0