๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16638

Re: User Accounts under Win2000

#16638
From: Thorsten Meyer
Date: Fri, 02 May 2003 11:03
127 lines
4795 bytes
Hi,

thanks for the answer, but is there any Possibility to use the old API
function netuseradd() ?
Because I don't wanna change my old Code?!

regards for Answer

Thorsten Meyer
"Vladimir Afanasyev" <avv@systema.kiev.ua> schrieb im Newsbeitrag
news:3eaf75b0$1@newsgroups.borland.com...
>
> Hi Thorsten,
> It is my answer for similar question:Hi,
>
> "Fernando" <ferjat@terra.es> wrote:
> >Thank you, but SVC it?s not free and I only want to create an user
account.
> >I would like to use API of Windows. Is it possible?. Thanks
> >
> >
> >"Eugene Mayevski" <mayevski@eldos.org> escribio en el mensaje
> >news:3e9312bb@newsgroups.borland.com...
> >> Fernando Alvarez wrote:
> >> > Hi
> >> >
> >> > How I create an user account in Windows 2000/XP? And a group? I
haven๏ฟฝt
> >> > found any information. Thanks!!
> >>
>
> It is very easy for Windows Script:
>
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/ScriptCen
ter/user/ScrUG92.asp
>
> The similar code for C++ Builder:
>
>
> #include <objbase.h>
>
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> //The IBindCtx interface provides access to a bind context, which is an
object
> //that stores information about a particular moniker binding operation.
> IBindCtx *pbindctx;
>
> //The IMoniker interface is used for naming COM objects. An object that
> //implements IMoniker is called a "moniker," which is a name that uniquely
> //identifies a COM object.
> IMoniker *pmoniker;
>
> //Using later binding by moniker I will obtain pointer to dispatch
interface
> IDispatch *dispServ;
> ULONG ul;
>
> //Creates a bind context.
> //A bind context is an object that stores information about a particular
> //moniker-binding operation:
> HRESULT hresult=::CreateBindCtx(0,&pbindctx);
> if(hresult != S_OK)
>         {
>          ShowMessage("CreateBindCtx error");
>          pbindctx->Release();
>          Application->Terminate();
>         }
>
> //Converts a string into a moniker that identifies the object named by the
string.
> //It's moniker for current computer: (//.)
> hresult = ::MkParseDisplayName(pbindctx,
L"WinNT://.,computer",&ul,&pmoniker);
> if(hresult != S_OK)
>         {
>          ShowMessage("Sure, next time will be better.");
>          pbindctx->Release();
>          pmoniker->Release();
>          Application->Terminate();
>         }
>
> //"Binds" the moniker; that is, returns a pointer to the object identified
by the moniker.
> //The binding process involves finding the object, getting it into the
running
> //state if it's not already, and acquiring an interface pointer to it.
> //See carefully - I "get" Dispatch interface just for later binding
>
hresult=pmoniker->BindToObject(pbindctx,NULL,IID_IDispatch,(void**)&dispServ
);
> if(hresult != S_OK)
>         {
>          ShowMessage("They are still not here, bad day");
>          pbindctx->Release();
>          pmoniker->Release();
>          dispServ->Release();
>          Application->Terminate();
>         }
> //Creating record for user ItsMe
> Variant PCUser=((Variant)dispServ).Exec(Function("Create") << "user" <<
"ItsMe");
> //setting password for user ItsMe
> PCUser.Exec(Function("SetPassword") << "ABCd1924");
> //Apply it:
> PCUser.Exec(Function("SetInfo"));
> }
>
> It is create account for user ItsMe with password ABCd1924.
> For further information see:
> Microsoft Script Center:
>
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcen
ter/default.asp
>
> You can see also how to use monikers for WMI in C++
> Builder in my samples:
> Let us try WMI (samples)
> http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=19443
>
> Vladimir.
>
>
>
>
>
>
Technical Details
Message-ID: <3eb24fe9@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eaeac14@newsgroups.borland.com> <3eaf75b0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10cc67,22f3d92086fcad5d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-02 04:08:04 PST
From: "Thorsten Meyer" <thorsten.meyer@hhb.bonn.de>
Newsgroups: borland.public.cppbuilder.nativeapi
References:  <3eaeac14@newsgroups.borland.com> <3eaf75b0$1@newsgroups.borland.com>
Subject: Re: User Accounts under Win2000
Date: Fri, 2 May 2003 13:03:07 +0200
Lines: 129
Organization: heinrich-hertz-berufskolleg
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
NNTP-Posting-Host: 62.155.162.227
Message-ID: <3eb24fe9@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1051873257 62.155.162.227 (2 May 2003 04:00:57 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail