|
Mike Dimmick wrote: __int64 val = __rdmsr(0xe2);
val &= 0xBFF7;
__writemsr(0xe2, val);
I think, a minor adjustment is required for Mike's code in order to protect high order 48 bits.
<br />
__int64 val = __rdmsr(0xe2);<br />
val &= 0xffffffffffffbff7;<br />
__writemsr(0xe2, val);
High order bits should remain unchanged as in the original code below.
__asm {<br />
MOV ECX, 0E2h<br />
RDMSR<br />
AND AX, 0BFF7h<br />
WRMSR<br />
}
|
|
|
|
|
Maxwell Chen wrote: x64 code which does not allow inline assembly
It seems silly that they took it away as an option.
Is that just Microsoft taking inline assembly away or is that for most 64-bit compiler manufacturers?
|
|
|
|
|
Inline assembly is a real pain for the C++ parser. Consistently across all non-x86 compilers, they've been stripping it out. If you need to use assembly, use an assembler to assemble a whole function and call that.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
how to set opacity of image between 0-255 by using gdiplus.
Trioum
|
|
|
|
|
|
create a colormatrix object and set the appropriate values.
then set this matrix to the imageattributes object and then pass this object to drawimage().
Prasann
who else
|
|
|
|
|
Or you can use of CImage::AlphaBlend.
|
|
|
|
|
here is the problem, when i execute the app, the function connect doesnt return an error when the NIC is disabled. It just returnt 0, as if there is no error.
I am using C++
Does anyone have an idea why?
|
|
|
|
|
The question below is really an ugly question in a quiz. I run the code but don't know why, please explain clearly. Thanks in advanced.
#include <iostream>
using namespace std;
class A
{
public:
int adata;
A(int a) : adata(a)
{}
void fun1(){ cout<< "A::fun1" <<endl;}
virtual void fun2() {cout<< "A::fun2" <<endl;}
};
class B : public A
{
public:
int bdata;
B(int a, int b) : A(a), bdata(b)
{}
void fun1() { cout<< "B::fun1"<<endl;}
virtual void fun2() {cout<< "B::fun2" <<endl;}
void fun3() { bdata = 3; bdata++; cout << "bdata = "<<bdata <<endl;}
};
void printB1(B *pb)
{
pb->fun1();
}
void printB2(B &b)
{
b.fun2();
}
void printB3(B b)
{
b.fun2();
}
int main(void)
{
A a(0);
B *pb1 = (B *)&a;
pb1->fun1();
pb1->fun2();
pb1->fun3();
cout<< "=========================="<<endl;
A *pa = new A(3);
printB1((B *)pa);
printB2((B &)a);
delete pa;
return 0;
}
</iostream>
|
|
|
|
|
fantasy1215 wrote: //really don't know why could downcast like this?
Simple, because you can, this however doesn't mean you should.
This is a post fitting to be posted in the horror forum.
<code>A a(0);</code>
no problem creating an A object on the stack
<code>B *pb1 = (B *)&a;
Argh, creating a pointer to a B object on the stack and assign it the address of the A object
<code>pb1->fun1();</code>
this should work -> "B::fun1"
<code>pb1->fun2();
this should work also -> "B::fun2"
<code>pb1->fun3();
The hell has just opened up and corrupted the stack arround the A object
by the the execution of <code>bdata = 3; bdata++;</code>
return 0;
codito ergo sum
|
|
|
|
|
fantasy1215 wrote: I run the code but don't know why, please explain clearly
what's the why?
|
|
|
|
|
Is there any notification or a message that is broadcast when a wireless network is established?
Thank you,
AJ
|
|
|
|
|
|
I want to know the different among them.which order is excuted?
|
|
|
|
|
WM_QUIT[^] WM_DESTROY[^] WM_CLOSE[^]
xqhrs232 wrote: which order is excuted?
"You can use the DestroyWindow function to destroy a window. Typically, an application sends the WM_CLOSE message before destroying a window, giving the window the opportunity to prompt the user for confirmation before the window is destroyed" from msdn
so normally First WM_CLOSE, then default handler calls DestroyWindow which sends WM_DESTROY, WM_DESTROY handler typically calls PostQuitMessage which sends WM_QUIT to terminate the message loop.
|
|
|
|
|
Why not set a breakpoint in each one, or add some sort of debug/trace message to find out?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My thoughts exactly. Not only is it more satisfying to figure things out for yourself, it also usually provides a better understanding of the problem/solution.
Nowadays people seem to prefer spamming the message boards with trivial questions...
"It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
--Groucho Marx
|
|
|
|
|
Michael Schubert wrote: "It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
--Groucho Marx
This same quote has been attributed to Abraham Lincoln, Mark Twain, and Benjamin Franklin.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Damn, should have done some research before...
"It is better to remain silent and be thought a fool, than to open your mouth and remove all doubt."
--Groucho Marx
|
|
|
|
|
That is what I made when I started with MFC, open the assistant in an empty programm and put AfxMessagesBox'es to see the order. To see the order it is ok, but to see/understand relationships and so on... a little google / articles research is needed. People sometimes is just lazy.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
You use WM_CLOSE to ask a window to close itself. This gives it a chance to ask the user whether to save documents, etc. The default handling (by DefWindowProc) is to call DestroyWindow .
You never send WM_DESTROY yourself. It is sent to the window by the DestroyWindow function to allow it to do some final cleanup.
On desktop Windows (i.e. not on Windows CE) there is also a WM_NCDESTROY message which is sent after WM_DESTROY , when the non-client area is destroyed. This will be the last message ever for that window and can be handled for final final cleanup
WM_QUIT isn't really a window message at all. It's a status flag in the message queue which is set when PostQuitMessage has been called. You should never send WM_QUIT . Its sole purpose is to get GetMessage to return 0. Once the quit message has been retrieved the status flag is cleared, so if you've created a nested message loop you should call PostQuitMessage again to cause the next message loop in the chain to quit as well. MFC and ATL call PostQuitMessage after handling WM_NCDESTROY on the thread's main window (that pointed to by CWinThread::m_pMainWnd in the case of MFC). See Raymond Chen's blog entries on WM_QUIT[^] and PostQuitMessage[^].
If you're coding it yourself using just the Win32 SDK, you normally call PostQuitMessage in response to receiving a WM_DESTROY message. You only have to handle WM_CLOSE yourself if you want to interrupt and potentially prevent the window from closing, as long as you're passing everything you don't handle down to DefWindowProc . (No, really, you need to pass all unhandled messages to DefWindowProc[^].)
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
How do I insert my own entry in Windows Security Center for AntiVirus, AntiSpyware and firewall using WMI ?
Kind Regards
Manoj Jangid
|
|
|
|
|
hi
i am uing copyfile(source,destination,ifoverwrite).from the main application
i am passing the source and the destination path and coping the required file(image) to temp folder and processing it.
the copy file sometimes fails.can any one help me on this issue.
here niether the source nor the destination file is used by my main application.
Thanks in advance
|
|
|
|
|
Do you know about GetLastError ?
BTW third parameter should be FALSE in order to overwrite an existing file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Did you try with SHFileOperation?
|
|
|
|