|
Replace m_nCmdShow with SW_SHOWMAXIMIZED in the call to ShowWindow inside CYourApp::InitInstance.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
I developed a COM project in VC++ 6.0 and it runs successfully. But now when i try to compile it on VC++ 7.0, the compiler is giving me strange error. Where ever there is a statement like a=22 or name = "abc", the error is reported that the symbol "=" is ambiguous. Can any one tell me whats the problem
|
|
|
|
|
i think it means that "=" has 2 functions in vc7. i only use vc6 so cant test it, but ambiguous means "two meanings" so my theory is that "=" can do 2 things and the compiler isnt sure what you want it to do...i wouls suggest looking it up in msdn if you have it, or if not, its at www.msdn.microsoft.com and get to the msdn libray from there to look it up.
Hope this helps,
Sas
|
|
|
|
|
try to typecast the value you want to assign. Sometimes a number can be of several types (int/long/...) and all those are overloaded. So you have to explicit tell the compiler which conversion to use.
e.g. if your variable a has an overloaded operator= which takes a right hand
type of int and another which takes a long, then you would have to write either a=(int)22; or a=(long)22;
Sure, it won't complain about ints and longs (internal conversion), but other types may need explicit type conversion (strings e.g. can be of many different types: unicode, utf8, chars, BSTR, ...)
|
|
|
|
|
I've only used CFormView so far, and draw the controls directly on the form. Is it possible to put a control on a CView? Theres no place to draw the controls. Or does this have to be done by code like this or something. My question really is do we have to go through the hard work of code, or is it possible to use the ToolBox somehow with the readymade controls?
CButton myButton;
myButton.Create (..);
myButton.MoveWindow(..)
Thanks,
ns
|
|
|
|
|
ns wrote:
My question really is do we have to go through the hard work of code, or is it possible to use the ToolBox somehow with the readymade controls?
If you want to use toolbox, then CFormView is your only option.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Who defines _DEBUG? When there is code that says
catch{
#ifndef _DEBUG
{
DoStuff();
}
#endif
}
does this mean DoStuff() will run only at runtime? Does the _DEBUG definition automatically vanish at runtime? Like if I had DoDebugStuff() within a #ifdef _DEBUG statement , it would run when the code is in debug mode?
Side Question: Does debug mode mean we are working with the project configuration set to Debug?
Thanks,
ns
|
|
|
|
|
ns wrote:
Who defines _DEBUG?
Usually it's in project settings for debug build. #if and friends are used to conditionally *compile* code, so if you don't have _DEBUG defined in your example, there will be no DoStuff call in code at all. It's not checked at runtime.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
So in my release build, #ifdef _DEBUG is ignored and an #ifndef _DEBUG will run ? Or is there something like
_RUN or something that makes code run at runtime thats within #ifdef _RUN execute?
Thanks,
ns
|
|
|
|
|
New to this so this is what I'm thinking it is:
In general CException will catch the errors; to go with 'new' CMemoryException will catch the errors. So if I have code as follows, do I have the right idea?
CAn I go through my code and put a try at the start of all my functions, and catches at the end?
What kind of error would CreateDispatch throw?
Where can you get information on the types of errors that various operations can produce?
_com_error : I havent found this in MSDN. If my MAkeDB function is a VB dll doing database stuff and something goes wrong in it, does the calling VC code get a _com_error?
try
{
CString dataBaseName0 = "C:\\ImagesSep25.mdb";
CString strFile0 = "C:\\Trainer\\final1.pma";
CString imgFolder0 = "C:\\mines4";
char* dataBaseName = new char[dataBaseName0.GetLength() +1];
strcpy(dataBaseName, dataBaseName0);
char* imgFolder = new char[imgFolder0.GetLength() +1];
strcpy(imgFolder, imgFolder0);
char* strFile = new char[strFile0.GetLength() +1];
strcpy(strFile, strFile0);
USES_CONVERSION;
_bstr_t b_dataBaseName = A2W( dataBaseName );
_bstr_t b_strFile = A2W(strFile);
_bstr_t b_imgFolder = A2W(imgFolder);
_CBCreator4 p;
p.CreateDispatch("DBCreator4.Class1");
p.MakeDB(b_strFile,b_dataBaseName,b_imgFolder,CMHandle
delete[] etc
}
catch(CException &e)
{
CString ErrorStr;
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
ErrorStr.Format( " Error\n\tCode = %08lx\n\tCode meaning = %s\n\tSource = %s\n\tDescription = %s\n",
e.Error(), e.ErrorMessage(), (LPCSTR)bstrSource, (LPCSTR)bstrDescription );
#ifdef _DEBUG
AfxMessageBox( ErrorStr, MB_OK | MB_ICONERROR );
#endif
}
catch (CMemoryException &e)
{
CString ErrorStr;
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
ErrorStr.Format( " Error\n\tCode = %08lx\n\tCode meaning = %s\n\tSource = %s\n\tDescription = %s\n",
e.Error(), e.ErrorMessage(), (LPCSTR)bstrSource, (LPCSTR)bstrDescription );
#ifdef _DEBUG
AfxMessageBox( ErrorStr, MB_OK | MB_ICONERROR );
#endif
})
Also I see that they have a MessageBox when errors happen when in Debug mode. In runtime mode, can I put in code in my catch block that does operations with the variables defined in the class or locally defined in the function the catch belongs to? , or do I have to pass them in? Like :
catch (_com_error &e)
{
/#ifndef _DEBUG
<code> m_db.Close(); </code>
#endif
return;
}
Thanks,
ns
|
|
|
|
|
i wrote a FTP application o download file from an ftp folder
Many pupls can upload files in to that FTP folder,and my aplication downloads them in a sepecific interval...
my problem is ,my app try to download the files , even if they are not completly transfered...
How can i determine a particular file is on the Uploading status ie, not uploaded completly in that time...
regards
renjith
---------------------------------------------------------
A Programmer Never Dies..***
|
|
|
|
|
AFAIK this is something your FTP server has to handle. I think mine dont show/offer a file until it's completly uploaded, but I'm not sure on this.
|
|
|
|
|
but here...
when the time of downloading ,the uploaded content at the prensent time will be downloaded...
i tested that with many files with various size...
is there any solution..??
_____________________________________________
A Programmer Never Dies..***
|
|
|
|
|
|
What is FTPD pls explain...........
i duno get any of ur replays.....
can u explain how ..????????
A Programmer Never Dies..***
|
|
|
|
|
ftpd = ftp daemon/ftp server
Maybe name which FTP server you are running, and check Tucows for alternatives.
|
|
|
|
|
Why doesn't this work?
class CMyException : public CException
{
public:
CMyException(int nErr) : CException(TRUE), m_nErr(nErr) {};
~CMyException() {};
int ReportMyError() {
ReportError(MB_OK, m_nErr);
}
private:
int m_nErr;
};
void SomeProcess(bool test)
throw(int, CMyException)
{
if(test) throw CMyException(2);
}
int Main()
{
try
{
SomeProcess(true);
}
catch(CMyException err)
{
err.ReportMyError();
}
return 0;
}
And my error compilation is:
error C2700: 'class CMyException' : cannot be thrown (use -W4 for more info)
If I use Level warning 4, I've got the same message
Thanks in advance
Hello World!!!
from Raphaël
|
|
|
|
|
Try to remove 'throw(int, CMyException)' clause. It doesn't work in VC anyway.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
unfortunately... Nop... The problem is the same....
Hello World!!!
from Raphaël
|
|
|
|
|
Ok, I've got it - your exception class needs a copy constructor. Add the following to CYourException:
CYourException(const CYourException &e) { m_nErr = e.m_nErr; }
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
OK, thanks... It works...
But normaly a class define his default copy constructor (used if no pointer variables are define)
Hello World!!!
from Raphaël
|
|
|
|
|
Raphaël Kindt wrote:
But normaly a class define his default copy constructor
Compiler generates default and copy constructor for you, but only if you haven't created *any* constructor in your class. Since CYourException had an c'tor accepting integer, compiler didn't create default/copy constructors.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Tomasz Sowinski wrote:
only if you haven't created *any* constructor
Quoting Mr. Eckel: "...the compiler will automatically synthesize a copy-constructor if you don’t provide one yourself..."
|
|
|
|
|
You're right on this one. Apparently this rule doesn't apply for VC handling of exceptions thrown by value. Have no idea how does it relate to C++ standard.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Change the Warning Level, maybe more messages will help u debug:
To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click General in the Category box.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|