|
Is the value you are tring to assing is CString ?
It looks like , you are facing similar situation, I faced in past.
Refer, this[^] post.
Though, I never got satisfactory answer.
|
|
|
|
|
Well, I'm using the _variant_t class to have a general solution for getting the values from the recordsetfields, but yes most of the times they are strings, but at that point of the execution I didn't converted them to CString.
I also tried without using _variant_t, using VARIANT and BSTR and _bstr_t. Though the place changes I still have memory leaks somewhere.
I also have issues with CString Allocbuffer.
I'm close to pulling my hair one by one. Have been playing with this for weeks now.
These functions are called on a separate thread, I'm using a jobmanager class I wrote. What I was thinking about lately it might by due to threading issues. Or is it general, but others haven't noticed yet?
I should build a single threaded test program.
|
|
|
|
|
How can I programatically remove a member from the Administrators group?
For your reference :
In Win XP, the Administrator members are accessible through Right click
'My Computer' -> Manage -> Computer Management (Local) -> System Tools ->
Local Users and Groups -> Groups -> Administrators (Double click)
Thanks in Advance
|
|
|
|
|
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
|
|
|
|