• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 712
  • Last Modified:

IShellDispatch4 and WindowsSecurity()

I need a code example using C++ (I am using Microsoft VC++), that uses the WindowsSecurity Method.

Reference:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/ishelldispatch4/windowssecurity.asp

Regards,
0
POLITEC
Asked:
POLITEC
  • 2
1 Solution
 
_ys_Commented:
#include <iostream>
#include "ShlDisp.h"

int main(int argc, char* argv[])
{
    CoInitialize(0);

    IShellDispatch4 *pShellDispatch4 = 0;
    HRESULT hr;

    if (SUCCEEDED(hr = CoCreateInstance(CLSID_Shell, 0, CLSCTX_SERVER,
        IID_IShellDispatch, reinterpret_cast<void**>(&pShellDispatch4))))
    {
        std::cout << "Shell instance obtained";

        if (SUCCEEDED(hr = pShellDispatch4->WindowsSecurity()))
        {
            std::cout << "Windows security invoked!!";
        }

        pShellDispatch4->Release();
    }
    else
    {
        std::cout << "Failed to obtain shell instance";
    }

    CoUninitialize();

    return 0;
}
0
 
nonubikCommented:
I think this is not the problem (just method calling) but the fact that it does not behave as expected....
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now