|
After added the '\r', the new line problem Solved.
Thanks ~
|
|
|
|
|
LRESULT CALLBACK MainProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (uMsg)<br />
{<br />
case WM_MYMESSAGE:<br />
PostMessage(hWnd, WM_COMMAND, MAKELPARAM(IDCANCEL, BN_CLICKED), hWndCancel);<br />
break;<br />
}<br />
<br />
return CallWindowProc(wpPrev, hWnd, uMsg, wParam, lParam);<br />
}
Is it not right?
why some time it happen error?
if use SendMessage, not right?
PostMessage(hWnd, WM_COMMAND, MAKELPARAM(IDCANCEL, BN_CLICKED), hWndCancel);
|
|
|
|
|
Is this a dialog window? If so, call EndDialog(hWnd, IDCANCEL) . If not, post a WM_CLOSE message to the window.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am using MFC Visual C++ 6.0. I have a dialog based app. In the main dialog I can define another dialog such as CInstrument aDlg and then use aDlg.DoModal() to display it. I can do this (on the same lines) with many of the other dialog boxes I have defined in the resource editor, but I have a couple of dialog boxes that give errors instead. One classes DoModal() will give me an illegal operation error while another classes DoModal() gives me a debug assertion error. I created all of these dialog boxes the same way and I am a bit confused as to why these two dialogs would give me errors. I have triple checked the code and can't find anything out of the ordinary. Any ideas as to what might be causing this?
Buck
|
|
|
|
|
There are all sorts of things that could be causing problems.
Post the errors / assertions that you're getting, along with callstacks.
|
|
|
|
|
Sometimes, a "rebuild all" would do the trick....
William
|
|
|
|
|
Visual Studio 6 C++ says "cannot execute program" on my XP machine.
The same Release .exe throws an exeption implicating ntdll.dll when launched outside of Visual Studio.
Debug edition runs OK.
Release edition runs OK on an NT machine.
An intriguing database entry mentions a 'NO_NTDLL' option. Any experience with this?
dahill
|
|
|
|
|
This[^] could help.
Nibu thomas
Software Developer
|
|
|
|
|
dahill wrote: The same Release .exe throws an exeption implicating ntdll.dll when launched outside of Visual Studio.
What is the exception? It sounds like the application hasn't linked properly. Try doing a clean rebuild.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
are you sure to provide all the dll needed with your program ?
you could use dependency walker[^] to see which libs are required by your application to run...
|
|
|
|
|
Hi!
In a window, there are several triangle objects.
I want one of these to blink if I hit a button that is related with.
I don't want to use any MFC etc, only standard c++ and OpenGL.
Is there any good way?
Yonggoo
|
|
|
|
|
Yonggoo wrote: How to make an object blink with OpenGL?
Shine a really, really bright light in its eyes
Seriously though, I think the only way is to add/remove your object to/from the scene at the speed you want it to blink at.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan is correct. OpenGL has no memory of the previous frame, you redraw it each time. Though there are shortcuts for repeated structures to shorten and speed up operations, you are drawing each frame one at a time, so blinking, you basically don't draw it (or draw it with a very dim grey, or don't alternate shining a light on it and away). This provides the blinking.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I need to do something like this
// somefile.h
namespace MyNamespace {
void* operator new ( unsigned int nAllocBytes )
{
return ::operator new( nAllocBytes );
}
};
// mainfile.cpp
int main( void )
{
int *p;
p = ( int* )MyNamespace::operator new( 2 );
delete p;
return 0;
}
But I would like to stick to new's sintaxe, so that I could do:
int main( void )
{
{
using namespace MyNamespace;
p = new int;
delete p;
}
return 0;
}
Anybody knows how?
regards [[]]
hint_54
|
|
|
|
|
Interesting.
One possible approach is typedef.
Kuphryn
|
|
|
|
|
Welcome back, Kuphryn - been a while since you were seen here
Regards,
Nish
|
|
|
|
|
Nice! you remember me!
Kuphryn
|
|
|
|
|
How?
thx
hint_54
|
|
|
|
|
Good point.
This can be done if new became something else. The syntax new cannot be replaced, or at least I have not been able to get the compiler to.
Kuphryn
|
|
|
|
|
I don't know exactly how you want to use your own new operator, but I was thinking about the DEBUG_NEW macro in MFC that is used for tracking memory leaks.
At the beginning of every .cpp file the new operator is #define'd as DEBUG_NEW in order to have a debug version of the new operator, like this:
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#endif
Perhaps this would be a way for your problem as well.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
No. It's not that. I need to add a few bytes to each object "inside" a namespace for pointer reference counting and garbage colecting.
regards [[]]
hint_54
|
|
|
|
|
Do you need to be able to call the old version? If not, just implement your version in the global namespace, and every call to new will go to your new new (!!) method. You can implement new like this:
void *operator new(unsigned int nAllocBytes)
{
return malloc(nAllocBytes);
} Just make sure you overload delete as well, to call free()
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Just a question,
Will this work with class objects. I guess new calls the constructor of classes so that they can be properly initialized. But if you call malloc from new how will that work.
Nibu thomas
Software Developer
|
|
|
|
|
Nibu thomas wrote: Will this work with class objects.
Yes it will. Basically, new is responsible for allocating memory, and the compiler is responsible for calling the constructor. Same with delete - the compiler ensures the destructor is called before delete is.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
yes, it will work, but very badly... in fact it wont always work because malloc() and other C-style memory allocation functions are non-reentrant. so, this can come to some memory leaks...
i just don't understand why you advise him to use malloc() inside his overloaded new.
why not simply using ::new which refers to the global new (the one defined bu the compiler).
|
|
|
|