|
You can use of CString::Find.
|
|
|
|
|
lpVCcode wrote: Now i want to read Mr. As and Mr. Pc Name only.How can i read this.
Use AfxExtractSubString() in ab .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
is there some way to check status of printer(selected from CPrintdialog selection) means either its Ready, offline or unable to connect with server ??
like GetDeviceName() gives name of printer but how to check its status.........
pls help
|
|
|
|
|
|
thanks for da reply i will check it
|
|
|
|
|
ani_ikram wrote: is there some way to check status of printer...
What about calling GetPrinter(hPrinter, 2, ...) ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
My reqirement is to change admin rights user to limited account user. I tried to change admin rights to limited user account using NetUserSetInfo(). But wasnt succeeded in that.
so please help me out in this scenario. How would I accomplish it?? Any help would be greatly appreciated.
Thanks.
Hemang
|
|
|
|
|
Hemang Raval wrote: I tried to change admin rights to limited user account using NetUserSetInfo(). But wasnt succeeded in that.
What did NetUserSetInfo() return?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
It has returned error code 87. Having been referred to MSDN, i came to know that this error code indicates that one of the functions parameter is invalid. But i am not having an idea about which parameter i am passing wrong.
Any clue?? Your help would be greatly appreciated.
Thanks
Hemang
|
|
|
|
|
|
void ChangeUserPrivilege(LPWSTR csUser, DWORD csPrivilege)
{
NET_API_STATUS nStatus;
USER_INFO_1 ui1005;
DWORD dwLevel1005 = 1005;
DWORD dwPrivilege = 0;;
wchar_t *pswzUser = csUser;
if(csPrivilege == 2) dwPrivilege = USER_PRIV_USER;
ui1005.usri1_priv = dwPrivilege;
nStatus = NetUserSetInfo(NULL,pswzUser,dwLevel1005,(LPBYTE)&ui1005,NULL);
if(nStatus != NERR_Success)
// MessageBox(hwnd, (LPCWSTR)"Failed", (LPCWSTR)"Test", NULL);
fprintf(stderr, "NetUserGetinfo failed with error: %d\n", nStatus);
}
I am using above code to change admin rights user to limited rights user. Is it possible with this code.
Thanks
|
|
|
|
|
Hi
I need to get the name of the local system Administrator (System is in the domain). As that name however appears in the ControlPanel->"UserAccounts" list or ControlPanel->AdministrativeTools->ComputerManagement->LocalUser and Groups->Groups and clicking on "Administrators" Group, I am trying to list out all the users under "Administrators" Group and for this purpose I am using NetLocalGroupGetMembers() and including lmaccess.h file. But I am getting the linker error "error LNK2001: unresolved external symbol _NetLocalGroupGetMembers@32". Doesn't this header file "lmaccess.h" come with Visual Studio?
Using ADSI, I can get the members of an "Administrators" group (local system) , however, that list doesn't include the name of the the local system administrator , who is a member in the domain.
Is there anyother alternative mechanism/function to get the local system Administrator Name?
Thanks in Advance.
Taruni
|
|
|
|
|
You need to add Netapi32.lib to your project.
If you are using VS6, take
project settings->Link Tab and in that you can find a edit box "Object/library modules". Enter Netapi32.lib in it.
|
|
|
|
|
Thank You Naveen. The linker error has gone.
Is there any other alternative function to get the local system administrator?
Taruni
|
|
|
|
|
Whats wrong with this function?
|
|
|
|
|
I am unable to understand as how to enumerate the users list.
Taruni
|
|
|
|
|
sample code:
LPLOCALGROUP_MEMBERS_INFO_1 pstMembersInfo = 0;
DWORD entriesread = 0;
DWORD totalentries = 0;
if( 0 != NetLocalGroupGetMembers( NULL, _T("Administrators"), 1, (LPBYTE*)&pstMembersInfo,
MAX_PREFERRED_LENGTH, &entriesread, &totalentries, 0 ))
{
AfxMessageBox( _T("NetLocalGroupGetMembers failed !"));
return ;
}
for( DWORD dwIdx =0; dwIdx < entriesread; dwIdx ++ )
{
AfxMessageBox( pstMembersInfo[dwIdx].lgrmi1_name );
}
NetApiBufferFree( pstMembersInfo );
|
|
|
|
|
Thank you Naveen for the great help.
Taruni
|
|
|
|
|
What does that have to do with using another function? Regardless of how the list is obtained, wouldn't you still need to iterate through it?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Taruni wrote: I am getting the linker error "error LNK2001: unresolved external symbol _NetLocalGroupGetMembers@32". Doesn't this header file "lmaccess.h" come with Visual Studio?
Yup sure does, that's why it's a linker error and not a compile error that you're getting.
You'll have to link the netapi32.lib to get access to the function.
Yeah, what Naveen said.
|
|
|
|
|
Is it possible (and a rationale design) to show a menu on right-click of the list box item of a combo box and remove
the item by clicking a menu item say 'Remove Item'.
Any similar help material/article are welcome.
Thanks in Advance.
|
|
|
|
|
|
I was wondering if someone could look at my code and tell me why when i try to get the average of the array it wont give me the average. It compiles, the only problem is the sum and average are the same. here is my code
// LanusArrays.cpp : Defines the entry point for the console application.
// Corey Lanus
// Test 2 Part 2
// Lanus Arrays
// Does a lot of things dealing with arrays.
// October 16, 2006
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
const int ARRAY_SIZE = 20;
int numbers[ARRAY_SIZE];
int count;
ifstream inputFile;
inputFile.open("numbers.txt");
for (count = 0; count < ARRAY_SIZE; count++)
inputFile >> numbers[count];
inputFile.close();
int total = 0;
for (int count = 0; count < ARRAY_SIZE; count++)
total += numbers[count];
cout << "The sum of the numbers is: "<< total << endl;
cout << endl;
double total2 = 0;
double average;
for (int count = 0; count < ARRAY_SIZE; count++)
total2 += numbers[count];
average = total2 / ARRAY_SIZE;
cout << "The average of the numbers is: "<< total2 << endl;
cout << endl;
int highest;
highest = numbers[0];
for (count = 1; count < ARRAY_SIZE; count++)
{
if (numbers[count] > highest)
highest = numbers[count];
}
cout << "The highest number is: " << highest << endl;
cout << endl;
int lowest;
lowest = numbers[0];
for (count = 1; count < ARRAY_SIZE; count++)
{
if (numbers[count] < lowest)
lowest = numbers[count];
}
cout << "The lowest number is: " << lowest << endl;
cout << endl;
cout << "The numbers are: ";
for (count = 0; count < ARRAY_SIZE; count++)
cout << numbers[count] << " ";
cout << endl;
cout << "The numbers are:\n ";
for (count = 0; count < ARRAY_SIZE; count++)
cout << numbers[count] << " \n";
cout << endl;
return 0;
}
|
|
|
|
|
The following code
average = total2 / ARRAY_SIZE;
cout << "The average of the numbers is: "<< total2 << endl;
should be
average = total2 / ARRAY_SIZE;
cout << "The average of the numbers is: "<< average << endl;
Sohail
modified 21-Apr-21 21:01pm.
|
|
|
|
|
thanks I cant believe I missed something so small
|
|
|
|