Is there a way to create an accelerator in WinAPI with two alphabetical keys? For example, Ctrl+A+S.
How a resource should look like in this case?
Win32 accelerators of this form are not supported. If you wish to support such key presses, you need to implement the input handling manually.
Related
I have a std::map<CString,CString> which I subsequently iterate after it is populated.
Is it possible to sort this map by the key value? The key is a name. So when I iterate the map I would like the names in A-Z order.
std::map is standard C++ specific container which already keeps the data sorted based on key. So no need to sort after it has been populated. But yes, in order to better handle the cases of duplicate keys, you should use std::multimap since name can be duplicated if used as key.
Also, it will be better if you use CMap Class, since mixing standard C++ and windows classes seems bit clumsy.
I would like to use arrow keys to move some points in a QuickWin plot in my console applications. Is there a library out there providing support for something like that?
There are quite a few function calls supported by quickwin: try incharqq, getcharqq or peekcharqq. You'll have to write a noddy program to find out what the key sequences for the arrow keys are.
The call that you may be missing is passdirkeysqq with the parameter PASS_DIR_TRUE. This will enable you to see the direction keys. Each one comes out as 2 keys with the lead character being 224.
If you are not getting any success with this, try using the numeric keypad.
I want to get mapping-independent key codes, but documentation says that "keycode" in XKeyEvent structure depends on hardware and driver and I can't rely on it. How can I get some portable key codes like VK_* in Windows?
You want key syms, not key codes.
See XKeycodeToKeysym() and /usr/include/X11/keysymdef.h
To be strictly correct (especially with internationalization) you need a whole bunch of code along the lines of http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkkeys-x11.c
However, if you're using raw Xlib instead of a toolkit you probably don't care about this kind of thing (if you do you're in for years of work), and XKeycodeToKeysym() is good enough for US keyboards.
GUID are generated by the combination of numbers and characters with a hyphen.
eg) {7B156C47-05BC-4eb9-900E-89966AD1430D}
In Visual studio, we have the 'Create GUID' tool to create it. I hope the same can be created programmatically through window APIs.
How GUIDs are made to be unique? Why they don't use any special characters like #,^ etc...
Also Is it possible to design our own algorithm to create unique GUIDs?
Yes, it is possible, however you shouldn't try to reinvent the wheel without a good reason to do so. GUIDs are made unique by including elements which (statistically speaking) are very unlikely to be the same in two distinct cases, such as:
Current timestamp
The update of the system
The MAC address of the system
A random number
...
Also, consider the privacy implications of GUIDs if you implement it from zero, because they contain the above data which some people deem sensitive.
UUIDs are defined e.g. in http://www.faqs.org/rfcs/rfc4122.html. One problem with using your own algorithm to generate something like a UUID is that you could collide with other people's UUIDs. So you should definitely use somebody else's implementation if at all possible and, if not, write your own implementation of one of the standard algorithms.
Just to answer this: Why they don't use any special characters like #,^ etc..
It is supposed to be a 128bit Integer. So the common representation is simple 32 Hexadecimals.
You can create also use 128 characters of 1's and 0's etc.
As for the rest of the question, wiki has good answers.
You should create new GUID's by calling the API designed for it. In native windows land it is
CoCreateGUID; in .NET land it is System.Guid.NewGuid();
Yes although easier to make use of someone else's e.g. Boost uuid
I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs.
Can anyone point me resources on accessing these keys or tell me how to do it?
I have extensive programming experience, but this will be my first time coding in both MacOSX and XUL (Firefox, etc), so any tips on either are welcome.
Please note that these are not regular key events. I assume it must be a different type of system event that I will need to hook or subscribe to.
This blog post has a solution:
http://www.rogueamoeba.com/utm/posts/Article/mediaKeys-2007-09-29-17-00.html
You basically need to subclass NSApplication and override sendEvent,
looking for special scan codes. I don't know what songbird is, but if it's
not a real application then I doubt you'll be able to do this.
Or maybe you can, a simple category may suffice:
#implementation NSApplication(WantMediaKeysCategoryKBye)
- (void)sendEvent: (NSEvent*)event
{
// intercept media keys here
}
#end
Are you sure your multimedia keys are working in your installation? Every single key generates a scan code which is translated into a key code by the kernel. If xev doesn't show you any keycodes I guess those scan codes aren't mapped and so the kernel has no knowledge of them.
http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys has a nice explanation of finding key codes and offers help on how you can find raw scan codes and translate them into key codes.
xev might help you if you want to find out which codes are being sent by multimedia keys.