|
Ya know how the date control pops a calendar?
And how the combo control pops a listbox?
How do I make a control like a tree control or multiline edit control
pop from a button press or static click?
Should I put the tree control in a dialog and bring up the dialog
upon a button press?
Or should I just dynamically create a tree control?
On the one hand, I don't want a dialog border if possible, but
I also don't want the tree control to get clipped.
And I'd like the popup tree control to go away once the mouse is
outside it's rectangle.
Can any of you ole hands at the win32 api tell me which messages to
listen to, etc? And whether to pop a dialog with control or just
the control?
And what should I listen to to tell if the popped control needs to
go away?
If you can point me to a specific demo project here on codeproject,
that'd be cool. But I've been thru most of em and they all have
funky things about them that don't behave nicely...:/
Any help you can lend will be MUCH appreciated
...Steve
|
|
|
|
|
This might be a simple question but it seems I can't find the answer with the online help.
I just upgraded from Visual C++6 to Visual .net pro. I am only using the C++ compiler for the time.
I can't find the equivalent of the profiling tool allowing for the timing of functions. (the purpose being to optimize). This is a basic requirement when coding so I assume that it still exists in the new version.
Thanks for any feedback
Eric
|
|
|
|
|
Actually no. Visual C++ .NET and Visual Studio .NET do NOT ship with a profiler. However, there is a coupon in the box that enables you to download a trial version of a Compuware profiler.
We're trying to figure out how to get a decent profiler back in the box -- I'm certainly aware that profilers are a core tool for C++ devs. But the one that used to ship with Visual C++ was deemed insufficient to work with Visual C++ .NET and we decided to abandon it.
Sorry - I know this isn't the ideal situation for you.
Nick Hodapp
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Thanks Nick for the quick response!
It's nice to see some MSFT people looking at forums.
I am also sad to find out about the missing profiler. Despite the fact that the Visual C++6 profiler was not too great, it was nevertheless usefull to quickly find out bottlenecks. I have uploaded the Compuware profiler community edition. I hope this will do the trick.
Note that I am working on my own tool to post-process computational fluid dynamics results (10+ millions triangles on cut surface displayed with OpenGL). Optimizing is therefore very important.
I sincerely hope that some kind of profiler will be added later on to the studio tools.
I would also add to the list of features: openMP for C++ ... which is much easier to use for parallel processing than the threads.
I know that Intel C++ has it. Is this compiler compatible with the MFC libraries and visual .net environment?
Thanks
Eric
|
|
|
|
|
I get linker errors when I try to do this, do I have to use a #pragma or something?
#include <iostream.h>
#include <afx.h>
int main()
{
CString c;
return 0;
}
Error:
--------------------Configuration: test - Win32 Debug--------------------
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/test.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
test.exe - 3 error(s), 0 warning(s)
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 are using MS Visual Studio, go change your project setting to "Use MFC in a Shared DLL."
|
|
|
|
|
Boogie wrote:
If you are using MS Visual Studio, go change your project setting to "Use MFC in a Shared DLL."
Ah, that works fine, but is there a way to do this directly in code alone so the setting is still listed as "Not Using MFC"? Thanks for the response by the way.
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 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
|
|
|
|