|
|
You do not want the user to enter it that way.
Just replace & with && before calling SetWindowText .
You could use CString::Replace for this.
|
|
|
|
|
<br />
BOOL WINAPI MySetThreadContext(HANDLE hThread, CONST CONTEXT *lpContext)<br />
{<br />
CString s;<br />
BOOL nResult=CopySetThreadContext(hThread,lpContext);<br />
s.Format("%x",lpConText->Dr0);<br />
MessageBox(NULL,s,s,MB_OK);<br />
return nResult;<br />
}<br />
This's hook SetThreadContext.
This can be blocked to the address you set up Dr0 how that kind of block you want to change the address register value Dr0 it?
For example, Dr0 address change eip to 00123456 then how to get this 00123456 intercept?
|
|
|
|
|
Does anyone know of a way to prevent context switch in a block of code?
As far as I can tell (unless I am wrong) Critical Sections do not guarantee not to switch context, it simply means threads can't access a shared resource.
I am looking for some API that will guarantee an atomic execution of a block of code (if this API even exists)
Shay
|
|
|
|
|
As far as I know, this is something impossible on Windows. This is for security reasons: imagine you "lock" at the begining of your code but forget to "unlock". It would mean that your computer is completely frozen (only your app runs, but it can't get any input because they are not processed).
|
|
|
|
|
Yep, pretty much what I had in mind...
Thanks.
|
|
|
|
|
You can get close by temporarily elevate the thread priority to real time. But even then there's no guarantee.
|
|
|
|
|
That's what I ended up doing.
|
|
|
|
|
Read this somewhere that calling SetThreadPriority also resets the quantum of the thread.
So calling SetThreadPriority repeatedly can infact give exclusive control to the thread, at least in theory.
But I would never recommend elevating priority of a thread to real time.
Rather you should design your code in such a way that it handles re-entrancy.
|
|
|
|
|
That was interesting. I had a quick look around, but could only find information that this was a problem in Windows NT.
Regarding reentrant code, I don't think the OP's reason was thread safety. Just to prevent a task switch.
|
|
|
|
|
I suppose kernel code can. See, for instance [^].
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
[My articles]
|
|
|
|
|
nice but in kernel I prefer to use more orthodox stuff
My question was for something I am doing in user space.
|
|
|
|
|
Well, if it is tricky in kernel space...
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
[My articles]
|
|
|
|
|
can't be done in user mode, and that is how it has to be in order to protect one user/app from another user/app.
|
|
|
|
|
Luc Pattyn wrote: it has to be in order to protect one user/app from another user/app.
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
[My articles]
|
|
|
|
|
I saw this s/w once at a museum - and i wanna know if i can build something like it for a project that i need for college
It consists of: A screen, with a bunch of drums scattered around, and when you stand in front of the screen u are projected into it, and you can see yourself standing in the screen with drums all around you, and if you move your hand over a drum, a beat plays (like you've hit a drum for real) an when you hit another one, another drum beat plays..
now i really am fascinated by the idea of this, and want to use the same idea to build a project for myself. Only problem, i dont know where i should start.
So far what i have figured out is that i will need some way to scan the user and to track his movements and accordingly process the sound based on location of his hand..but how do i go about that i am not really sure. Also, what language will i use to build this, again, i am not sure. was thinking JAVA...
Any help would be appreciated!
Thanks
Rashmi
|
|
|
|
|
Rashmi Bachani wrote: i need for college
Rashmi Bachani wrote: Only problem, i dont know where i should start.
Honnestly, I think this is a project way to complex for a student (and even for a professional alone, this is also huge). My advise would be to select something much more simple than that.
|
|
|
|
|
Cedric, I agreed, it's indeed quite a lot of work:
- vision (assumed no markers on the body) with 2 calibrated cameras to reconstruct a depth image
- matching a virtual skeleton to the depth image
- detection of a hit of the skeleton on a virtual surface (you don't want to play a sound if the hand stays on the surface), including speed
- 3d rendering for graphics and video
I would recommend that you wait for Microsoft to include their Kinect API into XNA (if ever), at least you wouldn't have the first two components to develop (which require a serious background in vision theory).
Then, the 3d for graphics and audio should be a very relative problem...
Good luck, and have fun!
Regards,
Fabrice
|
|
|
|
|
Hi,
I want to know what kind of tool I need to render a formula in my program. I utilize Visual C++.
Thanks,
Claude
|
|
|
|
|
Gagnon Claude wrote: ...render a formula...
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Do you mean something like that[^] ? Unfortunately, this is in C# and I don't know something similar in C++. I just wanted to be sure that I understand your question.
|
|
|
|
|
No, I don't mean draw graphic.
I want to display math equation in my program the same way we can see with Math Editor in Word.
Bye,
Claude
|
|
|
|
|
|
Dear All,
I have subclassed SaveAs dialog box of microsoft office Applications(word, excel).
How can I get the full paths of the opened file and saved file(i.e the path of the file that I saved using save as option of the dialog box).
Any suggestions in this regard would be of great help
Thanks is advance
Dinakara K
Dinakara K
CAIR, Bangalore
|
|
|
|
|