Your string handling is, well, all messed up. You have three different variables there, but none hold a meaningful string. You are also passing a non-Unicode string to the Unicode RegSetValueEx() API. This is wrong - REG_SZ means a zero-terminated string that matches the character set that the API is expecting.
I want to add a underlined hyperlink on a dialog box as a text and taking mouse over it makes it blue and on clicking on it an instance of internet explorer opens with the specified URL hyperlink.
i want to do this in an mfc application as it happens in webshots desktops application.
My problem is that i want to open an instance of internet explorer on click of a context menu item with a certain URL. I have the event handler function for context menu item. I wan only the code for the above mentioned work to be inserted into it.
I wonder if somebody could remind me the method of defining a struct where you can set the bits of a member directly, without using the bitwise OR or bitshift operators. ie. I have a struct with 2 members
The offset member requires only 4 bits, and the repaint only 1. Idealy they could be combined so that the Repaint member uses the high order bit of the same BYTE. I remember seeing a way to do this, possibly using a union, but I cannot remember how or where I saw it.
This is mirroring a register in some hardware I talk to. I can set the variable by twiddling individual bits: ChannelsOn.Bits.MasterOn = 1<code>, and also use it as a whole byte... <code>SendStuffToHardware (...., ChannelsOn.Mask, ....);
So, while its not a linked language construct, it's often handy.
Unions can also be usedto ensure the overall variable ends up the correct size.
I am having trouble understanding what it is your trying to accomplish, however I believe you want to manipulate the bits in these bytes indirectly without accessing struct members, although I can't imagine why you would want to do this. Perhaps you have a high performance application and are attempting to shave off a few operations in a critical function.
If speed is your goal, then you should work with the fastest datatype on a 32 bit operating system, sizeof(int). On a modern Intel Core 2 Duo the following function is the fastest, you should define bit masks in your application. The function does not generate any branching op codes, quite fast.
unsigned int bitset(unsigned int bits,unsigned int mask,bool flag)
bits = (bits & ~mask) | (-flag & mask);