Does any one in 2017 knows how to implement calling HtmlHelp function that will open .chm file with "Search" pane and query string in it's listbox and will be able to execute this query?
I try following:
HH_FTS_QUERY query;
query.cbStruct = sizeof(HH_FTS_QUERY);
query.fUniCodeStrings = TRUE;
query.pszSearchQuery = szSearchStr;
query.iProximity = HH_FTS_DEFAULT_PROXIMITY;
query.fStemmedSearch = TRUE;
query.fTitleOnly = TRUE;
query.fExecute = TRUE;
query.pszWindow = NULL;
HWND hHelpWnd = ::HtmlHelp(m_hWnd, szFile, HH_DISPLAY_SEARCH, (DWORD_PTR)&query);
but the query in query.pszSearchQuery won't be executed. I have opened .chm file with query.pszSearchQuery in "Search" pane's listbox on my screen, but I have to click "List Topics" myself to show results of search.
With the help of HTMLHelp API - VBA, VB6 and VB2003, i will try to reply.
I believe there no API function to list topics in vc++. You have send button click event to launched help window.
LRESULT OnSearch(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
TCHAR szBuf[128];
GetDlgItem(IDC_EDIT1).GetWindowText(szBuf, sizeof(szBuf));
if (!_tcslen(szBuf))
return 0;
//
// First, invoke HtmlHelp with HH_DISPLAY_SEARCH.
// It doesn't execute search, but it's need for showing 'search' tab.
//
HH_FTS_QUERY fq;
ZeroMemory(&fq, sizeof(fq));
fq.cbStruct = sizeof(fq);
fq.fUniCodeStrings = FALSE;
fq.pszSearchQuery = (LPCTSTR)szBuf;
fq.iProximity = HH_FTS_DEFAULT_PROXIMITY;
fq.fStemmedSearch = FALSE;
fq.fTitleOnly = FALSE;
fq.fExecute = FALSE;
fq.pszWindow = NULL;
HWND hwndHelp = ::HtmlHelp(NULL, _T("realplay.chm"), HH_DISPLAY_SEARCH, (DWORD)&fq);
//
// Find query combobox and set query text.
//
HWND hPaneWnd, hPaneLast, hTabWnd, hDlgWnd, hCtlWnd;
hPaneWnd = FindWindowEx(hwndHelp, NULL, _T("HH Child"), NULL);
for (;;) // last HH Child
{
hPaneLast = FindWindowEx(hwndHelp, hPaneWnd, _T("HH Child"), NULL); // last HH Child
if (!hPaneLast)
break;
hPaneWnd = hPaneLast;
}
ATLTRACE("hPaneWnd == %x", hPaneWnd);
hCtlWnd = FindWindowEx(hPaneWnd, NULL, _T("Button"), NULL); // skip Tab Control
//
// There are two types of interfaces:
//
// 1.
// Window hierarchy:
// + Main window
// + HH Child
// + Browser ...
// + HH Child <- second "HH Child" window
// - Edit <- we have to fill this edit
// - Buttons <- and press this buttons
// ...
if (hCtlWnd)
{
hCtlWnd = FindWindowEx(hPaneWnd, NULL, _T("Edit"), NULL); // skip Tab Control
// Set window text
ATLASSERT(hCtlWnd != NULL);
::SendMessage(hCtlWnd, WM_SETTEXT, 0, (LPARAM)szBuf); // fill it by our query
::SendMessage(hwndHelp, WM_COMMAND, 0xbc7, 0); // 0x3ee -- 'List Topics' button, it runs search
if (::SendMessage(GetDlgItem(IDC_CHECK1), BM_GETCHECK, 0, 0) == BST_CHECKED)
::SendMessage(hwndHelp, WM_COMMAND, 0xbbe, 0); // 0x3f1 -- 'Display' button, it shows first item
}
//2.
// Window hierarchy:
// + Main window
// + HH Child
// + Browser ...
// + HH Child <- second "HH Child" window
// + Tab Control
// + Dialog
// - Combobox <- we have to fill this combo
// - Buttons <- and press this buttons
// ...
else
{
hTabWnd = FindWindowEx(hPaneWnd, NULL, _T("SysTabControl32"), NULL); // skip Tab Control
hDlgWnd = FindWindowEx(hTabWnd, NULL, NULL, NULL); // skip dialog
TCHAR szClass[64];
GetClassName(hDlgWnd, szClass, sizeof(szClass));
ATLTRACE("hDlgWnd(1) == %x", hDlgWnd);
if (!_tcsstr(szClass, "#")) // Is it dialog?
hDlgWnd = FindWindowEx(hTabWnd, hDlgWnd, NULL, NULL); // skip dialog
hCtlWnd = FindWindowEx(hDlgWnd, NULL, _T("ComboBox"), NULL); // well, it's combobox
// Set window text
ATLASSERT(hCtlWnd != NULL);
::SendMessage(hCtlWnd, WM_SETTEXT, 0, (LPARAM)szBuf); // fill it by our query
//
// Run search and show first finded page
//
::SendMessage(hwndHelp, WM_COMMAND, 0x3ee, 0); // 0x3ee -- 'List Topics' button, it runs search
if (::SendMessage(GetDlgItem(IDC_CHECK1), BM_GETCHECK, 0, 0) == BST_CHECKED)
::SendMessage(hwndHelp, WM_COMMAND, 0x3f1, 0); // 0x3f1 -- 'Display' button, it shows first item
}
return 0;
}
EDIT:
You can get control ID of List Topic by spy++
Related
I'm 'casting' the screen of window1 to window2 using the WINAPI DwmRegisterThumbnail
but as soon I set the window2 child of another window the image disappears.
After reading the docs I found this mention:
Setting the destination window handle to anything other than a
top-level window type will result in a return value of E_INVALIDARG.
HWND dest = (HWND)this->winId();
HWND source = ...
hr = DwmRegisterThumbnail(dest, source, &thumbnail_id);
DWORD err = GetLastError();
qDebug() << "hr: " << hr;
if (SUCCEEDED(hr) && NULL != thumbnail_id)
{
prop.dwFlags = DWM_TNP_RECTDESTINATION | DWM_TNP_RECTSOURCE | DWM_TNP_OPACITY
| DWM_TNP_VISIBLE | DWM_TNP_SOURCECLIENTAREAONLY;
prop.rcSource = { 0, 0, 1200, 600 };
prop.rcDestination = { 0, 0, 1200, 600 };
prop.opacity = 255;
prop.fVisible = TRUE;
prop.fSourceClientAreaOnly = FALSE;
hr = DwmUpdateThumbnailProperties(thumbnail_id, &prop);
qDebug() << "hr: " << hr;
}
I also tried using a QDockWidget but the image is visible only when the widget is not docked to the MainWindow, as soon I dock the widget, the image disappears, sad.
There's something else I could try to be able to 'cast' the image to a child window?
or maybe another winapi I could use?
I have written a code of the TreeView Control by a blog article. I am trying to add icons to list items. But icons are no rendered.
I have a next code:
void CLeftView::OnInitialUpdate()
{
CTreeView::OnInitialUpdate();
// TODO: Add items by GetTreeCtrl().
HICON hi = NULL;
hi = AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_ICON1));
if (hi != NULL)
{
MessageBox(NULL, L"resource1");
}
else MessageBox(NULL, L"Not resource1");
HICON lo = NULL;
lo = AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDI_ICON2));
if (lo != NULL)
{
MessageBox(NULL, L"resource2");
}
else MessageBox(NULL, L"Not resource2");
CImageList m_tree_imglist;
CTreeCtrl & tc = CTreeView::GetTreeCtrl();
m_tree_imglist.Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 2);
m_tree_imglist.Add(hi);
m_tree_imglist.Add(lo);
tc.SetImageList(&m_tree_imglist, TVSIL_NORMAL);
HTREEITEM hItem;
hItem = tc.InsertItem(L"Fonts", 0, 0, TVI_ROOT);
tc.InsertItem(L"Arial", 0, 0, hItem);
tc.InsertItem(L"Times", 0, 0, hItem);
tc.Expand(hItem, TVE_EXPAND);
}
Icons have added to resource's files. There's do I have a bug? I have message boxes with a next text: "resource1", "resource2".
m_tree_imglist is declared on stack, this image list is destroyed after OnInitialUpdate exits, so CTreeCtrl no longer has an image list.
Image list should be declared as class member instead, so that it remains valid as long as CTreeCtrl needs it. Note the m_ prefix is usually used in MFC to indicate "class member".
class CLeftView : public CTreeView
{
CImageList m_tree_imglist;
...
};
void CLeftView::OnInitialUpdate()
{
...
//CImageList m_tree_imglist; <- remove
tc.SetImageList(&m_tree_imglist, TVSIL_NORMAL);
}
I already created treeview where I can add some items. Basicly I want to tree-view all directories and files with icons associated to them.
So I have these functions:
Adding items to treeview
HTREEITEM AddItemToTree(HWND hwndTree, char *text, int nLevel)
{
TVINSERTSTRUCT tvins;
static HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
static HTREEITEM hRootItem = NULL;
static HTREEITEM hPrevLev2Item = NULL;
AddIconToTree(hwndTree, text); //////////// THIS IS THE FUNCTION BELOW...
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIS_STATEIMAGEMASK;
tvi.iImage = 0;
tvi.iSelectedImage = 0;
tvi.pszText = GetFileNameFromPath(text);
tvins.hInsertAfter = hPrev;
tvins.item = tvi;
if(nLevel == 1)
{
tvins.hParent = TVI_ROOT;
}
else if(nLevel == 2)
{
tvins.hParent = hRootItem;
}
else
{
TVITEM tviSetup;
tviSetup.hItem = hPrev;
tviSetup.mask = TVIF_PARAM;
TVITEM * tviLocal = &tviSetup;
TreeView_GetItem(hwndTree, tviLocal);
if(nLevel > tviLocal->lParam)
{
tvins.hParent = hPrev;
}
else
{
HTREEITEM hPrevLocal = TreeView_GetParent(hwndTree, hPrev);
tviLocal->hItem = hPrevLocal;
TreeView_GetItem(hwndTree, tviLocal);
for(int i = nLevel; i <= tviLocal->lParam;)
{
HTREEITEM hPrevLocalTemp = TreeView_GetParent(hwndTree, hPrevLocal);
hPrevLocal = hPrevLocalTemp;
tviLocal->hItem = hPrevLocal;
TreeView_GetItem(hwndTree, tviLocal);
}
tviLocal->mask = TVIF_TEXT;
TreeView_GetItem(hwndTree, tviLocal);
tvins.hParent = hPrevLocal;
}
}
hPrev = (HTREEITEM)SendMessage(hwndTree, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
if(hPrev == 0)
{
return false;
}
if(nLevel == 1)
{
hRootItem = hPrev;
}
return hPrev;
}
ADDING ICONS TO TREEVIEW:
int AddIconToTree(HWND hwndTree, char *strPath)
{
SHFILEINFO sfi;
memset(&sfi, 0, sizeof(sfi));
SHGetFileInfo(strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_SMALLICON);
int index = sfi.iIcon;
ICONINFO iconinfo;
GetIconInfo(sfi.hIcon, &iconinfo);
HBITMAP hBitmap = iconinfo.hbmColor;
DestroyIcon(sfi.hIcon);
himg = ImageList_Create(16, 16, ILC_COLOR32, 1, 1);
int iImageList = ImageList_Add(himg, hBitmap, NULL);
DeleteObject(hBitmap);
//TreeView_SetImageList(hwndTree, himg, TVSIL_NORMAL);
SendMessage(hwndTree, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)(HIMAGELIST)himg);
MessageBox(hwnd, strPath, "Path:", MB_OK); /* Because of this msgbox I found out what is
really happening, because without it everything I have seen when I run the program was
treeview with icon of the last file, which was folder...So blank icon.*/
return index;
}
My main problem is, that when I'm setting some icon, it is set not only for the one item as I'm expecting, but on all items in treeview. So basicly every item's icon is overwritten by new item's icon. By the way I know that if I want to get icon of folder, I need to use FILE_ATTRIBUTE_DIRECTORY...
So that's it.
Any help would be greatly appriciated!
Thank You in advance :-)
In your AddIconToTree function you're creating a brand new image list every time, which will only ever have one icon in it. You need to maintain the same image list and add additional icons to it rather than re-creating it for every item.
Alternatively, you can get a handle to the shell imagelist with the SHGetImageList function and then assign it to the tree directly. If you don't need to add any of your own images to the tree's image list this is a much easier way of displaying system icons for files and folders as the shell imagelist handles all that for you.
// To initialise the tree's image list - do this one time only
HIMAGELIST himg;
if (SUCCEEDED(SHGetImageList(SHIL_SMALL, IID_IImageList, reinterpret_cast<void**>(&himg))))
SendMessage(hwndTree, TVM_SETIMAGELIST, (WPARAM)TVSIL_NORMAL, (LPARAM)himg);
Then your AddIconToTree function simply becomes:
int AddIconToTree(HWND hwndTree, char *strPath)
{
SHFILEINFO sfi;
memset(&sfi, 0, sizeof(sfi));
// SHGFI_SYSICONINDEX will return the icon's index within the shell image list
SHGetFileInfo(strPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi),
SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES);
return sfi.iIcon;
}
And when you actually add items to the list, make sure you assign the index to the item:
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIS_STATEIMAGEMASK;
tvi.iImage = tvi.iSelectedImage = AddIconToTree(hwndTree, text);
I have created TreeView like this:
TreeView=CreateWindowEx(0, WC_TREEVIEW, TEXT("Tree View"), WS_VISIBLE | WS_CHILD, 0, 0, 200, 500, hwnd, (HMENU)ID_TREE_VIEW, GetModuleHandle(NULL), NULL);
Now I added one item to it like shown on this website.
It all okay, but after hours and hours of googling I still didn't found answer to these questions:
How to add subitems (nodes)?
How to add checkbox on each item (how to determine if specified checkbox is checked)?
EDIT #4:
In response to OPs request, I have added an example that removes checkbox from a parent node.
THE PROBLEM IS THAT CHECKBOX STILL APPEARS WHEN USER SELECTS A NODE AND PRESSES SPACEBAR.
This question solves that problem.
EDIT #3:
I have added the code that creates a node that is already checked.
It is the second child bode in the WM_CREATE handler.
END OF EDIT
case WM_CREATE:
{
// this is your treeview
TreeView = CreateWindowEx(0, WC_TREEVIEW,
TEXT("Tree View"), WS_VISIBLE | WS_CHILD,
0, 0, 200, 500,
hwnd, (HMENU)ID_TREE_VIEW, GetModuleHandle(NULL), NULL);
/************ enable checkboxes **************/
DWORD dwStyle = GetWindowLong( TreeView , GWL_STYLE);
dwStyle |= TVS_CHECKBOXES;
SetWindowLongPtr( TreeView , GWL_STYLE, dwStyle );
/************ add items and subitems **********/
// add root item
TVINSERTSTRUCT tvis = {0};
tvis.item.mask = TVIF_TEXT;
tvis.item.pszText = L"This is root item";
tvis.hInsertAfter = TVI_LAST;
tvis.hParent = TVI_ROOT;
HTREEITEM hRootItem = reinterpret_cast<HTREEITEM>( SendMessage( TreeView ,
TVM_INSERTITEM, 0, reinterpret_cast<LPARAM>( &tvis ) ) );
// and here is an example of removing a checkbox
// from a specific item/subitem in case you ever need it
TVITEM tvi;
tvi.hItem = hRootItem ;
tvi.mask = TVIF_STATE;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.state = 0;
TreeView_SetItem( TreeView, &tvi );
// add firts subitem for the hTreeItem
memset( &tvis, 0, sizeof(TVINSERTSTRUCT) );
tvis.item.mask = TVIF_TEXT;
tvis.item.pszText = L"This is first subitem";
tvis.hInsertAfter = TVI_LAST;
tvis.hParent = hRootItem;
HTREEITEM hTreeSubItem1 = reinterpret_cast<HTREEITEM>( SendMessage( TreeView ,
TVM_INSERTITEM, 0, reinterpret_cast<LPARAM>( &tvis ) ) );
// now we insert second subitem for hRootItem
memset( &tvis, 0, sizeof(TVINSERTSTRUCT) );
tvis.item.mask = TVIF_TEXT | TVIF_STATE; // added extra flag
tvis.item.pszText = L"This is second subitem";
tvis.hInsertAfter = TVI_LAST;
tvis.hParent = hRootItem;
// for demonstration purposes let us check this node;
// to do that add the following code, and add the extra flag for
// mask member like above
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.state = 2 << 12;
HTREEITEM hTreeSubItem2 = reinterpret_cast<HTREEITEM>( SendMessage( TreeView ,
TVM_INSERTITEM, 0, reinterpret_cast<LPARAM>( &tvis ) ) );
// let us expand the root node so we can see if checked state is really set
TreeView_Expand( TreeView, hRootItem, TVE_EXPAND );
}
return 0L;
EDIT #2:
Here Is the part that explains how to check if item is checked ( it now properly checks when you click on a checkbox and when you press spacebar! ) :
case WM_NOTIFY:
{
LPNMHDR lpnmh = (LPNMHDR) lParam;
if( lpnmh->idFrom == ID_TREE_VIEW ) // if this is our treeview control
{
switch( lpnmh->code ) // let us filter notifications
{
case TVN_KEYDOWN: // tree has keyboard focus and user pressed a key
{
LPNMTVKEYDOWN ptvkd = (LPNMTVKEYDOWN)lParam;
if( ptvkd->wVKey == VK_SPACE ) // if user pressed spacebar
{
// get the currently selected item
HTREEITEM ht = TreeView_GetSelection( ptvkd->hdr.hwndFrom );
// Prepare to test items state
TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
tvItem.hItem = (HTREEITEM)ht;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
// Request the information.
TreeView_GetItem( ptvkd->hdr.hwndFrom, &tvItem );
// Return zero if it's not checked, or nonzero otherwise.
if( (BOOL)(tvItem.state >> 12) - 1 )
MessageBox( hwnd, L"Not checked!", L"", MB_OK );
else
MessageBox( hwnd, L"Checked!", L"", MB_OK );
}
}
return 0L; // see the documentation for TVN_KEYDOWN
case NM_CLICK: // user clicked on a tree
{
TVHITTESTINFO ht = {0};
DWORD dwpos = GetMessagePos();
// include <windowsx.h> and <windows.h> header files
ht.pt.x = GET_X_LPARAM(dwpos);
ht.pt.y = GET_Y_LPARAM(dwpos);
MapWindowPoints( HWND_DESKTOP, lpnmh->hwndFrom, &ht.pt, 1 );
TreeView_HitTest(lpnmh->hwndFrom, &ht);
if(TVHT_ONITEMSTATEICON & ht.flags)
{
// Prepare to receive the desired information.
TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
tvItem.hItem = (HTREEITEM)ht.hItem;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
// Request the information.
TreeView_GetItem( lpnmh->hwndFrom, &tvItem );
// Return zero if it's not checked, or nonzero otherwise.
if( (BOOL)(tvItem.state >> 12) - 1 )
MessageBox( hwnd, L"Not checked!", L"", MB_OK );
else
MessageBox( hwnd, L"Checked!", L"", MB_OK );
}
}
default:
break;
}
}
}
break;
The relevant idea for proper testing when spacebar is pressed is handling of TVN_KEYDOWN message.
We use this message to get NMTVKEYDOWN structure filled, which will give us virtual key code of the pressed button and the HWND of the treeview that sent the notification.
Now we use TreeView_GetItem() macro to get the currently selected node and we check its state the same way we did when we did hit testing.
My only problem is concerning this part from the documentation for TVN_KEYDOWN:
Return value
If the wVKey member of lParam is a character key code, the character
will be used as part of an incremental search. Return nonzero to
exclude the character from the incremental search, or zero to include
the character in the search. For all other keys, the return value is
ignored.
I just do not know what to do with the return result so I have put 0L.
Important note: If you need to return value from dialog box procedure use something like this:
SetWindowLongPtr( hwnd, DWLP_MSGRESULT, (LONG_PTR)1 );
return TRUE;
see the remarks for Return value in this documentation and use SetWindowLongPtr instead of SetWindowLong so you can support both x32 and x64 versions of Windows.
That would be all. Hopefully you have your problem solved. If you need further help leave a comment.
END OF EDIT
I have never done checking if tree item is checked but I believe that accepted answer to this question is the way to go.
NOTE:
I would highly appreciate if there someone who can provide code snippet for showing how to determine if treeview node is checked or not.
I have a program and when they drop files into it I want it to get the path show a messagebox "of the path" then delete it. Can anyone shed some light on how to do this?
First of all, you'll need a window that can accept dropped files. This is accomplished by setting the ExStyle of your window to WS_EX_ACCEPTFILES:
//Create a window.
hWnd = CreateWindowEx
WS_EX_ACCEPTFILES, // Extended possibilites for variation.
gsClassName, // Classname.
gsTitle, // Title caption text.
WS_OVERLAPPEDWINDOW, // Default window.
CW_USEDEFAULT, // X Position.
CW_USEDEFAULT, // Y position.
230, // Window starting width in pixils.
150, // Window starting height in pixils.
HWND_DESKTOP, // The window is a child-window to desktop.
(HMENU)NULL, // No menu.
hInstance, // Program Instance handler.
NULL // No Window Creation data.
);
Second, you'll need to handle the WM_DROPFILES message in your WinProc() callback.
if(uMessage == WM_DROPFILES)
{
HDROP hDropInfo = (HDROP)wParam;
char sItem[MAX_PATH];
for(int i = 0; DragQueryFile(hDropInfo, i, (LPSTR)sItem, sizeof(sItem)); i++)
{
//Is the item a file or a directory?
if(GetFileAttributes(sItem) &FILE_ATTRIBUTE_DIRECTORY)
{
//Delete all of the files in a directory before we can remove it.
DeleteDirectoryRecursive(sItem);
}
else {
SetFileAttributes(sItem, FILE_ATTRIBUTE_NORMAL); //Make file writable
//DeleteFile(sItem);
}
}
DragFinish(hDropInfo);
}
Third, you'll need a function that can remove all of the sub-directories and files from any directories that are dropped onto your dialog:
bool DeleteDirectoryRecursive(const char *sDir)
{
WIN32_FIND_DATA fdFile;
HANDLE hFind = NULL;
char sPath[2048];
//Specify a file mask. *.* = We want everything!
sprintf(sPath, "%s\\*.*", sDir);
if((hFind = FindFirstFile(sPath, &fdFile)) == INVALID_HANDLE_VALUE)
{
printf("Path not found: [%s]\n", sDir);
return false;
}
do
{
//Find first file will always return "."
// and ".." as the first two directories.
if(strcmp(fdFile.cFileName, ".") != 0
&& strcmp(fdFile.cFileName, "..") != 0)
{
//Build up our file path using the passed in
// [sDir] and the file/foldername we just found:
sprintf(sPath, "%s\\%s", sDir, fdFile.cFileName);
//Is the entity a File or Folder?
if(fdFile.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
{
DeleteDirectoryRecursive(sPath); //Recursive call.
}
else{
printf("File: %s\n", sPath);
SetFileAttributes(sPath, FILE_ATTRIBUTE_NORMAL);
//DeleteFile(sPath);
}
}
}
while(FindNextFile(hFind, &fdFile)); //Find the next file.
FindClose(hFind); //Always, Always, clean things up!
SetFileAttributes(sDir, FILE_ATTRIBUTE_NORMAL);
//RemoveDirectory(sDir); //Delete the directory that was passed in.
return true;
}
Lastly, you'll need to be VERY CAREFUL with this snippet - it deletes files after all.