|
I did the following:
I added the radio buttons.
Then I manually (not using the wizard) declared variables of type CButton ( for the control) and CString (for the value), as well as inserting the necessary lines of code in the data exchange.
This works and allows one to have all the usual interaction with CButton controls. The only disadavantage of this is that one then needs to add the necessary code to check and uncheck the radio buttons when one is selected.
Rui
|
|
|
|
|
On the first radio button of the second group properties, check the "group" checkbox on the first tab. this will mark it as the first button of the second group.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Thanks Michel,
that does the trick.
Rui
|
|
|
|
|
Well, this is not actually a C++ problem. It's rather a problem with the VS.net IDE and a macro I wrote (but the macro runs on top of a C++ project ).
The macro worked very well all the time, but today it started to give me this error:
"QI for IEnumVARIANT failed on the unmanaged server."
QI means QueryInterface, that's clear, but the whole thing doesn't make much sense since the macro worked very well all the time.
So does anybody know what the problem might be (and how to solve it)? Or is this just one of the annoying bugs in VS.net?
Hope someone can help me
|
|
|
|
|
According to the docs, when CFileDialog adds the default extension to a name entered by the user without it, only the first three characters are appended. So, if the default extension is .mydoc , it returns whatever.myd . I've checked this to be true for Win95, while in 98 the whole extension is added.
Is there any standard workaround for this proved to work in all OSs (9x, NT, etc.)? Of course, I want the whole extension to be added.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaq
MSDN says "This string can be any length, but only the first three characters are appended"
But you say that this is true only in Win95. It 98 and upper OSs, there is a bug [actually a very useful feature] where the full extension is added. Hmmm.
Curious. And I am sorry I don;t have a solution
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
That's weird behavior.
I don't have a proven workaround, but here's what I'd do:
1. Set the lpstrDefExt member to NULL.
2. After DoModal, check the file name for a period. If it doesn't have one, append your default extension (.mydoc) to it.
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Does anyone know how to display the copy progress dialog box? Chris Maunder and Michael Dunn's dialog wrapper both look very good:
http://www.codeproject.com/miscctrl/#Progress Controls
But I do not know how to implement it with progress... I am using CFileFind and CFileFind::FindNextFile( ) to find the source files. I use ::CopyFile( ) to copy files, which can only copies 1 file at a time. Thus I have no way of finding out total # of files or total copying size.
Help!??
Thanks.
|
|
|
|
|
You can use SHFileOperation. It'll not only show the copy-progress bar, but is also recycle-bin-aware
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
You can also use CopyFileEx which accepts a callback function as an argument.
|
|
|
|
|
How can I use a dialog box that browse FOLDER in my program?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Take a look at the SHBrowseForFolder function of the shell API.
|
|
|
|
|
Thank you Tak.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
hi friend ,
char szFolderPath[MAX_PATH];
LPBROWSEINFO pBrowseInfo;
pBrowseInfo=new BROWSEINFO ;
pBrowseInfo->hwndOwner=m_hWnd;
pBrowseInfo->pidlRoot=NULL;
pBrowseInfo->pszDisplayName=szFolderPath;
pBrowseInfo->lpszTitle="the text u enter here is appeared in the top of the dialog ";
pBrowseInfo->ulFlags=BIF_RETURNONLYFSDIRS;
pBrowseInfo->lpfn =NULL;
pBrowseInfo->lParam=0;
pBrowseInfo->iImage =0;
LPITEMIDLIST pIdList;
pIdList=SHBrowseForFolder(pBrowseInfo);
SHGetPathFromIDList(pIdList,szFolderPath);
//Now u get the foder path in szFolderPath...
delete pBrowseInfo;
OK???
-Renjith
Trace The Bugs...
|
|
|
|
|
Thank you.
|
|
|
|
|
I'm getting an "Unhandled exeption" when running this function. I get it when it comes to the pBrowse->Next line. I have already tested if pBrowse is null and it isn't, neihter is pIdl. Here's the code
void OnOpenFolder()
{
BROWSEINFO bi = {0};
IShellFolder *pSf;
LPMALLOC pMalloc;
DWORD pActual = 0;
bi.hwndOwner = ghWnd;
bi.pidlRoot = NULL;
bi.lpszTitle = "Locate MP3 Folder";
bi.ulFlags = BIF_DONTGOBELOWDOMAIN;
bi.lpfn = NULL;
SHGetDesktopFolder (&pSf);
if (pSf)
{
LPITEMIDLIST pIdl;
pIdl = SHBrowseForFolder(&bi);
if (pIdl)
{
IEnumIDList *pBrowse;
SHGetMalloc(&pMalloc);
pSf->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
pBrowse->AddRef();
if (pBrowse)
{
while (pBrowse->Next(1, &pIdl, &pActual) == S_OK)
{
LVITEM Lvi = {0};
char szPath[MAX_PATH+1];
SHGetPathFromIDList(pIdl, szPath);
Lvi.mask = LVIF_TEXT;
Lvi.pszText = szPath;
Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
ListView_InsertItem(DlgItems[7], &Lvi);
}
}
pBrowse->Release();
}
pMalloc->Free(pIdl);
pMalloc->Release();
}
pSf->Release();
}
ghWnd is the hanlde to my window (yes, it's valid)
DlgItems[7] is the handle to a listview control, also valid.
Here's the exact error: "Unhandled exeption in app.exe (SHELL32.DLL): 0xC0000005: Access Violation."
Any help greatly appreciated
Thanks.
|
|
|
|
|
Just a clue:
There are some mistakes in your code. For example you have:
if(pBrowe)
{
...
...
}
pBrowse->Release();
Where as it should be:
if(pBrowse)
{
...
pBrowse->Release();
}
|
|
|
|
|
pSf->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse); Shouldn't you be asking for a IID_IEnumIDList ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm not quite sure, but here's my code now, with the IID_IShellFolder parameter in BindToObjet it works, but with the IID_IEnumIDList i get that unhandled exception.
void OnOpenFolder()
{
BROWSEINFO bi = {0};
IShellFolder *pSf;
LPMALLOC pMalloc;
LPENUMIDLIST pFolder = NULL;
DWORD pActual = 0;
LVITEM Lvi = {0};
char szFolderPath[MAX_PATH+1];
bi.hwndOwner = ghWnd;
bi.pidlRoot = NULL;
bi.lpszTitle = "Locate MP3 Folder";
bi.ulFlags = BIF_DONTGOBELOWDOMAIN;
bi.lpfn = NULL;
SHGetDesktopFolder (&pSf);
if (pSf)
{
LPITEMIDLIST pIdl;
pIdl = SHBrowseForFolder(&bi);
SHGetPathFromIDList(pIdl, szFolderPath);
Lvi.mask = LVIF_TEXT;
Lvi.pszText = szFolderPath;
Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
ListView_InsertItem(DlgItems[7], &Lvi);
if (pIdl)
{
IShellFolder *pBrowse = NULL;
SHGetMalloc(&pMalloc);
pSf->BindToObject(pIdl, NULL, IID_IEnumIDList, (LPVOID*)&pBrowse);
pSf->Release();
pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (pBrowse)
{
while (pFolder->Next(1, &pIdl, &pActual) == S_OK)
{
SHGetPathFromIDList(pIdl, szFolderPath);
Lvi.pszText = szFolderPath;
Lvi.iItem = SendMessage(DlgItems[7], LVM_GETITEMCOUNT, 0, 0);
ListView_InsertItem(DlgItems[7], &Lvi);
}
}
pBrowse->Release();
}
pMalloc->Free(pIdl);
pMalloc->Release();
}
pSf->Release();
}
Although there still is a problem. The SHGetPathFromIDList(pIdl, szFolderPath); sets the szFolderPath to <desktop folder="">\<one of="" the="" subfolders="" in="" folder="" i="" chose="" via="" shbrowseforfolder="">
Thanks
|
|
|
|
|
I might be totally wrong, but I think there's still a mismatch problem: if pBrowse is now an IShellFolder * , you should retrieve it using IID_IShellFolder ; if you make it a IEnumIDList * , use IID_IEnumIDList . Just keep types straight.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I spoke to soon and thought that deleting the .clw file cleared up my problems with going into the wizzard.
If it isn't in the .clw file where is this error coming from? how do I clear it up.
Thanks again.
|
|
|
|
|
if you have added any code to the AFX_DATA_MAP section of a DoDataExchange, or if you've changed AFX_DATA_INIT in a window constructor, you may have added something that the classwizard doesn't understand.
so, if you have done any of that, try moving your code outside the AFX_DATA_INIT or AFX_DATA_MAP blocks.
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
manually editing wizard code causes parsing problems.specially with the classwizard .
|
|
|
|
|
Chris, Right on! That put me in the right place where I found a ; with no code around it.
Thanks.
|
|
|
|
|
Hi,
how to detect the main (primary) thread out of several threads without the toolhelp functions from Win9X respective Win2K, and without MFC's AfxGetMainThread ?
Thanks in advance
|
|
|
|