|
To Read Data, use CFile or CStdioFile class.
For more information try msdn library.
Importing it into your own designed table completely depends on the way you have designed the table.
Anurag Gandhi.
|
|
|
|
|
To read data, use ifstream whenever possible.
Depends what you mean by table, in a database ? Then it depends on how you're getting DB access.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
What does the following code do?????????
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
NT
|
|
|
|
|
if _DEBUG has been defined elsewhre, it defeines DEBUG_NEW and undefines THIS_FILE, then sets it to the current file namae. It's not C++, it's nasty C preprocessor stuff. Avoid if you can.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hence he has also to avoid the MFC Application Wizard!
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.
|
|
|
|
|
Christian Graus wrote: it's nasty C preprocessor stuff. Avoid if you can
Maybe, but it's really handy for debugging MFC apps
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
For debug builds, it tells the compiler to use the crt debug "new" operator instead of the normal
one. The debug version adds leak detection and maybe some other stuff.
It also, as metioned, sets the THIS_FILE define to the current file. This information
is used when dumping memory leak info.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
When i derive a class from CWinThread from wizard its constructor and destructor are in protected. So i have to put them in public so as to create an object for that.
When the class is created why they are in protected as we cannot create an object?
Thank you
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: When i derive a class from CWinThread from wizard its constructor and destructor are in protected. So i have to put them in public so as to create an object for that.
There's no need to since you don't create CWinThread derivatives that way: they are always created with a call to ::AfxBeginThread() and a opinter to the running instance is returned.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: There's no need to since you don't create CWinThread derivatives that way: they are always created with a call to ::AfxBeginThread()
But I can create a thread using the CWinThread::CreateThread() also. In that case we need an object right?
nave
|
|
|
|
|
Naveen R wrote: But I can create a thread using the CWinThread::CreateThread() also. In that case we need an object right?
Not quite.
Have a look at the arguments for CWinThread::CreateThread() . You have no way of specifying whether the thread is supposed to be a worker thread or a UI-thread. You specify this in the call to ::AfxBeginThread() .
MSDN on CWinThread::CreateThread: Use AfxBeginThread to create a thread object and execute it in one step. Use CreateThread if you want to reuse the thread object between successive creation and termination of thread executions.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: Have a look at the arguments for CWinThread::CreateThread()
That wasnt our discussion point Roger. you said we have no use creating a CWinthread object. But for this function, it needs a CWinThread object.
And about the GUI/Worker thread....who wants a worker thread using the CWinThread?
nave
|
|
|
|
|
Naveen R wrote: That wasnt our discussion point Roger. you said we have no use creating a CWinthread object. But for this function, it needs a CWinThread object.
Please read my post again and you will find I wrote that the CWinThread object is created with a call to ::AfxBeginThread() . Thats the way to create the object, it's also clearly stated by the MSDN documentation. This is also why the wizard doesn't declare the constructor as public, which was the OP's question from the beginning.
I have never implied that the CWinThread object doesn't need to be created.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Interesting. I personally have never used the AfxBeginThread() function. I always use the
two step method. Fits into my code better
"Use AfxBeginThread to create a thread object and execute it in one step. Use CreateThread if you
want to reuse the thread object between successive creation and termination of thread executions."
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank you
Roger Stoltz wrote: they are always created with a call to ::AfxBeginThread()
So, Is it a bad practive deriving a class from CWinThread and calling CreateThread().
I have been doing like that.
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: So, Is it a bad practive deriving a class from CWinThread and calling CreateThread()
Let's just say that from the MFC framework point of view you're supposed to use ::AfxBeginThread() . This is also why the constructor is not publically declared in the CWinThread dervied class created by the wizard.
Doing it the way you have been doing it will work; it will spawn a UI-thread.
But you have to alter the CWinThread derived class to make the constructor public. You will also need to write the error handling that ::AfxBeginThread() would help you with, such as freeing up memory.
I recommend you to follow the MSDN guidelines on this: use ::AfxBeginThread() .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
kiran.pinjarla wrote: CWinThread from wizard its constructor and destructor are in protected
You are supposed to use CWinThread derived class, hence it is protected.
-- modified at 4:49 Tuesday 22nd May, 2007
See Rogers reply.
Prasad
MS MVP - VC++
|
|
|
|
|
prasad_som wrote: You are supposed to use CWinThread derived class, hence it is protected.
What do you mean Prasad?
The wizard creates a CWinThread dervative and its constructor is protected because the CWinThread object is created with a call to ::AfxBeginThread() which uses CRuntimeClass for creating the object. E.g.
CMyThread* pThread = ::AfxBeginThread( RUNTIME_CLASS( CMyThread ) );
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Roger Stoltz wrote: What do you mean Prasad?
It means, I'd jumped in the discussion, without reading it carefully. My bad.
And replied in just C++ context.( why there should be protected c'tors ? and blah ,blah , )
Thanks for correcting me.
Prasad
MS MVP - VC++
|
|
|
|
|
prasad_som wrote: It means, I'd jumped in the discussion, without reading it carefully. My bad.
And replied in just C++ context.
No worries mate!
Been there, done that. Cheers
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi.
I am really confused why the layout on an English version and that from anotehr OS (Chinese etc) would display differently. THe other OS would display everything in a smaller area than teh ENglish OS leaving more empty space.
In the CformView dialog, I made sure that the FOnt size and type (10, MS Sans Serif - should be on all computers) are common so that the layout as I would see it on my computer "should" be what someone would see it on another computer.
I know I ma definitely missing something. Can someone help and give a few hints on how to deal with this?
Thanks in advance!
Stan the man
|
|
|
|
|
Hi,
how did you create your font?
There is two possibilities that more or less "ensures" you compatibility
BOOL CreatePointFont( int nPointSize, LPCTSTR lpszFaceName, CDC* pDC = NULL );
but here the "int nPointSize" can depend on the MAPMODE, is not the same MM_TEXT as MM_LOMETRIC (for example)
The other one (from Roger Allen's http://www.codeproject.com/printing/printingtricksandtips.asp[^])
CFont font;
LOGFONT lf;
::ZeroMemory (&lf, sizeof (LOGFONT));
lf.lfHeight = -MulDiv (12, pDC->GetDeviceCaps (), 72);
strcpy (lf.lfFaceName, "Arial");
if it works for printers, it should work for displays too.
EDIT:
I found this article.
http://msdn2.microsoft.com/en-us/library/d8ws31ff(VS.71).aspx[^]
I hope it helps
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?
|
|
|
|
|
Hello,
In the InitInstance function there is statement by default.
if (!pFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
now instead of IDR_MAINFRAME I made another menu IDR_PLAN and loaded this frame instead of IDR_MAINFRAME.
When I execute the application I get debug assertion failure.If I Ignore the error I get my menu and I can continue with the application.
How do I get rid of this debug assertion failure?
If I want a particukar menu option to be grayed or to be active in a frame .How do I go about doing it ?
A different menu has to be made for grayed menu option and a different menu for the same menu option when it is active has to be made.And they have to be chosen whenever that particular event occurs. Is it?
Thanks
Pritha
|
|
|
|
|
This is how I am controlling the Menu Bar from the View Class Window. I hope this will help you.
void CMyApplicationView::OnFormatWordwrap()
{
// TODO: Add your command handler code here
CMenu* pMenu; // Create a pointer to the current menu.
CWnd* pParent = GetParent();
pMenu= pParent->GetMenu(); // Get the menu.
CWaitCursor wait;
if (pMenu->GetMenuState(ID_FORMAT_WORDWRAP, MF_CHECKED))
{
SetWordWrap(FALSE);
pMenu->CheckMenuItem(ID_FORMAT_WORDWRAP, MF_UNCHECKED);
}
else
{
SetWordWrap(TRUE);
pMenu->CheckMenuItem(ID_FORMAT_WORDWRAP, MF_CHECKED);
}
}
The code is self explainatory.
Please try to be specific in asking question if you want exact solution.
Anurag Gandhi.
Bangalore, India.
|
|
|
|