|
This looks like it will only purge one keyboard message. Shoudn't it be:
MSG msg;
while ( PeekMessage(&msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE|PM_NOYIELD) );
Steve
|
|
|
|
|
|
oops! sorry hehe, i'm talking about console mode . in C.
for example, you get the input through scanf , after getting the inputs, it does some process (may it be a while-do),during the process if you make strokes in your keyboard, its gets accumulated in the Kb buffer, so after the process is over, it automatically types in the input for the next scanf , you get me now?.. i want to clear the buffer everytime before "scanningf!"
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
VivekuniQ wrote: ForumVisual C++
Subject:Re: keyboard buffer
Sender:VivekuniQ
Date:11:06 12 Jan '06
how do i clear the keyboard buffer?
what specific problem are you facing
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
please look at my reply to owner drawn
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
Holla,
I just migrated some code from VC6 to VC7. It compiled without any warnings or errors, with no changes made.
However, the size of the debug- and release-versions increased by a factor of 10. The release version, for example, was 2 MiB and is 20 MiB now.
I suspect that this is due to the templates in the source (I did not write it, so I cannot be sure) which supposedly were inflated during compilation.
Is there a way (compiler option or pragma) do prevent this code inflation from happening in VC7?
It works and all, but sending 20 Megs via E-Mail is quite a pain.
Thanks in advance.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
This is highly unusual. What libraries do you use? MFC, ATL, WTL, STL etc.
Regards,
Nish
|
|
|
|
|
Are you really sure that you had compiled in release ?!?
20mb gees, it is like all libs that microsoft has made has linked with your application.
-Prakash
|
|
|
|
|
are these static libs ? if so, it's not a bug. it's intended.
i had a discussion[^] (scroll down to the last msg from J. Caves) with an MS tech about this a couple of years ago, and it seems the increase is due to the STL - MS changed something in the STL implementation that causes tons and tons of additonal code to get sucked in.
see his sample program and note the size of the libraries he gets.
it sucks. sucks. sucks.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
IMO, that discussion (the google group thingy ) should be bumped up!!!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
For a largish lib I once did the following (mainly to reduce compile time):
make one .cpp that #includes all the other .cpp's, and let the compiler only see th "includer" cpp
It doesn't work always of course (overlapping #defines or other local symbols) but maybe it's worth a try.
Did you already try the same code on VC8?
We say "get a life" to each other, disappointed or jokingly. What we forget, though, is that this is possibly the most destructive advice you can give to a geek.
boost your code || Fold With Us! || sighist
|
|
|
|
|
peterchen wrote: maybe it's worth a try
i'll see what happens. there are 200+ files, though.
peterchen wrote: Did you already try the same code on VC8?
don't have it yet.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks for the help everyone.
There has to be SOME way to get this right again
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Hello Friends
I have a MFC application and in which I want to show some message when user tries to close the lid of the laptop. Is there a way or event through which i can get when used closed lid of laptop.
Also I want to get notification when user presses Ctr+Alt+Del and logs into Laptop after he closed the lid of the laptop.
Is there any way to do this ?
Regards
Mahesh
|
|
|
|
|
For Ctr+Alt+Del , you have to write GINA. There is a sample in platform sdk.
Alternatively you can create a registry value DisableCAD under Winlogon key
to disable the ctrl-alt-del.
Vipin - MVP
|
|
|
|
|
Thankx for finding time
I do not want to disable CtrlAltDel menu.
I just want a notification when this happens
Mahesh
|
|
|
|
|
|
|
|
Michael Dunn wrote: How is the user going to see your message if the lid is closed?
The message is suppose to warn the user that he will not be able to see a message if the lid is closed
~RaGE();
|
|
|
|
|
Beat me to it .
Software Zen: delete this;
|
|
|
|
|
Hi Dear
YOu are right...
But what I mean to say is that I have to do some background processing while that lid gets closed. Thats the reason I need it.
Is there any answer ?
Regards,
Mahesh
Mahesh
|
|
|
|
|
I use visual c++ 6.0 enviorment. The primary file which contain main() is 555.cpp. I also wrote two functions in r.h and r.cpp. I want to call these two functions in 555.cpp. However, it always show some errors. Is there anyone who can teach me how to fix this problem? Thanks
***error message***
Compiling...
555.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\555\555.cpp(12) : error C2065: 'AA' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\555\555.cpp(13) : error C2065: 'BB' : undeclared identifier
r.cpp
c:\program files\microsoft visual studio\myprojects\111\r.cpp(21) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
Error executing cl.exe.
555.exe - 3 error(s), 0 warning(s)
***555.cpp***
#include "stdafx.h"
#include "r.h"
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char* argv[])
{
double a=AA();
double b=BB();
cout << a;
cout << b;
return 0;
}
***r.h***
#ifndef RANDOM1_H
#define RANDOM1_H
double AA();
double BB();
#endif
***r.cpp***
//test
#include <cstdlib>
#include <cmath>
#include "r.h"
// the basic math functions should be in namespace
// std but aren't in VCPP6
#if !defined(_MSC_VER)
using namespace std;
#endif
double AA()
{
return 3.3;
}
double BB()
{
return 4.4;
}
|
|
|
|
|
The declarations for the functions AA and BB aren't got by compiler, plain simple.
For the second issue of not getting r.cpp to compile, go to solution explorer, then choose the file r.cpp, right click, choose c/c++, choose precompile headers, Choose "Not using precompile headers".
Vipin - MVP
|
|
|
|
|
Hi All
I developed a MFC extension dll which has English resources in it.
I want to incorporate French resource to this dll. I am using this dll in my main application.
The resources loading from this dll should be controlled programatically.
(ie, In English OS it should load French resource or vice versa)
I have come across the following code
/***********/
HINSTANCE = LoadLibrary("MyDll");
AxSetResourceHandle(hinstance);
/***********/
But It is not working in dlls (Inside DllMain()).
How can I do it dlls?
regards
Jafi.
|
|
|
|