|
Is there a standard way in MFC to track the state of Scroll Lock, Num Lock
and Caps Lock?
Thomas George
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Hmmm... try the Win32 GetKeyboardState call?
|
|
|
|
|
But, what is the event on which I call it?
modified 29-Aug-18 21:01pm.
|
|
|
|
|
If the user presses the key while you have the keyboard focus, you will get a WM_KEYDOWN and a WM_KEYUP message for those three keys.
If you want to know the state of the keys to display in your status bar like a lot of program sdo, then just call GetKeyState in your handler that updates your user interface.
|
|
|
|
|
I have to update the state, even when I do not have keyboard focus. (like the status bar does)
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Then you need to use a timer.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
If you want to display the state info on the Status Bar you'd do this in your CMainFrame::OnUpdateStatusBar() or am I missing something here?
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Hi,
I have 2 GDI drawing problems and I was hoping you guys could help me out.
1. I have several bitmaps (8x8, 16x16 and 32x32) that I use in PatBlt to set the background of my view to mimic zooming. Everything else is drawn on top. The 8x8 and 16x16 bitmaps tile the background perfectly. However, the 32x32 doesn't work at all! Instead the back of the view is completely corrupted (almost like returning FALSE from OnEraseBkGrnd and whizzing windows over it).
Anyone know if PatBlt has a limit on the size of the bitmap it can use or what the problem might be?
2. I implemented the double buffering ideas put about on this and other sites to draw to an offscreen buffer and then blit it back to remove flicker. However, when I resize the window or my view is redrawn, the flicker is as bad as normal.
According to the examples, I'm not missing anything, so what might have I done wrong?
Thanks for any help,
Simon
|
|
|
|
|
As long as you are using an OS newer than Windows 95 you can do brushes larger than 8x8.
As far as the flicker when you resize your window, it may help to make sure that you frame window that contains the view does not have the CS_HREDRAW or CS_VREDRAW styles set.
|
|
|
|
|
Are all your images same in color depth..?
I dunno if PatBlt will blit 265 color images or not, I don't see why it wouldn't BitBlt does. Maybe try all 16 colors images and see what happens.
Double buffering...flicker free drawing is a pain or is that paint...?
If you sit down and think about it you'll figure it out if you haven't already. If you don't fully understand everything thats going I would suggest using CMemDC found here on CP or maybe read the article FLicker free drawing By Keith Rule...???
I have used all the double buffering classes and implemented myself both MFC and SDK and I couldn't figure out why my screen still flickered when I overrode OnEraseBkgnd() and OnPaint/OnDraw. Seems you can't have both painting...Tell me is you figure it out.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey,
The image is identical for PatBlt, just different sizes (so therefore the same colors). I used DevStudio to create the bitmap resources (just by inserting a new resource), so I think it safe to assume all bitmap resources have the same color depth.
I have another application that uses my own (the same as this app) off-screen drawing DC class and it works fine! The only difference is that app is a MDI app, this one is SDI.
Do you know why SDI and MDI GDI calls might behave differently?
Simon
|
|
|
|
|
The GDI is independant of the SDI/MDI architecture i'd think...it's wrapped in the CDC classes.
Thats strange...real strange...then again...anything is strange when you don't understand it...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I am looking for a way to control my laptop from my desktop computer. I would like to run a small program on each so that when I move my mouse to the far right edge of my desktop's screen, the mouse cursor disappears from my desktop and begins to push the cursor around on the laptop (via a network connection). If the cursor is pushed to the far left edge of the laptop, the cursor reappears on the desktop screen and is controlled normally. Additionally, I'd like to send the desktop's keyboard events to the laptop when the laptop cursor is being pushed around.
I have a feeling that this can be accomplished using a bit of hooks magic, but I've had a really hard time working with them in the past, so I'm a little hesitant to try and code this myself. Does anybody know where I can find the source to pull this trick off, or have any suggestions on how to implement it in a straightforward way?
Steve Voida
Georgia Tech grad student
svoida@cc.gatech.edu
|
|
|
|
|
There is a sample hooks application in MSDN that you can checkout.
I think that the most difficult part of that program will be to create the client / server portion of the program to communicate the current position of the keyboard and mouse, and process the input events between the two computers.
In order to generate the mouse and keyboard events properly on the laptop from your computer, you can use mouse_event and keybd_event functions respectively.
|
|
|
|
|
svoida wrote:
any suggestions on how to implement it in a straightforward way?
Use VNC or MS NetMeeting.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I've been working with binary behaviors for the last two weeks, but the resource in the net is very poor. Anyone of you already work with binary behaviors?
|
|
|
|
|
Hu?
what behavior, zeros and ones ? or binary files or bit patterns ?!
Max.
|
|
|
|
|
No,
Behavior is a custom TAG that you can do with IE 5.5.
A binary behavior is the code write in a dll.
Take a look at MSDN....
|
|
|
|
|
Can someone tell me what is the easyest way to create a child dialog box from the main window of an SDI project ?
This window should be like a ToolWindow.
Thanks.
|
|
|
|
|
DoModal(this) ???
Just create the dialog in the resource editor, make it a tool window, and create a class for it. In the SDI project, you just create an instance of the class and pass this into DoModal to make it a child.
If you want a toolwindow, I suspect you want to create a modeless dialog ( the main window remains functional ), in which case, do something like this in the constructor of the dialog]
if (Create(IDD, this)) ShowWindow(SW_SHOW);
Then make the dialog a member variable pointer, and call new on it when you want to show the dialog, and either ShowWindow(SW_HIDE) or DestroyObject(I *think*, it's been a while since I did this)/set to NULL when you don't want it anymore.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
what is ToolWindow?
|
|
|
|
|
Undocked CDialogBar?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
It's a window style where the caption bar is half the normal height. So called because the smaller caption uses less space and makes it a better choice for floating 'option' windows in programs.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Tool windows have a narrower title bar.
WS_EX_TOOLWINDOW is an extended window style.
Normally they are used for docking toolbars.
Nish
I am the Keyboard Smasher
|
|
|
|
|
I'm a c++ student trying to move out of crappy black and white console mode to marvelous WindowsLand. I have learned how to write text in the client area using the TextOut api function but don't know how to get data in from the keyboard without using a dialog box. Is there a windows api command that is the equivalent of cin?
A noble spirit embiggins the smallest man
|
|
|
|