|
It is poosible to create abstracet template classes (just give it a try
You inherit from them as you would a normal class.
template<class t="">
class CBaseClass
{
//ex:
virtual int DoIt() = 0;
....
};
template<class b="">
class CDerive : public CBaseClass
{
};
//an instance:
CDerive<int> MyIntclass;
shouldn't be all that difficult?
|
|
|
|
|
Hi,
I've some doubt in templates. what Happens if we have a static variable in a template base class. and we pass two different parameters while instatiating it.
is the static "variable Single" or does each instance has its own diffrent variable
|
|
|
|
|
There's a difference between instantiating a template class (making a template class into a concrete class) and instantiating an object of a class.
|
|
|
|
|
How do we make a template class into a concrete class
|
|
|
|
|
Can anyone direct me to a place where I can find a quality example/tutorial on creating a 2000\NT service?
|
|
|
|
|
http://www.codeproject.com/system/index.asp#Services
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Why doesn't this work:
SYSTEMTIME sysTime;
sysTime.wHour = 22;
sysTime.wMinute = 34;
SetSystemTime(&sysTime);
|
|
|
|
|
Probably because other fields are invalid. Try initializing the structure properly before using it. FYI, you can call GetLastError() to figure out why SetSystemTime() failed.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi..
Could anyone lend me a hand... How do u play sound files other than wav files? The source codes that I have can only play wav files, however I need to be able to play MID, MP3, and other sound files.
Thanks in Advance. CIAO
|
|
|
|
|
I've tried your suggestion but there is one problem!
The timer has to be killed BEFORE OnTimeChange() calls.....
so what to do... kill the timer in the OnTimeChange is to late because the variable in OnTimer assigns the time to the time that the user changed to!
so how??
Do you have any suggestions?
|
|
|
|
|
You said to me before that poledit.exe could disable the time change in Windows.
Now I wonder: Can you guide where to check or uncheck the the option that enables time changing!
What .adm file am I going to use?
|
|
|
|
|
Well, I said that maybe PolEdit could have that option. I never used it, sorry, I only know it can be used to configure some restrictions on Win9x machines (such as disabling the screen settings).
Try with a search on Google for "poledit", maybe you'll have better luck!
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hey!
I have two questions about MSVCRT.DLL.
1. I am compiling an ActiveX control in VC++ 6. When I choose the min_dep build settings, I can a linker error: "symbol not found _main()" or something like that. The help suggests that I remove the _ATL_MIN_CRT preprocessor define - but if I will do that, the project will depend on MSVCRT.DLL - and I don't want that.
2. Suppose for a moment that I have to live with the dependancy on MSVCRT.DLL. With which OSes / common applications is it distributed? I tried to package it with my ActiveX DLL in the same CAB (without any .INI file) - and the control didn't start - this small red X appeared on the top left corner of its deisgnated area in the page. On the computer I tried that, I actually HAD the MSVCRT.DLL installed. When I tried doing the same with a CAB file that didn't contain MSVCRT.DLL inside it - it worked. (As I said, MSVCRT.DLL was in my system directory all along). I'm using Windows 2000 Server - no SPs. Anyone has an explanation for that?
Thank you!
|
|
|
|
|
MSVCRT is distributed with a ton of stuff, since it is the C runtime and all. However you can build your control in ReleaseMinDependency mode and the CRT code will be linked statically, meaning you won't need that DLL. This makes life much easier on you, since you don't have to worry about which version of the DLL is on the system, and installing a new one if necessary.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
|
Posted the above thread by mistake! Please ignore it (and check the one above it)
|
|
|
|
|
I'm writing a multi-threaded FTP sites and contents searching program using WININET lib. When I search the contents in a FTP site, I have to enumerate the files under a directory. But when I use MFC's CFtpFileFind class, it terminated with a error message at FtpFindFirstFile() when there're some thousands of files under the directory. I tried many times but it still failed. I can't solve this problem. Could someone give me some suggestions?
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
What's the error message?
Post some code.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
Sorry, I'm using Win 2k Simplified Chinese version, so I don't know what the error message is in English. But I think it should be something like "0xxxxxx" instruction referenced to "xxxxxxxx" address error, the memory cannot be 'read'. Here is the content searching function:
void MultiThreadSearch::IterFind(
CFtpConnection *pFTP,
LPCTSTR szStrToFind,
LPCTSTR dircontent,
int maxdepth,
BOOL bOmit,
int index,
int depth)
{
MSG msg;
CStringArray csDirectories;
long directories=0;
BOOL bFlag=FALSE;
BOOL bNeedSearch=TRUE;
if(maxdepth!=-1&&depth>maxdepth)
return;
CMyFtpFileFind finder(pFTP);
bFlag=finder.FindFile(NULL,INTERNET_FLAG_DONT_CACHE|
INTERNET_FLAG_RESYNCHRONIZE);
while(bFlag) {
if(bQuit) {
return;
}
if(::PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
bFlag=finder.FindNextFile();
CString yytemp=szMainTitle;
yytemp+=finder.MyGetFileURL();
(AfxGetApp()->GetMainWnd())->SetWindowText(yytemp);
bNeedSearch=FALSE;
if(finder.IsDirectory()||
finder.MatchesMask(FILE_ATTRIBUTE_REPARSE_POINT)) {
BOOL bResult=FALSE;
if(finder.IsDirectory()) {
if(finder.IsDots()) {
bResult=TRUE;
}
}
if(bResult) {
continue;
}
if(depth<=maxdepth) {
CString xxx=finder.GetFileName();
if(dircontent==NULL) {
bNeedSearch=TRUE;
} else if(bOmit) {
xxx.MakeUpper();
if(xxx.Find(dircontent)!=-1) {
bNeedSearch=TRUE;
}
} else if(xxx.Find(dircontent)!=-1) {
bNeedSearch=TRUE;
}
if(bQuit) {
return;
}
if(bNeedSearch) {
directories++;
CString ttt=finder.GetFileName();
csDirectories.Add(ttt);
BOOL bGotIt=FALSE;
if(bOmit) {
ttt.MakeUpper();
LPSTR pStr=ttt.LockBuffer();
if(regular.Search(pStr)) {
bGotIt=TRUE;
}
ttt.UnlockBuffer();
} else {
LPSTR pStr=ttt.LockBuffer();
if(regular.Search(pStr)) {
bGotIt=TRUE;
}
ttt.UnlockBuffer();
}
if(bQuit) {
return;
}
if(bGotIt) {
CString xx=finder.MyGetFilePath();
CWftp1Dlg *pDlg=(CWftp1Dlg*)CWftp1Dlg::FromHandle(hWnd);
CTreeCtrl *pTree=(CTreeCtrl*)pDlg->GetDlgItem(IDC_TREE_FTPS);
pTree->InsertItem(xx,
*((HTREEITEM*)arAllFTPs.GetAt(index)));
pTree->Expand(*((HTREEITEM*)arAllFTPs.GetAt(index)),
TVE_EXPAND);
}
}
} else {
directories++;
CString ttt=finder.GetFileName();
csDirectories.Add(ttt);
BOOL bGotIt=FALSE;
if(bOmit) {
ttt.MakeUpper();
LPSTR pStr=ttt.LockBuffer();
if(regular.Search(pStr)) {
bGotIt=TRUE;
}
ttt.UnlockBuffer();
} else {
LPSTR pStr=ttt.LockBuffer();
if(regular.Search(pStr)) {
bGotIt=TRUE;
}
ttt.UnlockBuffer();
}
if(bQuit) {
return;
}
if(bGotIt) {
CString xx=finder.MyGetFilePath();
CWftp1Dlg *pDlg=(CWftp1Dlg*)CWftp1Dlg::FromHandle(hWnd);
CTreeCtrl *pTree=(CTreeCtrl*)pDlg->GetDlgItem(IDC_TREE_FTPS);
pTree->InsertItem(xx,
*((HTREEITEM*)arAllFTPs.GetAt(index)));
pTree->Expand(*((HTREEITEM*)arAllFTPs.GetAt(index)),
TVE_EXPAND);
}
}
} else {
if(depth<=maxdepth) {
BOOL bGotIt=FALSE;
CString ttt=finder.GetFileName();
if(bOmit) {
ttt.MakeUpper();
LPSTR pStr=ttt.LockBuffer();
if(regular.Search(pStr)) {
bGotIt=TRUE;
}
ttt.UnlockBuffer();
} else {
LPSTR pStr=ttt.LockBuffer();
if(regular.Search(pStr)) {
bGotIt=TRUE;
}
ttt.UnlockBuffer();
}
if(bQuit) {
return;
}
if(bGotIt) {
CString xx=finder.MyGetFilePath();
CWftp1Dlg *pDlg=(CWftp1Dlg*)CWftp1Dlg::FromHandle(hWnd);
CTreeCtrl *pTree=(CTreeCtrl*)pDlg->GetDlgItem(IDC_TREE_FTPS);
pTree->InsertItem(xx,
*((HTREEITEM*)arAllFTPs.GetAt(index)));
pTree->Expand(*((HTREEITEM*)arAllFTPs.GetAt(index)),
TVE_EXPAND);
}
}
}
}
finder.Close();
CString strObject;
CString temp;
int i;
if(pFTP->GetCurrentDirectory(temp)) {
for(i=0;i<directories;i++) {
="" if(bquit)="" return;
="" }
="" if(::peekmessage(&msg,null,null,null,pm_remove))="" ::translatemessage(&msg);
="" ::dispatchmessage(&msg);
="" strobject="csDirectories.GetAt(i);
" if(strobject.right(1)="=CString(".")||strObject.Find("..")!=-1)" continue;
="" int="" chindex;
="" while((chindex="strObject.Find("%"))!=-1)" cstring="" combine;
="" char="" buf[3];
="" if(chindex+1="">=strObject.GetLength())
break;
buf[0]=strObject.GetAt(chindex+1);
if(!(buf[0]>='0'&&buf[0]<='9'))
break;
if(chindex+2>=strObject.GetLength())
break;
buf[1]=strObject.GetAt(chindex+2);
if(!(buf[0]>='0'&&buf[0]<='9'))
break;
buf[2]=0;
char ch=LOBYTE(LOWORD(strtoul(buf,NULL,16)));
combine=strObject.Left(chindex)
+ch
+strObject.Right(strObject.GetLength()-chindex-3);
strObject=combine;
}
if(pFTP->SetCurrentDirectory(strObject)) {
if(bQuit) {
return;
}
IterFind(pFTP,szStrToFind,dircontent,maxdepth,bOmit,index,depth+1);
pFTP->SetCurrentDirectory(temp);
}
}
}
}
There will be about 200 threads of this function running at the same time. I have no idea at all about the reason!
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
How do you do parsing? If i wanted to write a parser to parse the input line.. how would i go about doing that with the characters @ and # ?
Thanks
kginsberg@hotmail.com
|
|
|
|
|
The simplest parser is strtok(). Pass it your input line and a string of delimiters, and it will return tokens parsed out of the input string.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
I already post a thread on the subject but it wasn't clearly explained. So here is my new question.
I'm making a plugin based file loader. When I cam to loading zipped files, I realized I had to callback my plugin API with each contained file so as to be able to read them.
That is:
1/ The plugin engine call the unzip dll
2/ the unzip dll read each file
loop:
for each file:
3/ call back the plugin api with the file data (name is enough)
4/ the plugin API uncode the file
end of loop:
5/ end of unzip plugin
I don't know how to write this in C++. The ideal would be the 3rd step
to call a method inside the plugin API.
Can someone tell me ? This is very important... to me )
Yarp
|
|
|
|
|
There's an exmple callback in the C++ forum FAQ. Give that a look, and ask here again if you still have questions.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
Thanks a lot, I have a look immediately
Yarp
|
|
|
|
|
Ok, everything is clear now. I understood the howto, I was stuck since 2 weeks. Thank and thanks for your articles, espcially the one about custom draw List controls.
Cheers
Yarp
|
|
|
|