Windows对话框未打开

时间:2019-03-29 06:45:25

标签: c++ windows visual-studio credential-providers

当用户按下按钮时,我正在尝试使用Windows凭据提供程序在Windows计算机中打开一个对话框。我尝试了下面的代码,但是,对话框没有打开。我有一个资源“ IDD_DIALOG1”和回调方法“ ChangePasswordProc”。

HWND hwndOwner = nullptr;

:: DialogBox(HINST_THISDLL,MAKEINTRESOURCE(IDD_DIALOG1),hwndOwner,ChangePasswordProc);

2 个答案:

答案 0 :(得分:0)

我有一段时间没有用Windows GUI编写代码,但是也许可以尝试这样的事情:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Dim Position As Integer
Dim FontRange As Range
Dim cell As Range

Set FontRange = ActiveSheet.Range("A1:A100") ' set your range with comments

For Each cell In FontRange
    Position = InStr(cell.Value, ":")
    If Position > 0 Then
    With cell.Characters(Start:=1, Length:=Position).Font
        .FontStyle = "Bold"
    End With
    End If
Next cell

End Sub

我记得,创建窗口并不意味着要显示它-必须明确完成。

答案 1 :(得分:0)

要从Credential Provider内部创建任何窗口,必须首先通过调用OnCreatingWindow接口的ICredentialProviderCredentialEvents方法来获取父窗口句柄。

HRESULT OnCreatingWindow([out] HWND* phwndOwner);

此接口的指针通过调用其Advise接口的ICredentialProviderCredential方法来提供给您的提供程序:

HRESULT Advise([in] ICredentialProviderCredentialEvents* pcpce);

看看这个post