This might be considered an elementary question for those with COM
emblazened upon their belt buckles, but I know just enough about it to be
dangerous! Here goes...

If I include <dskquota.h>, I can use the following code just fine:

IDiskQuotaControl *lpDiskQuotaControl;
IEnumDiskQuotaUsers *lpEnumDiskQuotaUsers;
HRESULT hr = CoCreateInstance(CLSID_DiskQuotaControl,
NULL,
CLSCTX_INPROC_SERVER,
IID_IDiskQuotaControl,
(LPVOID*)&lpDiskQuotaControl);
if (SUCCEEDED(hr))
{
hr = lpDiskQuotaControl->Initialize(_bstr_t("c:\\"), TRUE);
if (SUCCEEDED(hr))
{
hr = lpDiskQuotaControl->CreateEnumUsers(NULL, 0,

DISKQUOTA_USERNAME_RESOLVE_SYNC,
&lpEnumDiskQuotaUsers);
...
}
lpDiskQuotaControl->Release();
}

If, however, I wanted to use smart pointers instead with #import
<dskquota.dll> then the CreateEnumUsers() method does not show up in the
.tlh or .tli file. There also does not appear to be an interface for the
users (plural). Is it supposed to be this way, or what am I doing wrong?

Thanks,
DC

Re: COM question by Simon

Simon
Wed Jun 01 19:06:59 CDT 2005

"David Crow [MCSD]" <david.no.spam.crow@pbsnow.no.spam.com> wrote in message
news:OOhp1dtZFHA.3144@TK2MSFTNGP12.phx.gbl...

> If, however, I wanted to use smart pointers instead with #import
> <dskquota.dll> then the CreateEnumUsers() method does not show up in the
> .tlh or .tli file. There also does not appear to be an interface for the
> users (plural). Is it supposed to be this way, or what am I doing wrong?

It doesn't show up in mine either. I imported the library into VB6 and it
doesn't have that method or users (plural), nor CreateUserBatch. dskquota.h
in VC98\Include is pretty obviously handcrafted as it contains numerous
comments. I note that there is a version of the DLL in
\Windows\$NTServicePackUninstall; I have:

Directory of C:\WINDOWS\$NtServicePackUninstall$

23/08/2001 13:00 84,992 dskquota.dll
1 File(s) 84,992 bytes

Directory of C:\WINDOWS\ServicePackFiles\i386

04/08/2004 08:56 92,672 dskquota.dll
1 File(s) 92,672 bytes

Directory of C:\WINDOWS\system32

04/08/2004 08:56 92,672 dskquota.dll
1 File(s) 92,672 bytes

(I'm running XP SP2)



Re: COM question by Sergei

Sergei
Thu Jun 02 03:39:51 CDT 2005

"David Crow [MCSD]" <david.no.spam.crow@pbsnow.no.spam.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:OOhp1dtZFHA.3144@TK2MSFTNGP12.phx.gbl...
> This might be considered an elementary question for those with COM
> emblazened upon their belt buckles, but I know just enough about it to be
> dangerous! Here goes...
>
> If I include <dskquota.h>, I can use the following code just fine:
>
> IDiskQuotaControl *lpDiskQuotaControl;
> IEnumDiskQuotaUsers *lpEnumDiskQuotaUsers;
> HRESULT hr = CoCreateInstance(CLSID_DiskQuotaControl,
> NULL,
> CLSCTX_INPROC_SERVER,
> IID_IDiskQuotaControl,
> (LPVOID*)&lpDiskQuotaControl);
> if (SUCCEEDED(hr))
> {
> hr = lpDiskQuotaControl->Initialize(_bstr_t("c:\\"), TRUE);
> if (SUCCEEDED(hr))
> {
> hr = lpDiskQuotaControl->CreateEnumUsers(NULL, 0,
>
> DISKQUOTA_USERNAME_RESOLVE_SYNC,
> &lpEnumDiskQuotaUsers);
> ...
> }
> lpDiskQuotaControl->Release();
> }
>
> If, however, I wanted to use smart pointers instead with #import
> <dskquota.dll> then the CreateEnumUsers() method does not show up in the
> .tlh or .tli file. There also does not appear to be an interface for the
> users (plural). Is it supposed to be this way, or what am I doing wrong?

It looks like the type library only has dispatch interfaces.
You still can use smart pointers though:

// begin
#include <dskquota.h>
#include <comdef.h>

_COM_SMARTPTR_TYPEDEF(IDiskQuotaControl, IID_IDiskQuotaControl);
_COM_SMARTPTR_TYPEDEF(IEnumDiskQuotaUsers, IID_IEnumDiskQuotaUsers);

void test()
{
IDiskQuotaControlPtr spDiskQuotaControl;
HRESULT hr = spDiskQuotaControl.CreateInstance(CLSID_DiskQuotaControl);
if (FAILED(hr)) _com_raise_error(hr);

hr = spDiskQuotaControl->Initialize(_bstr_t("c:\\"), TRUE);
if (FAILED(hr)) _com_raise_error(hr);

IEnumDiskQuotaUsersPtr spEnumDiskQuotaUsers;
hr = spDiskQuotaControl->CreateEnumUsers(NULL, 0, DISKQUOTA_USERNAME_RESOLVE_SYNC, &spEnumDiskQuotaUsers);
if (FAILED(hr)) _com_raise_error(hr);
}
// end

Sergei


Re: COM question by thatsalok

thatsalok
Thu Jun 02 03:58:04 CDT 2005


"Sergei" <sergei@nospam.summertime.mtu-net.ru> wrote in message
news:#H7L150ZFHA.2308@TK2MSFTNGP14.phx.gbl...
> "David Crow [MCSD]" <david.no.spam.crow@pbsnow.no.spam.com>
ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
> news:OOhp1dtZFHA.3144@TK2MSFTNGP12.phx.gbl...
> > This might be considered an elementary question for those with COM
> > emblazened upon their belt buckles, but I know just enough about it to
be
> > dangerous! Here goes...
> >
> > If I include <dskquota.h>, I can use the following code just fine:
> >
> > IDiskQuotaControl *lpDiskQuotaControl;
> > IEnumDiskQuotaUsers *lpEnumDiskQuotaUsers;
> > HRESULT hr = CoCreateInstance(CLSID_DiskQuotaControl,
> > NULL,
> > CLSCTX_INPROC_SERVER,
> > IID_IDiskQuotaControl,
> > (LPVOID*)&lpDiskQuotaControl);
> > if (SUCCEEDED(hr))
> > {
> > hr = lpDiskQuotaControl->Initialize(_bstr_t("c:\\"), TRUE);
> > if (SUCCEEDED(hr))
> > {
> > hr = lpDiskQuotaControl->CreateEnumUsers(NULL, 0,
> >
> > DISKQUOTA_USERNAME_RESOLVE_SYNC,
> > &lpEnumDiskQuotaUsers);
> > ...
> > }
> > lpDiskQuotaControl->Release();
> > }
> >
> > If, however, I wanted to use smart pointers instead with #import
> > <dskquota.dll> then the CreateEnumUsers() method does not show up in the
> > .tlh or .tli file. There also does not appear to be an interface for
the
> > users (plural). Is it supposed to be this way, or what am I doing
wrong?
>
> It looks like the type library only has dispatch interfaces.
> You still can use smart pointers though:
>
> // begin
> #include <dskquota.h>
> #include <comdef.h>
>
> _COM_SMARTPTR_TYPEDEF(IDiskQuotaControl, IID_IDiskQuotaControl);
> _COM_SMARTPTR_TYPEDEF(IEnumDiskQuotaUsers, IID_IEnumDiskQuotaUsers);
>
> void test()
> {
> IDiskQuotaControlPtr spDiskQuotaControl;
> HRESULT hr = spDiskQuotaControl.CreateInstance(CLSID_DiskQuotaControl);
> if (FAILED(hr)) _com_raise_error(hr);
>
> hr = spDiskQuotaControl->Initialize(_bstr_t("c:\\"), TRUE);
> if (FAILED(hr)) _com_raise_error(hr);
>
> IEnumDiskQuotaUsersPtr spEnumDiskQuotaUsers;
> hr = spDiskQuotaControl->CreateEnumUsers(NULL, 0,
DISKQUOTA_USERNAME_RESOLVE_SYNC, &spEnumDiskQuotaUsers);
> if (FAILED(hr)) _com_raise_error(hr);
> }
> // end
>
> Sergei
>

Great!!!, I will note it Down!, never heard about this before!


--
cheers,
Alok Gupta
Visit me at http://alok.bizhat.com