|
Thanks for the help guys.
What am I doing? I'm converting user input ( from gui ) into the smallest possible form ( hence the splitting of data ), transmit it to another source via serial comms which then sends a message back. The message then has to put back into a readable form so it can be displyed in the gui. I've got the Tx side of things sorted now but I'm just tying up the Rx data.
I knew it was simple but I just couldn't figure it out. Time to blow brains out I think.
|
|
|
|
|
short nYourShort = cYourChar1;
(&nYourShort) + 1 = cYourChar2;
Or:
short nYourShort = ((short) cYourChar1) + ((short) cYourChar2) * 255;
why multiply cYourChar2 with 255 you ask. Well its the same as shifting all the bits 8 places to the left (towards the MSB). The equivilant would be: ((short)cYourChar2) << 8 .
There are many solutions to this problem, these are just a few.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
with 255 you ask. Well its the same as shifting all the bits 8 places
isn't it 256 instead ???
however, it is not a so good habit to code bits and bytes manipulation..
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
isn't it 256 instead ???
I'm wrong 1 bit once again... And it was you who corrected me the first time too, if I remember correctly.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
I'm wrong 1 bit once again...
remember that 8 bits shifting equal to 2^8 (2 for base-2, 8 for 8 bits), or better equals to 0x100 ...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I thought that odd value was a little bit strange! Anyway, thanks for notifing me.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Can we use mbtowc instead
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Hi
Is there anyway to handle the forced exit of an application by task manager?
Regards
|
|
|
|
|
As far as I know, you canno't stop the taskmanager from killing your app. The reason for this is how the task manager terminates the application. The TM achieves this by cleaning up all resources of the process (just like a normal termination, but without notification.)
Let me elaborate:
Windows manages the CPU time that is given to a process / thread with certain queues. If a process is able to run (Ready 2 Run, R2R), it waits in a queue until it gets CPU time.
If the process / thread is blocked, it waits somewhere else until it becomes R2R. After getting that state, it is placed in the queue.
The taskmanager removes the process handle from this system, so the process will not get any CPU time anymore. After doing that, windows will clean up all the resources user by that process (as much as it can). So your process just disappears without any notification.
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Task manager before removing the process from the system doesn't it send any notification to the process? Are there any way to track this?
|
|
|
|
|
As I explained in my earlier post, the taskmanager doesn't notify the application.
The taskmanager is like a thief. It takes something from windows and it doesn't notify anything...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Are you sure about that? If I make a modification to a a text file in notepad and attempt to shut down notepad from the task manager, notepad pops up and asks me if I want to save the work. Task manager then pops up and says that notepad is not responding. While I've never checked into the message sent from task manager, that obviously seems to indicate that the applicatoin does receive some sort of notification.
|
|
|
|
|
If you shot down the application, than you recieve a notification, but if you end the process (on the process tab) you don't get it. Plus if you press the "End now" buttond on the dialog that the TM pops up, the application is terminated no matter what.
You can conclude from this that it is not safe to rely on that behaviour.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Yep. You're correct. I just ran some tests and verified with spy++ that on the "end now", you don't get a message. I'm thinking there's got to be a way to prevent the shut down though as I've seen apps in the past that I couldn't close. However, it's probably some kludge like stating you're in debug mode when you're not - I seem to remember messages to the effect that the app couldn't be shut down becuase it was being debugged when clearly it wasn't.
|
|
|
|
|
ThatsAlok also says that there are ways to fool the TM. He says that he has some code in an article that he wrote that does the trick, but I couldn't find it yet.
I've also seen apps that didn't close even when I wanted them too, but that was in the Win98 days. Now with Win2K and WinXP I don't have that problem anymore.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
ThatsAlok also says that there are ways to fool the TM. He says that he has some code in an article that he wrote that does the trick, but I couldn't find it yet.
Hain, BOB I havn't write any article that can fool TM. I am saying that a Article present at CP demonstrate that, here is link for that :-
http://www.codeproject.com/system/Paladin.asp[^]
I have discussion over this TOPIC with Mr. J. Newcommer in FEB this year at Microsoft.public.vc.mfc newsgroup, wheather it is good or not!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
That was a interesting read! Thanks
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Tom Archer wrote:
http://blogs.msdn.com/oldnewthing/archive/2004/07/22/191123.aspx#191459[^]
http://blogs.msdn.com/oldnewthing/archive/2004/07/23/192531.aspx[^]
Nice Collection
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Asha Udupa wrote:
Is there anyway to handle the forced exit of an application by task manager?
I Believe, No Way. Better way is to hide you application from TaskManager.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
Better way is to hide you application from TaskManager.
but you can always use the process tab and its "terminate the process" (not sure about the translation, i use french version of windows )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
you can always use the process tab
There are way to hide from process TAB too
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|