|
Thank YOU!!!!!!!! I had hInst = hInstance after CreateWindow was called...can you explain to me why it works when put before and not after?
|
|
|
|
|
One of the first tasks CreateWindow do is putting a WM_CREATE message on the queue. This means you probably call LoadIcon in the messagepump before hInst is set to a valid value - it could be anything...
Cheers
/moliate
The corners of my eyes catch hasty, bloodless motion -
a mouse?
Well, certainly a peripheral of some kind.
Neil Gaiman - Cold Colours
|
|
|
|
|
I struct a frustrating problem.
An application that is now in its 7th version and has never exhibited this problem before has suddenly decide to hide behind visual studio if launched from there or explorer if launched from there. Also the taskbar flashes indicating it is inactive.
No changes have been in either the Application's InitInstance or the Create and PreCreateWindow functions of the Main Frame. It is of cause obvious that something has changed in the project somewhere.
Any suggestions as to where I can look will be welcome. The problem seems to 'worst' on XP.
|
|
|
|
|
I'm having a problem deleting objects I've created with the new operator. I have two classes: Particle and ParticleExplosion. ParticleExplosion has:
vector< Particle * > pL
Inside the constructor to the ParticleExplosion class, I make a whole bunch of Particles and put pointers to them in a vector ( pL ):
ParticleExplosion::ParticleExplosion()
{
for( i = 0; i < this->numParticles; ++i )
{
p = new Particle;
pL.push_back( p ); // pL is a vector
}
}
When a ParticleExplosion object gets destroyed (by going out of scope), it's not taking the objects the pL points to with it (which I expected). So, I made my own destructor for ParticleExplosion, where I step through the vector, and delete each item that it poitns to:
ParticleExplosion::~ParticleExplosion()
{
for( int i = pL.size(); i > 0; --i)
{
delete this->pL[i]
}
}
After deleting the first item, the program crashes. Am I going about this the right way?
daniel@jurnove.net
|
|
|
|
|
Why this->pL[i], instead of just pL[i] ? I'd use an iterator to do this, rather than a loop, but I don't think that matters. Actually, I have a functor that I call with for_each that just deletes the pointers in a vector.
I don't see what the problem is, but I'd suggest ditching this - maybe the compiler can't handle this in a destructor.
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
|
|
|
|
|
You need to delete each member like :
class MyClass
{
public:
MyClass();
~MyClass();
int m_iIndex;
};
std::vector<MyClass*> myClassVector;
for (int i = 0 ; i < 10; i++ )
{
MyClass* p = new MyClass();
myClassVector.push_back(p);
}
std::vector<MyClass*>::iterator it = myClassVector.begin();
while ( it != myClassVector.end() )
{
delete (*it);
++it;
}
Max.
|
|
|
|
|
Hello,
I just installed Visual studio installer.. I created my package and it works fine, I created a short cut in START->Programs->MyApp->MyApp.exe except that I can't find any way to set the "Start in" field for the shortcut.. my program depends on some ini's that are in the same folder as the main.exe.
Any ideas?
|
|
|
|
|
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
|
|
|
|