|
I wrote the following vb script which removes a specific user from a domain
strDomain="XYZ"
strUser="TestAdminUser"
strGroupName ="Administrators"
Set oDomain = GetObject("WinNT://" & strDomain)
Set oGroup = oDomain.GetObject("Group", strGroupName)
oDomain.Delete "user", strUser
Set oDomain=Nothing
Set oGroup=Nothing
The following code snippet deletes specific user from a group
strDomain="XYZ"
strUser="TestAdminUser"
strGroupName ="Administrators"
Set oDomain = GetObject("WinNT://" & strDomain)
Set oGroup = oDomain.GetObject("Group", strGroupName)
Set ouser = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
oGroup.Remove(ouser.ADsPath)
Set oDomain=Nothing
Set oGroup=Nothing
But, could the above code be replicated in VC++ ?
I've used ShellExecute() to integrate (or run) the vbscript (.vbs) file in VC++ 6.0 code (or programming) ?
Is there a better way ?
|
|
|
|
|
Hi All,
I want to write an application that runs in the background and does not bring up any kind of UI (Not even the command prompt). How can I achieve this?
Thank you,
AJ
|
|
|
|
|
Creating window in Invisible mode can achieve this .
|
|
|
|
|
Hi,
Any idea how I could do this in a command line application?
Thank you,
AJ
|
|
|
|
|
What is the purpose of having an invisible window? What is it going to do? Why should it only be a command line application?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
try the following,
#ifdef _UNICODE
#pragma comment (linker, "/subsystem:windows /entry:wmainCRTStartup")
#else //_UNICODE
#pragma comment (linker, "/subsystem:windows /entry:mainCRTStartup")
#endif //_UNICODE
it makes your application as windows application and since you are not creating any windows in console application (normally not) no UI is visible.
you can also think about windows NT services.
|
|
|
|
|
I was saying easy way to switch to "Win32 application" from a console application. Sorry if some thing wrong, But i would like to know the technical reason (will be appreciated) that gave me vote 1.
|
|
|
|
|
You can also hide the console window,
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
|
|
|
|
I don't understand why your previous post was voted down. I can only think that someone thinks the OP is trying to do a malicious program, for which you're providing him some assistance and so they voted you down.
Anyways, I know that you won't assist someone to do a malicious program and so I'll try to bring up the score.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thank buddy,
Invisible app can be easily created in windows subsystem application, even a beginner (win32) can understand. So nothing prevents he from creating malicious program. He can have good intention also.
|
|
|
|
|
Well, that was only my guess. Besides that, I couldn't think of a reason why someone down-voted you.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Unjustified[^] vote here.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
Create a "Win32 Application" project.
|
|
|
|
|
Are you looking for a windows service
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
How can I set 3(1 ULONGLONG,2 DWORD) value with each item of tree so that I can use it later.
|
|
|
|
|
|
I got S_FALSE when reading properties [pPropStg->ReadMultiple(nPidsi, pPropSpec, pPropVar)] since pPropStg return as S_OK.
#include <stdio.h>
#include <windows.h>
#include <ole2.h>
#include <locale.h>
void DumpSummaryProps(IPropertySetStorage *pPropSetStg) {
IPropertyStorage *pPropStg = NULL;
HRESULT hr;
PROPVARIANT propRead;
hr = pPropSetStg->Open(FMTID_SummaryInformation,
STGM_READ | STGM_SHARE_EXCLUSIVE, &pPropStg);
if(FAILED(hr))
{
printf("No Summary-Information.\n");
return;
}
struct pidsiStruct {
char *name;
long pidsi;
} pidsiArr[] = {
{"Title", PIDSI_TITLE},
{"Subject", PIDSI_SUBJECT},
{"Author", PIDSI_AUTHOR},
{"Keywords", PIDSI_KEYWORDS},
{"Comments", PIDSI_COMMENTS},
{0, 0}
};
int nPidsi = 0;
for(nPidsi=0; pidsiArr[nPidsi].name; nPidsi++);
PROPSPEC *pPropSpec = new PROPSPEC [nPidsi];
PROPVARIANT *pPropVar = new PROPVARIANT [nPidsi];
for(int i=0; i<npidsi; i++)="">
{
ZeroMemory(&pPropSpec[i], sizeof(PROPSPEC));
pPropSpec[i].ulKind = PRSPEC_PROPID;
pPropSpec[i].propid = pidsiArr[i].pidsi;
}
hr = pPropStg->ReadMultiple(nPidsi, pPropSpec, pPropVar);
<big>
if(FAILED(hr))
{
printf("IPropertyStg::ReadMultiple() failed w/error %08lx\n", hr);
}
else
{
int i;
for(i=0; i<npidsi; i++)="">
{
printf("%16s: ", pidsiArr[i].name);
DumpPropVariant(pPropVar + i);
}
}
delete [] pPropVar;
delete [] pPropSpec;
pPropStg->Release();
}
void DumpProps(char *filename) {
WCHAR wcFilename[1024];
setlocale( LC_ALL, "" );
int i = mbstowcs(wcFilename, filename, strlen(filename));
setlocale( LC_ALL, "C" );
wcFilename[i] = 0;
IStorage *pStorage = NULL;
IPropertySetStorage *pPropSetStg = NULL;
HRESULT hr;
hr = ::StgOpenStorageEx(wcFilename, STGM_READ | STGM_SHARE_EXCLUSIVE, STGFMT_FILE,
0, NULL, 0, IID_IPropertySetStorage, (void**)&pPropSetStg);
if (FALSE(hr))
{
printf("Error");
return;
}
DumpSummaryProps(pPropSetStg);
pPropSetStg->Release();
pStorage->Release();
}
void main()
{
char *s;
DumpProps("1.docx");
scanf("%s",&s);
}</npidsi;></npidsi;></locale.h></ole2.h></windows.h></stdio.h>
|
|
|
|
|
REPOST !!!
|
|
|
|
|
|
you wanted to say that to me ??
|
|
|
|
|
When i double click the dialog it does not go to Coding page.
It just show class wizard.When i click any control in dialog box, it shows only the class wizard.
I deleted the .clw file and again i create that. But No use.
Please help me?Any idea for this.
Anu
|
|
|
|
|
Yes, you have to first select a base class for it using class wizard.
|
|
|
|
|
It shows the classwizard of that corresponding dialog.
THis problem ocurs not only for single dialog.
Im using more than 50 dialogs for my application.The problem exists for all these dialogs.
When i double click the dialog..it shows the classwizard of that particular dialog.
Anu
|
|
|
|
|
Do you have any class for dialog?
|
|
|
|