Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages
Started by Fernando Alvarez
Tue, 08 Apr 2003 17:08
Create User Account in Windows 2000/XP
Author: Fernando Alvarez
Date: Tue, 08 Apr 2003 17:08
Date: Tue, 08 Apr 2003 17:08
4 lines
1005 bytes
1005 bytes
Hi How I create an user account in Windows 2000/XP? And a group? I haven�t found any information. Thanks!!
Re: Create User Account in Windows 2000/XP
Author: Eugene Mayevski
Date: Tue, 08 Apr 2003 18:19
Date: Tue, 08 Apr 2003 18:19
13 lines
1421 bytes
1421 bytes
Fernando Alvarez wrote: > Hi > > How I create an user account in Windows 2000/XP? And a group? I haven�t > found any information. Thanks!! Maybe you will find SvCom useable. It has some security-related components with examples. http://www.aldyn.ru -- Eugene Mayevski Flexible cross-platform information exchange framework http://www.msgconnect.com/
I need another solution
Author: Fernando
Date: Tue, 08 Apr 2003 22:05
Date: Tue, 08 Apr 2003 22:05
20 lines
1590 bytes
1590 bytes
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!! > > Maybe you will find SvCom useable. It has some security-related > components with examples. http://www.aldyn.ru > > -- > Eugene Mayevski > Flexible cross-platform information exchange framework > http://www.msgconnect.com/ >
Re: I need another solution
Author: Vladimir Afanasyev
Date: Wed, 09 Apr 2003 11:07
Date: Wed, 09 Apr 2003 11:07
94 lines
4253 bytes
4253 bytes
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/ScriptCenter/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/scriptcenter/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.
Re: I need another solution
Author: Fernando
Date: Wed, 09 Apr 2003 12:53
Date: Wed, 09 Apr 2003 12:53
116 lines
4669 bytes
4669 bytes
Thank you. I will try it tonight. I will try to create a local group. Thank
you very much. A very useful information.
"Vladimir Afanasyev" <avv@systema.kiev.ua> escribi� en el mensaje
news:3e93f0ca$1@newsgroups.borland.com...
>
> 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.
>
Re: Create User Account in Windows 2000/XP
Author: Jerry Bloomfield (TeamB)
Date: Sun, 13 Apr 2003 03:54
Date: Sun, 13 Apr 2003 03:54
14 lines
1720 bytes
1720 bytes
On Tue, 8 Apr 2003 19:08:21 +0200, "Fernando Alvarez" <ferjat@lycos.es> wrote: >How I create an user account in Windows 2000/XP? And a group? I haven�t >found any information. Thanks!! Have a look at the NetUser functions in the Win32 SDK. The NetUserAdd() function will allow you to create a user account. Jerry Bloomfield (TeamB) -- http://www.teamb.com JersWork@iwc.net Please do *NOT* send private e-mail without prior permission (my anti-spam filters will probably just delete it anyway <g>)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads