|
What do you mean by "a cleaner way?"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'm still unclear as to what you are asking.
http://www.codeproject.com/dll/[^]
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
As in make the Code shorter more proffesional or more appealing ?
I cant think of another shorter method to do this.
I cant use Class Items like stated on the link you send me.
|
|
|
|
|
Given that it's hard to tell what your code is even doing, it's impossible for me to offer any suggestion(s). Does it solve the probem it was meant to solve? If so, why are you wanting to mess around with it? If not, what are you using to confirm its inefficiency?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
is there any wrong in the fallowing code bcoz it cannot found file
CFile LogFile("E:\\log.txt",CFile::modeCreate||CFile::modeWrite||CFile::modeNoTruncate||CFile::typeText);
LogFile.SeekToEnd();
LogFile.Write(fname,sizeof(fname));
LogFile.Close();
where fname is of type CString.
|
|
|
|
|
CFile LogFile("E:\\log.txt",CFile::modeCreate||CFile::modeWrite||CFile::modeNoTruncate||CFile::typeText)
The problem is ||
Do this :
CFile LogFile("E:\\log.txt",CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate | CFile::typeText)
Bonne chance
|
|
|
|
|
softtec wrote:
CFile LogFile("E:\\log.txt",CFile::modeCreate||CFile::modeWrite||CFile::modeNoTruncate||CFile::typeText);
Given that you used || instead of | , the second parameter is evaluating to 1, which is the same thing as CFile::modeWrite . That's why the file does not get created.
Also, the CFile::typeText flag is ignored with CFile objects. It's used with derived classes only.
softtec wrote:
LogFile.Write(fname,sizeof(fname));
This should be LogFile.Write(fname, fname.GetLength() * sizeof(TCHAR)) instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
If you are using CString for fname, you should not use sizeof for the length. You should use fname.GetLength().
onwards and upwards...
|
|
|
|
|
I have download a demo console applic. from this site,but I want to add it to my project(console applic.) as a class
|
|
|
|
|
Ok, so what do you need help with?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can I add this console app. to my project as a class????!!!!
|
|
|
|
|
There is no one-to-one correlation between a file/app and class. A class should be thought of as an autonomous object. You will need to go through the application, probably several times, and figure out what parts can be put into their own class. You may end up with one large class (hopefully this won't be the case as large classes are unproductive), or you may end up with dozens of smaller classes.
As a very primitive example, how would you turn the following application into one or more classes:
#include <stdio.h>
void main( void )
{
printf("Hello World\n");
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
david told the most, but you could do this.
is the source is well written, it is probable that its author put his class declaration into a whole header file (h, hpp, hxx, hh), and the implementation into a module file (cpp, cc, cxx).
if so, just import those 2 files into your workspace (VC++6) or project (VC++7 and later)
if he didn't, extract the classe by yourself and paste it into a new file of your own in your solution (but i doubt you'll have to do that).
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
there are 3 header files
and 2 module files(.cpp)
how can I import these files to my workspace(I'm using VC++ 6)
|
|
|
|
|
you copy the files into the directory your source files are created (into windows explorer).
then, you go into your workspace (workspace tab), and right click the project item -> add existing files to project... and choose the files you've just copied...
the header will appear in the header folder, and the c files in the source folder...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
can a dynamically created variable hold a const value? if so,how can that be declared?
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
i think you will need to wrap your value in a class ( or maybe a template of some sort ) with a overriden operator;
something like :
class myValue
{
public:
myValue( int value ) : m_Value( value ) {};
int getValue( return m_Value;};
private:
const int m_Value;
};
or after thinking about it, maybe something like :
const int* pInt = new int(3);
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
To create a const *, you can put const in two places,
const char *
char * const
You can do both. One says you can't change the memory address the pointer points to, the other says you cannot change it's contents.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
While we're on the subject, Christian, what is the difference between these two. (I always get them backwards!)
abc(CString& const );
def(CString const& );
|
|
|
|
|
Tom Archer wrote:
abc(CString& const );
This one is pointless. You can't declare a "const reference" because a reference is already const.
Tom Archer wrote:
def(CString const& );
This is a reference to a const CString.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
What does this one mean?
ghi(const CString&);
|
|
|
|
|
It too is a reference to a const CString . In other words, the following are equivalent, just different styles:
const CString &str;
CString const &str;
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi All,
This is an existing paragraph formatting for bullet
pf=GetParaFormatSelection();
pf.dwMask = PFM_NUMBERING | PFM_STARTINDENT;
pf.wNumbering = PFN_BULLET;
pf.dxStartIndent = 300;
SetParaFormat(pf)
Like this I would like to create own paragraph formatting.For example"<>".
Thanks,
|
|
|
|
|
I have the handlers and message maps as below.
Whenever a child window is visible the following hanldler and its update function is not invoked.
When the Child window is closed they are invoked..
Can anyone explain this behaviour.
ON_COMMAND(ID_VIEW_DRAWTOOLBAR, OnDrawToolBar)
ON_UPDATE_COMMAND_UI(ID_VIEW_DRAWTOOLBAR, OnUpdateDrawToolBar)
void CMainFrame::OnDrawToolBar()
{
if (m_bUICtrlBar)
{
m_bUICtrlBar = false;
ShowControlBar(&m_UICtrlsBar, m_bUICtrlBar, false );
}
else
{
m_bUICtrlBar = true;
ShowControlBar(&m_UICtrlsBar, m_bUICtrlBar, false );
}
}
void CMainFrame::OnUpdateDrawToolBar(CCmdUI *pCmdUI)
{
if (m_UICtrlsBar.IsVisible())
m_bUICtrlBar = TRUE;
else
m_bUICtrlBar = FALSE;
if (m_bUICtrlBar)
{
pCmdUI->SetCheck(TRUE);
//AfxMessageBox("visible so check");
}
else
{
pCmdUI->SetCheck(FALSE);
//AfxMessageBox("Invisible so Uncheck");
}
}
laiju
|
|
|
|