Hi, I too dont have any correct idea, but you can try doing one thing. try clearing the output stream, perhaps using something equivalent to fflush(stdin)
or a flushall
before cout
ing anything. Hope that helps. Bye. AslFunky
AslFunky
Posts
-
weird behaviour with escape character -
SerializationHI people;), Please help me out with this one. I was working on a project for creating a Text Editor. Everything was going on fine, until i serialized my data. What i am doing is that i have an
CArray
ofCString
, so that a particular index in the array represents one line of the text-editor. While serializing, i have to use a loop to write theCString
of every index of the array to a file. But the problem with serializing is that it breaks out of the loop, when it encounters a\n
. In my program, each line is ended by a\r\n
. I have even tried usingWrite
ofCArchive
. But it doesn't work. Is there any way in which i could serialize my data to the file? :((Help.... SOS.....:(( :)Thanks in advance.:) AslFunky -
Key messages in Dialog appOh, you got it all wrong. What i meant was, which class's
PreTranslateMessage()
should i override, since PreTranslateMessage() is a virtual function in three classes. Anyway, i have got the answer, we must override the CWnd class's function. ;) Thanx a lot for helping me out. That was a real relief ;) /--------\ |AslFunky| \--------/ -
Key messages in Dialog appHi, thanx for replying. Yes, i have tried using SetFocus(), but that doesn't work. Anyway, Arsalan Malik has given the right solution. We must override the virtual function
PreTranslateMessage()
of the CWnd class. In this code we have to return aTRUE
for the keydown messages if they are VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT. These are stored in the HIWORD and LOWORD of the message of the lpMsg paramater. Please refer to MSDN if you cannot get this. It is quite clear there. Thanx anyway. Bye /--------\ |AslFunky| \--------/ -
Key messages in Dialog appThankx for replying. I think i am understanding what you are talking about. I have checked the MSDN and it has three versions of PreTranslateMessage(), namely: CWinApp, CWinThread and CWnd. It certainly cannot be CWinThread. Which of the remaining two should I handle? I hope it is the CWinApp! Can i do it as: BOOL bHandleNow = FALSE; switch (lpmsg->message) { case WM_KEYDOWN: switch (lpmsg->wParam) { case VK_UP: case VK_DOWN: case VK_LEFT: case VK_RIGHT: bHandleNow = TRUE; break; } if (bHandleNow) OnKeyDown(lpmsg->wParam, LOWORD(lpmsg ->lParam), HIWORD(lpmsg->lParam)); break; } return bHandleNow; Please, it would be a lot of help. ;)Thanx in advance;)! AslFunky
-
Key messages in Dialog appHi guys :-O, the other day i was developing a game(the snake game, as in Nokia cellphones) in a dialog based application. I encountered a serious problem X| , when i wasn't able to track the keyoard events for the arrow keys(VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN). I have used all possible means, like OnKeyDown() and OnChar() but there is no result:eek:. Can anyone tell me where i am going wrong. ;)Thanx in advance.;) AslFunky
-
MultithreadingHi thanx for replying,;) Is it necessary to do my stuff in a worker thread? Actually i am a little nervous in creating a worker thread. i always have one confusion, how will i assign any job to a function which is not a member of my class. I mean, how will this function UINT threadproc(void* para) be able to access the members of my class when it is not a member of my class. Can you please elaborate on this point. Thanx in advance. AslFunky
-
MultithreadingHi guys, i am new to multithreading in MFC. I have gone through many of the examples posted on CodeProject, but i am still not satisfied. What i want to know is that, suppose i have my window, and i want to create a thread which, say, takes care of all the keyboard inputs, another thread which takes care of all the mouse inputs. So far whatever examples and tutorials i have gone through first create a new window using a thread and then control all the operations. I want my parent window to have a thread to do all those stuff. Can anyone help me out. :)Thanx in advance!:) AslFunky