|
I am not sure about that. CString is a MFC class. That's the reason I ask you to change the project setting. Your other option is to use char type.
Maybe someone else can help you.
|
|
|
|
|
Boogie wrote:
Your other option is to use char type.
I know I can use other data types to do this, however I wanted to do this specifically with a CString . Thanks for the input.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
If you want to use CString but not MFC, I use the excellent CStdString[^] class which is an exact clone of CString but using stl.
Cheers
James
|
|
|
|
|
James Spibey wrote:
which is an exact clone of CString but using stl.
Thanks James, I will take a look at it today.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
I want to check for a certain condition when a user selects to drop down a box. If that condition is not met I want to display an error message and then NOT display the drop down.
Does anybody have any ideas on how to do this? I have tried everything I can think of. I have the error message and all of that but after the user selects ok on the message the box drops down with nothing in it.
Anybody?
|
|
|
|
|
Check out ON_CBN_DROPDOWN
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I've added the CBN_DROPDOWN, but I don't know how to say "quit".
|
|
|
|
|
I'm not certain without trying, but I would think it would work something like this...
case CBN_DROPDOWN:
if(!ShowTheDropList) return;
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
hello,
does the possibility exist to convert hexadecimal in integer?
thanks,
mfc
|
|
|
|
|
Yes. In what context ? You can do this:
int n = 0x0BADF00D;
you can also use iostreams to display a number of any format as any other, my ostringstream article shows how.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
thank you for your reply!
i have hexadecimals in a string and i need them as integer numbers.
how can i get it?
thanks,
mfc
|
|
|
|
|
sscanf[^] appears to be what you're looking for.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
sorry i forgot:
thank you very much.....great...
|
|
|
|
|
Discription: MFC application using Foward Declare.
What the program is Suppose to do:
Pressing the left mouse button calls m_CGoHereFirst.Funct1();
located in the class CGoHereFirst().
It Prints: "1st: Var = 5", which works fine.
It then calls m_CGoHereSecond->Funct2(); located in CGoHereSecond().
It is suppose to print "2nd: Var = 5", however I get the Error message;
"This program has performed an illegal operation and will be shut down"
Why is the second print message causing an Error?
How do I fix the problem?
Important header and cpp functions listed below:
HEADER FILE INFO:
CGoHereFirst.h:
class CGoHereSecond; // Part of 2nd Foward Declare
class CGoHereFirst : public CWnd
{
// Implementation
public:
CGoHereSecond *m_CGoHereSecond; // Part of 2nd Foward Declare
int Var;
void Funct1();
virtual ~CGoHereFirst();
};
CGoHereSecond.h: Forward Declare
class CGoHereFirst; // Part of 1st Foward Declare
class CGoHereSecond : public CWnd
{
// Implementation
public:
CGoHereFirst *m_CGoHereFirst; // Part of 1st Foward Declare
void Funct2();
virtual ~CGoHereFirst();
};
Foward_Declare.h:
// Implementation
public:
CGoHereFirst m_CGoHereFirst;
MEMBER FUNCTIONS:
void CForward_DeclareView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_CGoHereFirst.Funct1();
CView::OnLButtonDown(nFlags, point);
}
#include "GoHereSecond.h" // Part of 2nd Foward Declare
void CGoHereFirst::Funct1()
{
Var = 5;
CString a;
a.Format("1st: Var = %d", Var);
AfxMessageBox(a);
m_CGoHereSecond->Funct2();
}
#include "GoHereFirst.h" // Part of 1st Foward Declare
void CGoHereSecond::Funct2()
{
CString b;
b.Format("2nd: Var = %d", m_CGoHereFirst->Var);
AfxMessageBox(b);
}
|
|
|
|
|
Hey all,
I have a strange problem with an exception being thrown and not caught properly. The exception is of the CDBException type and the code looks like the snippet given below. If I give an erroneous sql statement, an exception is thrown and caught, but when I leave the END_CATCH (or END_CATCH_ALL for that matter), the program crashes. This only occurs in release mode - debug mode is trapping and continuing fine. Sounds like I'm running rampage in my mem region, but I'm fairly sure I'm not...Any help on this will be mighty appriciated.
CRecordset* pRecordset = NULL;
TRY
{
BOOL bIsRecordPresent = FALSE;
//make the recordset
pRecordset = new CRecordset( &m_Database );
//open it
if (pRecordset->Open(CRecordset::snapshot, szSQLIsPresent, CRecordset::readOnly))
{
...
}
}
CATCH(CDBException, eDB)
{
char bufErr[512];
eDB->GetErrorMessage(bufErr, 512, NULL);
eDB->Delete();
//error reporting
}
CATCH(CMemoryException , e)
{
char bufErr[512];
e->GetErrorMessage(bufErr, 512, NULL);
e->Delete();
//error reporting
}
END_CATCH
Best regards
/Boris
|
|
|
|
|
Found it - The exception clean up of CDBException 'eDB->Delete();' throws a new exception.
Have no idea why
/Boris
|
|
|
|
|
is there any api that tell the name of currently
login user ?
is there any api that tell the status of the os?
i mean to say that wheather the system is in logof aur login state?
r00d0034@yahoo.com
|
|
|
|
|
GetUserName will give you the name of the user that is currently logged in
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
how to start a process ? and get its id ?
how to process active window hwnd ?
r00d0034@yahoo.com
|
|
|
|
|
What on earth do you mean by
imran_rafique wrote:
how to process active window hwnd ?
How do you WANT to process it ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I have a property sheet (CPropertySheet ) with 2 property pages (CPropertyPage ).
So, the problem is that when I click on the second page (change to the second page) this page will not get the focus! I have to click on any control on this page (or with the tab key) to get the focus!
How can I fix that?
(I am working with Embedded Visual C++, PocketPC / PocketPC 2002, MFC)
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Is your Layout > Tab order set correctly so that the first item in the tab order is a control and not static text or something like that?
|
|
|
|
|
Yes! There is only one tree control (CTreeCtrl ) with 3 buttons on the property page and the tree control is the first element in the tab order!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I can assume CRT functions would probably out perform my own for loop functions...?
The idea is this:
I have a buffer[0xFFFF] I wish to iterate the buffer looking for sequences of characters (carriage returns).
Currently I have something like:
for(int i=0; i<MAX_BUFF_SIZE && m_nLines < iLine; i++)
{ if(buffer[i] == 13) m_nLines++; }
It occurred to me that this can also be accomplished using CRT functions, which I thought are probably tweaked as tweaked can get...so I should probably use that implementation instead of the above...???
If you know if the CRT would out perform lemme know and if you wanna profile for me or check out the assembly dump and compare instructions, by all means please do so...
Save me alot of time...or if your just damn sure that CRT would be faster...lemme know...
Thanx a million
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I doubt strchr will help much. In fact, it might hurt if you make the following optimization to your routine.
if (m_nLines < iLine)
{
for (int i = 0; i < MAX_BUFF_SIZE; i++)
{
if (buffer [i] == 13)
{
m_nLines++;
if (m_nLines >= iLine)
break;
}
}
}
Now, you might get some improvement with using memchr.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|