how to hide windows 7 switch user button in vc++ CredentialProvider sample - c++

I have provided a screenshot of my
CredentialProvider window. In this
window everything is fine now but i
don't want to show Switch User
button to the user. How i can do
this. I am just editing Win-7 SDK
sample for CredentialProvider
(C++). Anyone can help me, or any
link for code help.
One more thing I want to ask is by default, the username text box displaying EditText in grey color. How i could change it to Username text. I can set text in SHStrDupW(L"", &_rgFieldStrings[SFI_EDIT_TEXT]); code but its not setting in background text. is there any hack for this.
Thanks SO members

You cannot directly prevent the Switch User button from appearing; if the conditions are present that cause it to appear, then it's going to appear. What you can do however: prevent the conditions that cause it to appear.
That button appears either when a tile is in the selected state and 1.) your credential provider is enumerating tiles other than the one that is selected, or 2.) other credential providers are enumerating tiles.
The first condition is easy to prevent: In GetCredentialCount(), always report that you will enumerate only one credential. (This means of course that you must structure the tile to handle all users.)
To prevent the second condition, you will have to implement a credential provider filter. (Search for the "ICredentialProviderFilter" interface if you don't know what that is.)
Good luck.

To answer question 2:
The username text box is displaying EditText in grey color. You can change it to Username text. You set text using
SHStrDupW(L"", &_rgFieldStrings[SFI_EDIT_TEXT]);
Have a look at common.h, there you'll find
CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR s_rgCredProvFieldDescriptors[] = { SFI_EDIT_TEXT, CPFT_EDIT_TEXT, L"Edit Text" }
If you change this Edit Text to UserName then it will show in your Text Box.

Related

how to set the rights for placeholder ribbon

beginner question for sitecore about settings the right.
So I have an item is open in the page editor.
The renderings on the page has bunch of icons on the ribbon. One of them called 'select the parent element (element name)'.
In my case when I click on it, I am presented with the placeholder with button 'add here' and the ribbon with some component buttons that a user can use to add the controls.
So, QUESTION:
"how I add access to the button on that ribbon for certain role? Where do I set it up? "
For some certain role that placeholder's ribbon is completely empty, including there is no button 'select the parent element' even though
i know there is a parent element.
thank you very much for help,
HF
Here are the screenshots (no icons on the placeholder ribbon, and the user's rights:
enter image description here
And here is how that looks for the admin:
All the settings for the Page Editor are held in the Core database. So in the Sitecore Desktop, switch to the core database and open up the Content Editor.
Navigate to : /sitecore/content/Applications/WebEdit
This item holds the items that make up the page editor. To edit the ribbon menues, go to:
/sitecore/content/Applications/WebEdit/Ribbons
I don't remember seeing that particular button in the Core database, so this is likely a built-in feature that requires the user to have one of the built-in permissions.
The first thing I would check is that Designing is turned on. Have the user go to the 'View' tab in Page Editor and make sure they have checked the 'Designing' checkbox.
If that doesn't work, it sounds like the user you have does not have design access to the page. I would examine the inherited roles using the User Manager and check if they have the Sitecore Designer role inherited.
It is possible they just need to be provided the correct role in the system so that they can access the buttons.
Have you tried the "Sitecore Client developing role"?
Also, for the blue arrow drop list location, in order for the rendering button to show up in that location, you have to check whether the button in the webedit folder under core database(/sitecore/content/Applications/WebEdit/Default Rendering Buttons). The Type field needs to be "Common" in order to show up in the blue arrow droplist.
Example can be the "Edit related item" (/sitecore/content/Applications/WebEdit/Default Rendering Buttons/Edit related item) shows up in the blue arrow droplist.

C++ Windows Forms - Password Strength

I've been following YouTube tutorials most of the day now and I think I've got the basic hang of forms. I'm aiming to create something like this below, which checks a users password and shows how strong it is:
This is what I have at the moment:
I'd like to know the basic theory behind how the top form works, specifically how I can take the user input of password in my form and just get it to print and update in realtime underneath below. I'm not quite sure what tool is used to do that, or for that matter what tool is used to create the colour changing box.
Any help or direction is appreciated, thanks!
Add a keyboardListener to your jtextfield. When a key is pressed get the text and do your stuff(figure out the strength, number of Uppercase etc)
Is this win32 or mfc forms, or some other tech like Qt or wxWidgets?
In both cases you will want to handle messages from the edit field as text is changed in it. This message is the EN_CHANGE message. Handle that message and you can get the text from the edit field and send messages to the strength form to tell it to change its color and text.
Add a System::Windows::Forms::KeyPressEventHandler (or similar) to the TextBox. When raised, do whatever analysis you need to do on the string and update the table below. The color changing box can be one of many implementations. It can be something as simple as a panel that changes its background with a System::Windows::Forms::Label positioned on top of it. It actually looks like that, as the text is not centered.

Facebook like button: predefined text in the popup window

I need to specify a predefined text in the textarea that pops up when you click "like". How can I do that? (I am not talking about the description that you can set with og:description).
that section of the post is populated with a built-in like (from your app).
I don't think that there is a way to add text to a facebook like, unless the person who shares it wants to add a comment. If your app has special API privileges then you can probably add a personalized message. For that though, you have to apply and applications are closed at the moment. I hope this helps.

Win32API: How to determine if EN_CHANGE was because of user action, not software action?

I find this situation comes up from time to time, and I never seem to have a really robust generic solution to it.
I have a control - in this example an EDIT control on a dialog. I want to take certain actions in response to the user - and only the user - modifying the contents of the edit control.
The edit control can be set programmatically - e.g. when the dialog is being setup, there may be an initial value placed into the edit field. Or when the user selects an item from a listview, that selection's text may well be what's placed into the edit field.
But when the user modifies the contents of the edit field, I need to know that, and respond (in this scenario, I want to clear the selection from the corresponding listview).
I am currently looking at what control has focus, and only considering EN_CHANGE's to be "from the user" if the edit control has focus.
This works beautifully under Windows 7. This fails under XP (I haven't tested Vista yet).
In XP, if the edit field has the focus, but the user clicks on the list view, and the list view tells the edit control to set its contents, then I get a notification from the edit control which claims to still have focus (::GetFocus() == HWND of edit control). But this incorrect state doesn't occur in Win7.
This is a layered interface, so I cannot modify the list-view notification handler. It gets a selection change, and updates the edit field without my involvement or ability to really intervene other than to get notifications from both of them.
Any thoughts on how to generically, permanently solve the "Is this control notification really from the user" conundrum?
You can always track LVM_ITEMCHANGING, LVM_ITEMCHANGED, and EN_MSGFILTER messages. If the edit box is modified between LVM_ITEMCHANGING and LVM_ITEMCHANGED without an EN_MSGFILTER in between then you can probably assume the user did not modify the item. Or just check to see if there are any items selected when EN_CHANGE fires and if not or the text doesn't match the selected item, assume it is a user edit.
Or use ES_MULTILINE (from EN_CHANGE documentation):
The EN_CHANGE notification is not sent
when the ES_MULTILINE style is used
and the text is sent through
WM_SETTEXT.
I'd suggest using the right message. EN_CHANGE is too generic, you want to know if the user typed or pasted text. So why not subclass the control and watch for WM_KEYPRESS messages?
Alternatively, you can set a flag in your other code that sets the edit control content. You might be able to assume that anything that makes your wndproc re-entrant represents a programmatic change.
You aren't looking for something actually secure, are you? If you just want to exclude set content calls that's fairly straightforward. If you want to differentiate between user action and programmatic simulation of user keypresses, that's a much harder problem.

Binding a static text box to a checkbox

I need some help in MFC. The following is my problem:
I have two controls a static text and a checkbox
When using MFC Wizard, i place a '&' in front of one of the letters in the static text, while executing if i press Alt+, the checkbox either gets enabled or disabled.
Now my problem is i am adding these controls programaticaly, and even though i have the '&' placed in the static text, if i press the Alt+, it doesn't change the state of the checkbox control.
My queries are:
Can anyone kindly let me know if there is some binding which has to be done in case we are adding the controls programatically.
If someone can briefly explain how the binding is taken care by MFC it will be gr8 help
edit:
One more thing the checkbox won't have any text associated with it.
Since the static text is not associated with the checkbox control, how can the system know which checkbox it should link? I bet if you look at the TAB ordering and the group settings of the controls, you will arrive at your solution.