How to hide Windows 7 switch user button in vC ++ CredentialProvider example

Credential provider screenshot

  • I have provided a screenshot of my CredentialProvider window. This window is OK, but I do not want to show Switch User to the user. How can I do it. I just edit the Win-7 SDK sample for CredentialProvider (C ++). Anyone can help me or any link to the help system.

  • Another thing I want to ask is the default user text field displaying the EditText in gray. How can I change it to Username text. I can set the text to SHStrDupW(L"", &_rgFieldStrings[SFI_EDIT_TEXT]); code, but do not set it in the background text. is there any hack for this.

Thanks to the members of SO

+4
source share
2 answers

You cannot directly block the appearance of the "Switch User" button; if there are conditions that make him appear, he will appear. However, what you can do: prevent the conditions that lead to its occurrence.

This button appears when the tile is in the selected state, and 1.) your credential provider lists the tiles other than the one selected, or 2.) other credential providers list the tiles.

The first condition is easy to prevent: in GetCredentialCount () always inform that you will list only one accounting file. (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. (Find the "ICredentialProviderFilter" interface if you don't know what it is.)

Good luck.

+4
source

To answer question 2:

The username text box displays EditText in gray. You can change it to user text. You set the text using

 SHStrDupW(L"", &_rgFieldStrings[SFI_EDIT_TEXT]); 

Look at common.h, there you will find

 CREDENTIAL_PROVIDER_FIELD_DESCRIPTOR s_rgCredProvFieldDescriptors[] = { SFI_EDIT_TEXT, CPFT_EDIT_TEXT, L"Edit Text" } 

If you change this Edit text to UserName, it will be displayed in the text box.

+3
source

Source: https://habr.com/ru/post/1333561/


All Articles