Hmm...I'm not understanding what you're trying to do.
Oh good, then I'm not alone! More seriously, I only chose the ATL COM
AppWizard for my first attempt 'cause I thought "I'm using COM, I'll
start with one of those". Using a regular Win32 Application (then
choosing "A simple Win32 application") gives the error I mentioned before.
I suspect there's something wrong with my environment - I don't have a
#include "..._i.c" line, for example, only .h files are included:
// =======================================================
// GPO4.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
// #include <GPEdit.h> // - makes no difference if this is here or in
stdafx.h
void main()
{
CoInitialize(NULL);
IGroupPolicyObject* p = NULL;
HRESULT hr = CoCreateInstance(CLSID_GroupPolicyObject, NULL,
CLSCTX_ALL, IID_IGroupPolicyObject, (LPVOID*)&p);
if (SUCCEEDED(hr))
{
DWORD dwSection = GPO_SECTION_USER;
HKEY key = NULL;
p->GetRegistryKey(dwSection, &key);
p->Release();
}
CoUninitialize();
return;
} // main()
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
main();
return 0;
} // WinMain()
// =======================================================
// =================================================================
// stdafx.cpp : source file that includes just the standard includes
// GPO4.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// =================================================================
// ==========================================================
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows
headers
#include <windows.h>
// TODO: reference additional headers your program requires here
#include <GPEdit.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately
before the previous line.
#endif //
!defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
// ==========================================================
Thanks for the comment about PrSht.h, saved me searching through the 86
files containing it! And you were right, including it made no difference.