|
Hi guys
I am receiving WM_ERASEBKGND in my app's main window event handler. However, i can't find what is in fact sending this event. I know that this may be sent by BeginPaint, when InvalidateRect's last argument is set to true. But, all of InvalidateRect calls in my app are called with false as the last argument, so i know that this is not the case.
Do you know any other functions/cases that are causing WM_ERASEBKGND to be sent to the app?
BR
dwk
|
|
|
|
|
Are you doing anything that makes the system mark the window
for repainting, like resizing the window, dragging another window
across it, etc??
If the window is just sitting there, you shouldn't be getting random
WM_ERASEBKGND messages.
Note that any WM_ERASEBKGND handler should return non-zero if
background erasing was handled.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm following along with tutorials from www.directxtutorial.com[^] and have succesfully gotten a d3d window up and running. The next section of the tutorial covers running the app in fullscreen, without a title bar or an exit button, requiring changes to be made. One of these changes is the inclusion of a KEY_DOWN and KEY_UP macro, allowing me to check the state of any key. This is implemented so that there is a means of closing the app, using the escape key, however upon pressing the escape key, nothing happens. If I change the line if(KEY_DOWN(VK_ESCAPE)) to if(KEY_UP(VK_ESCAPE)) then the app will exit instantly. Can anybody explain what is happening or what might be causing it?
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)<br />
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
SNIP!<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
<br />
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(msg)<br />
{<br />
case WM_CLOSE:<br />
DestroyWindow(hWnd);<br />
break;<br />
case WM_DESTROY:<br />
Cleanup();<br />
PostQuitMessage(0);<br />
return 0;<br />
case WM_PAINT:<br />
Render();<br />
ValidateRect(hWnd, NULL);<br />
<br />
if(KEY_DOWN(VK_ESCAPE))<br />
PostMessage(hWnd, WM_DESTROY, 0, 0);<br />
return 0;<br />
}<br />
return DefWindowProc(hWnd, msg, wParam, lParam);<br />
}
-- modified at 10:02 Thursday 4th October, 2007
|
|
|
|
|
Sauce! wrote: Can anybody explain what is happening or what might be causing it?
Yes, you can by debugging it and checking the value returned from GetAsyncKeyState()
|
|
|
|
|
unfortunately, I cannot compile in debug as I get errors. I will post these tomorrow. I have been searching about for an article I had a while back that details some of the errors that can occur between a debug or release build and how to fix them, but I've had no luck with that.
|
|
|
|
|
Sauce! wrote: I have been searching about for an article I had a while back that details some of the errors that can occur between a debug or release build and how to fix them, but I've had no luck with that.
Perhaps it was this one.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
YES! Thankyou!
<3 <3 <3 <3 <3
|
|
|
|
|
If we declare a function pointer as
typedef void (*myPtr)(void);
myptr NewPtr;
This means that NewPtr is a function pointer of type myptr, where myptr is inturn a function pointer to a function which returns void and takes no function parameters.. then what does the below piece of code mean?
Can somebody please interpret this piece of code for me?
typedef NTSTATUS (NTAPI *pfnNtQueryInformationProcess)(
IN HANDLE ProcessHandle,
IN PROCESSINFOCLASS ProcessInformationClass,
OUT PVOID ProcessInformation,
IN ULONG ProcessInformationLength,
OUT PULONG ReturnLength OPTIONAL
);
pfnNtQueryInformationProcess gNtQueryInformationProcess;
Thanx
-- modified at 9:07 Thursday 4th October, 2007
|
|
|
|
|
exactly the same as your code, at the difference that the pfnNtQueryInformationProcess is a typedef to a function pointer to a function which returns a NTSTATUS and gets as parameters a HANDLE, a PROCESSINFOCLASS, a PVOID, an ULONG, and a PULONG...
then you declare a variable gNtQueryInformationProcess of that type so defined...
what don't you understand in this ?
|
|
|
|
|
Then it should have been declared as
typedef NTSTATUS (*pfnNtQueryInformationProcess)(
IN HANDLE ProcessHandle,
IN PROCESSINFOCLASS ProcessInformationClass,
OUT PVOID ProcessInformation,
IN ULONG ProcessInformationLength,
OUT PULONG ReturnLength OPTIONAL
);
pfnNtQueryInformationProcess gNtQueryInformationProcess;
What is this NTAPI in between? What is its signifance?
Thanx
|
|
|
|
|
kiranin wrote: What is this NTAPI in between
it is the calling convention... see how it's defined if that interrest you, but it's probably one of these : __stdcall, __fastcall, __cdecl, __thiscall...
|
|
|
|
|
hm.. yeah dats rite.. its a calling convention.. herez the piece of code frm winnt.h
#if ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)) && !defined(_M_AMD64)
#define NTAPI __stdcall
#else
#define _cdecl
#define NTAPI
#endif
Thanx
|
|
|
|
|
pfnNtQueryInformationProcess is a function pointer to a function that returns NTSTATUS , has an NTAPI calling convention, and takes five arguments.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I am busy testing the use of minidumps, but I received this messge
Debugging information for @project 1.exe' cannot be found or does not match.
Binary was not built with debug information.
I am well aware of how to do it in Visual Studio
You can use the following options:
Compiler: /Zi (/Z7 and /ZI can also be used in some cases - see their documentation for more information)
Linker: /debug (in release builds also use /opt:ref option)
All these options can be set in the IDE.
My question is, how can I do it in Borland Developer Studio 2006 ??
Can anyone please help me ??
Many thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi All,
I am doing project in VC++ 6.0 in which i am displaying tabs on the window area.I want to load a particular page whenever user click on particular tab.These tabs are created at run time.So how can I identify which tab is clicked by user.If anybody know the solution of this, then please forward it me.
Thanks in Advance
Atul
|
|
|
|
|
you wil recieve a TCN_SELCHANGE message when user changes the tab item.
|
|
|
|
|
Atulmahajan wrote: So how can I identify which tab is clicked by user.
Check out the PSN_SETACTIVE notification.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Does anyone knows if
in file.h
namespace MyNamespace{
...
enum MyEnum{
...
EnumItem,
....
};
...
};
then in file.cpp
using namespace MyNamespace;
...
foo(MyNamespace::MyEnum::EnumItem, ..);
or
foo(MyEnum::EnumItem, ..);
...
gives error C2825 and error C2275 in the first case
and
gives error C2039 in the second case
It doesn't work also if I remove the line using (of course then using extended variable usage)
can it be related to a bug of the compiler in VS2003? I'm quite sure that I'm not wronging the code sintax.
Russell
|
|
|
|
|
Hmm. This
namespace MyNamespace{
enum MyEnum{ EnumItem,SecondItem };
};
int _tmain(int argc, _TCHAR* argv[])
{
MyNamespace::MyEnum firstItem = MyNamespace::MyEnum::EnumItem;
MyNamespace::MyEnum secondItem = MyNamespace::MyEnum::SecondItem;
return system("pause");
} gives a warning C4482: nonstandard extension used: enum 'MyNamespace::MyEnum' used in qualified name with VC 2005.
That is meaning that enums are second class citizens and the correct way of refering them would be:
MyNamespace::MyEnum firstItem = MyNamespace::EnumItem;
MyNamespace::MyEnum secondItem = MyNamespace::SecondItem;
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
yes!
you are right.
I found only now your same conclusion.
thank you
Russell
|
|
|
|
|
Sorry,
looks solved:
this is a wrong usage
MyNamespace::MyEnum var=MyNamespace::MyEnum::EnumItem
this is correct
MyNamespace::MyEnum var=MyNamespace::EnumItem
Russell
|
|
|
|
|
i am using list control in report view and want to color the header of that list control, how this is done
malik
|
|
|
|
|
AFAIK either you need to owner draw it or Custom draw( LVN_CUSTOMDRAW ) it.
|
|
|
|
|
custom draw is only way to do so.. for that you have to subclass CListCtrl
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hi
I need to call the following function somewhere in a program:
void __fastcall TFormMain::btnUpdateClick(TObject *Sender)
{.....}
This is the event of mouse-click on a button.
How can i call this function in the program itself (which otherwise gets called on 'mouse-click'??
|
|
|
|