|
I have a static filter using something like this:
TCHAR* tcFilter = _T("Word Document\0*.DOC\0Excel Document\0*.XLS\0");
What I really need is a dynamic filter where I can remove or add file types to it.
TCHAR* tcFilter = NULL;
if (IsWordInstalled())
etc.
Any suggestions on how I can do this? That '\0' delimiter really throws me for a loop.
"It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln
|
|
|
|
|
I think you'll need to use std::string to handle the embedded '\0' characters.
Otherwise, you'll have to get tricky with the memcpy() function.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Correct.
One solution is memcpy().
Kuphryn
|
|
|
|
|
This works for me:
CString strFilter;
strFilter += ...
strFilter += (TCHAR)'\0';
dlgFile.m_ofn.lpstrFilter = strFilter;
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Would that handle multiple filters separated by '\0'?
"It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln
|
|
|
|
|
Jason Henderson wrote:
Would that handle multiple filters separated by '\0'?
Yes. You only need the \0\0 at the end from memory. Anyway this is how I do it in ED (see sig) to dynamically build the file types list.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
How about a little function that you can call for that:
int AddToFilter(TCHAR* szFilter, int nSize, LPCTSTR szDescription, LPCTSTR szExtension)
{
ASSERT(szFilter);
ASSERT(szDescription);
ASSERT(szExtension);
_tcscpy(&szFilter[nSize], szDescription);
int nLenDesc = _tcslen(szDescription);
_tcscpy(&szFilter[nSize + nLenDesc + sizeof(TCHAR)], szExtension);
int nLenExt = _tcslen(szExtension);
return nSize + nLenDesc + nLenExt + (sizeof(TCHAR) * 2);
}
Then you can use it like this:
TCHAR szFilter[300] = _T("");
int nSize = 0;
if (IsWordInstalled())
nSize = AddToFilter(szFilter, nSize, _T("Word"), _T("*.doc"));
if (IsExcelInstalled())
nSize = AddToFilter(szFilter, nSize, _T("Excel"), _T("*.xls"));
AddToFilter(szFilter, nSize, _T("All Files"), _T("*.*"));
I haven't tested (or even compiled) this, but hopefully it's close enough.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Whoa, thanks. I didn't expect you to write the code for me, but I'll give it a shot.
"It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln
|
|
|
|
|
I would say you must do this dynamically with raw tchar data - and you must terminate it with \0\0 BTW. Make sure tcFilter is declared with space to spare, find the length by searching for "\0\0",
J.
----------------------------
|
|
|
|
|
Hi all,
I am developing a dialog based application in VC6.0
I have four bitmap resources on main dialog window.
I have disabled them on startup by calling ShowWindow(FALSE) and enabling them on runtime, by calling ShowWindow(TRUE)
They are appearing in a sequence because I have enabled them one by one.
I want to enable them all parallel rather then in sequential manner.
Please any body knows how to do that.
Regards,
The Phantom.
|
|
|
|
|
Maybe using LockWindowUpdate /UnlockWindowUpdate ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How can I make an animated gif to AVI for VC?
Thank you
|
|
|
|
|
i'm using visual c++.net and sometimes when i'm just typing in code, the whole C++ development environment just crashes. A DOS command box appears onscreen with the word 'mscordump' on it... and the development environment just closes itself. This is very strange - does anyone know what could cause this?
|
|
|
|
|
pffdaddy wrote:
A DOS command box appears onscreen with the word 'mscordump' on it
Processor overheating?
Memory-timing too fast for your (possibly crappy) ram-chips?
Bad sectors on your harddisk in some essential DLLs or your Pagefile?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
i need lots images for our new project, the images are in size of 16x16 and 32x32 pixels.
format can be bitmap, icon, cursor or others.
do you know any web sites from which i can download those images ?
thanks for any links.
includeh10
|
|
|
|
|
You could always steal um... borrow them from MS Office apps.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Check out www.iconbazaar.com
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Dear All,
I am developing an application in MFC VC++ Version 6.0 on Windows 2000.
Please help me out in following problem:
I have deleted a folder and the folder is moved to recycle bin. I get the exact path of the
recycled folder from my application.
For example
If i delete a folder say "myfolder" from c:\
c:\myfolder
I get the string path
C:\RECYCLER\S-1-5-21-1844237615-1202660629-1060284298-500\dc1
corresponding to it.
Now i have the path of the recycled folder. From this string I need to know the the original
location of the folder from which it was deleted.
I went through the article given in
http://www.codeproject.com/shell/recyclebin.asp
This article is very nice but unfortunately i couldnot get any useful hint from this article to
solve my purpose.
Can anybody please suggest a way out to get the original location of the deleted folder?
I hope my question is clear, please let me know if anybody needs further clarifications.
Thanks in advance,
Best Wishes,
Rohit
|
|
|
|
|
You must to use SHGetFolderPath
Carlos Antollini.
Pi Five[^]Creator
|
|
|
|
|
I renamed IDOK to ID_BEXIT , and did this:
void CWinViewerDlg::OnOK()
{
}
void CWinViewerDlg::OnBexit()
{
CDialog::OnOK();
}
and changed the tab order so that the exit button is not #1. yet I hit enter and the dialog vanishes. I recall but not quite something along these lines that will stop this. I dont want to use PreTranslateMessage.
Ideas?
Thanks,
ns
|
|
|
|
|
Make sure ID_BEXIT is no longer the "default" button (uncheck that attribute in the resource editor).
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
that was it.
How are you? Been ages since I heard from you........
Thanks,
ns
|
|
|
|
|
Pretty good, given that I've been working 100 hr weeks for 6 months. But on the bright side, our new app is rock solid and slick (imho). We release next week, after which I may go hog wild and take an entire weekend off.
Our little company's been doing pretty well, too. You can check us out here[^].
Hope all's well with ya! How did the 1st year of college go? Seems like only yesterday, no?
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Well, re college, our guy decides he doesnt care for science and math, so he is going to do languages at the defense languages institute in CA. ..... he joined the navy !!!!!! Probably something asian or middle eastern.
Been doing a bit of QT..
|
|
|
|
|
very easy.
from ur new dialog box (OK and cancel buttons on it), double click OK button to add the function and keep it do nothing, then delete the button from dialog.
the enter key is disabled for the message.
if u delete OK button, create a new dialog then copy the button to original dialog box.
includeh10
|
|
|
|