|
Use your Mk1 Eyeball.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
O M G I'm starting to think I'm not awake yet...
mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How can I create file in NOKIA mobile phone memory disk? How can I create dirrectory in NOKIA mobile phone memory disk?
My mobile phone is Nokia N72. I can access its memory disk after I connect it wity my computer. Its directory is 'My Computer\\Nokia N72\\memorydisk\\'
I failed to access it with the following code:
CString csNokiaDir("My Computer");
bFindFile=finder.FindFile(csNokiaDir);
csNokiaDir = "My Computer\\Nokia N72";
bFindFile=finder.FindFile(csNokiaDir);
csNokiaDir = "My Computer\\Nokia N72\\memorydisk";
I get another directory by the following MFC code:
BROWSEINFO bi;
TCHAR Buffer[512]="";
TCHAR FullPath[512]="";
bi.hwndOwner = m_hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = Buffer;
bi.lpszTitle = "Select directory";
bi.ulFlags = BIF_RETURNONLYFSDIRS|BIF_EDITBOX|BIF_BROWSEFORCOMPUTER ;
bi.lpfn = NULL; //回调函数,有时很有用
bi.lParam = 0;
bi.iImage = 0;
ITEMIDLIST* pidl = ::SHBrowseForFolder (&bi);
if(::SHGetPathFromIDList (pidl,FullPath))
{
m_sFonePath2 = FullPath;
}
The path I got is'::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{416651E4-9C3C-11D9-8BDE-F66BAD1E3F3A}\354533010872671\E:\'
I used FindFile to check it and failed again.
Does any one know how to handle this kind of directory?
|
|
|
|
|
i am guess the problem is with the use of "My computer" in your drive path. The nokia should have a drive letter designated with it and this should allow you to access it like any other drive, like "C:\", not "My computer\\C:\\" as I am guessing you are doing right now in your code!
As to what drive letter gets assigned to the nokia drive, I am not sure how you determine this at runtime with your application, so first step would be to get something hard-coded working =)
Yours Truly, The One and Only!
|
|
|
|
|
Have some one tried to generate MFC wrapper classes for excel interfaces? I read step-by-step tutorials on Microsoft site. Doing the same things, I'm getting 100's of errors.
The tutorials are here:
http://support.microsoft.com/kb/308407
http://support.microsoft.com/kb/307473/EN-US/
Errors looks like this:
Error 66 error C2011: 'Picture' : 'struct' type redefinition c:\documents and settings\администратор\мои документы\c++projects\excel12test\debug\excel.tlh 19474
Error 67 error C2146: syntax error : missing ';' before identifier 'Scripts' c:\documents and settings\администратор\мои документы\c++projects\excel12test\debug\excel.tlh 20463
Error 68 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\documents and settings\администратор\мои документы\c++projects\excel12test\debug\excel.tlh 20463
Error 69 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\documents and settings\администратор\мои документы\c++projects\excel12test\debug\excel.tlh 20463
Error 70 error C2146: syntax error : missing ';' before identifier 'MailEnvelope' c:\documents and settings\администратор\мои документы\c++projects\excel12test\debug\excel.tlh 20511
Error 71 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\documents and settings\администратор\мои документы\c++projects\excel12test\debug\excel.tlh 20511
I tried in Excel 9,10,11,12 and the thigs are same.
Looks like compiler is working wrong, because there is nothing to code when generating a wraper, all code generating automatically. I don't know what to do.
THE QUESTION APPLIES ONLY TO VISUAL C++ 2005
Please help.
-- modified at 6:36 Thursday 26th July, 2007
|
|
|
|
|
hint, are you using the english tlh in a non english environment ?
|
|
|
|
|
No, enviroment is english, but Office and OS is russian.
|
|
|
|
|
What is the correct sintax to solve this specialization problem?
I'm trying but for now I have only errors while compiling or linking.
template<typename T> class CMyClass{
...
int Foo(){
}
double Foo(){
}
void Foo(){
}
...
}
Thanks to everyone
Russell
|
|
|
|
|
As far as I can remember you cannot declare function templates based on return value types.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
ops, really?
Of course, I don't want to overload the functions: I only want to specify completely different functions in that 2 cases (T=int and T=double) using specialization (if it is possible).
Ciao
Russell
|
|
|
|
|
If I remember well, you cannot do such specializations, i.e. functions having the same name, the same number and type of arguments but different return types.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
For instance, you cannot do the following:
int foo(){return 1;}
double foo(){return 1.;}
while the code snippet below:
int foo(int i){return 1;}
double foo(char c){return 1.;}
compiles fine.
If I remeber well this is related to the C++ Mangling scheme (return parameters are not used when mangling).
[added] There is a better argument: how the hell the compiler will distinguish which flavour of the function you're calling?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
probally you are rjght!
I was only hoping that templates could be very very powerful, but probally doesn't.
tnx
Russell
|
|
|
|
|
In fact they are very powerful. But, anyway, you cannot do that.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: how the hell the compiler will distinguish which flavour of the function you're calling?
mmm...but I think that you are not understanding that I'm using templates , Am I rigth?
Templates are elaborated during pre-compiler step! There you can write different member definitions according to some conditions, like #if #else ...
The compiler comes after that processing.
Russell
|
|
|
|
|
I understand, understand...
But template specializations are eventaully standard C++ functions (or methods) hence what you cannot do with the latter you cannot do with the former.
_Russell_ wrote: Templates are elaborated during pre-compiler step! There you can write different member definitions according to some conditions, like #if #else ...
The compiler comes after that processing
I don't agree: templates, AFAIK, are not pre-processor stuff.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Ok,
I'll surrender.
Russell
|
|
|
|
|
Hello _Russell_,
U can specify the return type as T.
Come online at:-
jubinc@skype
|
|
|
|
|
|
If you need different function for int and double you need two different classes for they, and one template for others.
Why do you want your class todo different things width different types? This is not a application of templates. Templates are useful when types are diffrent and actions are same.
Hope will help you.
|
|
|
|
|
progDes wrote: Why do you want your class todo different things width different types?
The class is very big...many function are in common...but I need to differentiate the code in this 2 cases
...the problem is that I'm inside the class, I haven't found nothing into manuals/online helps. But I really need to solve this problem
Russell
|
|
|
|
|
Maybe reformulating the problem will help: what do you really need to do?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Probally ...got a way!
T Foo(){
T FakeParam;
return Foo(FakeParam);
}
private:
double Foo(double){
}
int Foo(int){
}
T Foo(T){
}
Needed some tests
Russell
|
|
|
|
|
In your case the only decision I see is macro class generation, not templates, macros. And of course #ifdef, #endif. But this is ugly, think about program design. This is bad approach.
|
|
|
|
|
I will maybe say something without sense... but... Why don't you make a way of trick to the compiler? I mean...
I make some additions to the SmartList of Simon Hughes here in codeproject. You can look for my article. The fact is...
If a CList can return whatever you give in the TYPE, ARG_TYPE.... Why don't you use that possibility? You can have some intermediate class that use your "typename T" as entry parameter and then you shouldn't have any problem more to return one type or another type of element. The return will depend on what you give to the ARG_TYPE.
I.E:
CMyList < TYPE, ARG_TYPE >& Foo (T tTemp)
{
return tTemp;
}
With that you return T independantly of what type of variable T is, being possible for complex classes too.
In my project I have some main ObjClass that have member variables and methodes that use secondary SubObjClass that have parameters and methodes that use third type of SubSubObjClass, so on till 5 steps in the hierarchy. And The main objects are saved in one of this list. The list can save different type of things and returns what it has saved in. No matter of what.
Im not meaning you should a CList with your elements, but maybe you can rewrite your template to return whatever you need using something like that.
I hope not saying silly things and that it helps you
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|