|
Sorry, I did not make myself clear.
What I wanted was to have the horizontal scrollbar completely removed, ie it will never appear, not even appearing as the greyed out disabled scroll bar.
|
|
|
|
|
|
Hey guys,
I am trying to add a member into a group. A user and a group already
exists, but if I call this function, I get the system error code 1376:
The specified local group does not exist.
I recognized that if I call this function after creating a user it
success.
So what can I do here ???
see my code:
<br />
USES_CONVERSION;<br />
wchar_t *pswzGroup = T2W("A");<br />
wchar_t *pswzUser = T2W("X");<br />
<br />
LOCALGROUP_MEMBERS_INFO_3 localgroup_members;<br />
localgroup_members.lgrmi3_domainandname = pswzUser;<br />
<br />
nStatus=NetLocalGroupAddMembers(NULL,pswzGroup,3,(LPBYTE)&localgroup_members,1);<br />
<br />
if(nStatus == NERR_Success) return "Groups(s) added succesfully to the<br />
group.\r\n";<br />
if(nStatus == ERROR_ACCESS_DENIED) return "Access denied.\r\n";<br />
if(nStatus == NERR_GroupNotFound) return "The user does not have<br />
access to the requested information.\r\n";<br />
if(nStatus == ERROR_NO_SUCH_MEMBER) return "One or more of the members<br />
specified do not exist. Therefore, no new members were added.\r\n";<br />
if(nStatus == ERROR_MEMBER_IN_ALIAS) return "One or more of the<br />
members specified were already members of the local group. No new<br />
members were added.\r\n";<br />
if(nStatus == ERROR_INVALID_MEMBER) return "One or more of the members<br />
cannot be added because their account type is invalid. No new members<br />
were added.\r\n";<br />
else{<br />
CString str;<br />
str.Format("Error->Code: %d\r\n",nStatus);<br />
return str;<br />
}<br />
thanks, sonu
da sonu
|
|
|
|
|
Hi All,
I need to create an entry in the Visual C++ project options. Upon selecting this option the programmer would get a ready made template of our project with all the predefined methods, their return value and their parameters. The programmer would have to just add the code he wants it to perform in the specified space. Similar to what ATL does it for COM development. How do I add such a option in the VC++ environment. Where do I store the template specs. Kindly help me out in this.
Thanks,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
If you are using .NET, files in the folder ...\Microsoft Visual Studio .NET/Vc7/vcprojectitems show up in the "New Item" template list. I'm not sure if this is the "right" way to do it, but it works. If anyone knows the "right" way, let me know.
|
|
|
|
|
dear all,
how can i check the flag values which r set in a variable, say lParam in WM_QUERYENDSESSION.
i know i have to use & operator, but i'm not getting the results.
actually i want to detect windows shutdown and restart and take 2 different actions based on the 2 condition (restart and shutdown).
so how can i differtiate between a system shutdown and system restart.
this problem is getting to my head!
regards
|
|
|
|
|
long nAction;
if (lParam == 0)
nAction = SHUTDOWN;
else
if ((lParam & ENDSESSION_LOGOFF) == ENDSESSION_LOGOFF)
nAction = LOGOFF;
else
nAction = RESTART;
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Just like Windows Media Player itself can do?
Thanks
JW
DJ
|
|
|
|
|
Hello,
I have an assignment I am working on, I am stuck at a beggining point. Below is the code I am working with. This is pretty much what the professor gave us to start with, all I am trying to do right now is pass some values to the subroutine and then print them in the subroutine to confirm the values passed. We have to pass by value. I can print the values in the main fine, but then I always get zeroes in the subroutine. I have a lot more to do in the assignment, but have been stuck here. Any help would be greatly appreciated.
Thanks,
Paul
unsigned long adddouble(unsigned long x, unsigned long y)
{
printf("%ld %ld \n", x, y);
return(x+y); /* no interest at this time */
}
main()
{
double d1, d2, *dp;
unsigned long *longp1,*longp2, s;
scanf("%lf %lf", &d1, &d2); /* get two input real numbers */
printf("%lf %lf \n", d1, d2);
longp1 = (unsigned long *) &d1;
longp2 = (unsigned long *) &d2;
s = adddouble(*longp1,*longp2);
}
|
|
|
|
|
longp1 = (unsigned long *) &d1;
longp2 = (unsigned long *) &d2;
this is not good.
what you're doing here is setting a pointer to a long to point to the place where a double lives.
i don't really see why you need to use pointers for any of the longs. try it without.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Take it from a veteran...
Avoid casting whenever possible, even when you know what you are doing. Casting has always been and will always be a potent source of bugs.
|
|
|
|
|
I'm writting a client program that lock the keyboard, mouse until the server unlock it. How can I do that on Windows 9X, and Windows NT/2000/XP?
How can I prevent CTRL+ALT+DEL, ALT+TAB... and hide my client from task list?
Thanks for any idea.
|
|
|
|
|
wow, that would make a nice virus;)
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|
|
No, it's not a virus. It is a client program of an Internet Cafe Manager software.
Have you have any idea?
|
|
|
|
|
bpmtri wrote:
No, it's not a virus. It is a client program of an Internet Cafe Manager software.
I guess I am not understanding why you would want to lock the keyboard, don't these users need the keyboard
bpmtri wrote:
Have you have any idea?
I'll help you brainstorm. What OS will the users be using? This will help point in the right direction.
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|
|
I'm sorry. I have not described my problem clearly. I need to lock the keyboard (include special keys: CTRL+ALT+DEL, ALT+TAB...) and mouse to prevent the user from using the workstation without entering a valid ticket number.
On Windows 2000/XP, How can I prevent user pressing CTRL+ALT+DEL. And again, how can I hide my client from Task List on Windows 9X?
Thanks in advance.
|
|
|
|
|
WIN NT BASED OSes ONLY:
-----------------------
KEYBOARD AND MOUSE 1:
Take a look at "systemwide hooks" in MSDN in order to know how to prevent some system keystrokes and the mouse movements...
NOTES:
a system wide hook must be placed in a DLL in order to be systemwide and not application related. (its easier than what it seems).
I use to create two services (take a look at the VC++ assistant and create an ATL service) in order to use those DLL's (remember to keep some way to disbale those services using a password or something else...)
KEYBOARD AND MOUSE 2 (CTRL ALT DEL):
In order to capture those keystrokes, in NT you MUST write down a GINA DLL, this DLL is a security DLL that controls those kind of things, it's for security purposes, you cannot expect that an OS would be secure and to allow any programmer to execute any code that would be able to get the users passwords. (that DLL must be installed in the system and must be placed in it's own registry key).
PS:
Under win9x I remember I had readen something in the MSJ from PAul DiLascia that talked about preventing Ctrl Alt Del using a registry key... try to search for it...
Hope this helps
|
|
|
|
|
Joan Murt wrote:
KEYBOARD AND MOUSE 2 (CTRL ALT DEL):
In order to capture those keystrokes, in NT you MUST write down a GINA DLL, this DLL is a security DLL that controls those kind of things, it's for security purposes, you cannot expect that an OS would be secure and to allow any programmer to execute any code that would be able to get the users passwords. (that DLL must be installed in the system and must be placed in it's own registry key).
That's what I thought, until I saw this:
http://msdn.microsoft.com/msdnmag/issues/02/09/cqa/default.aspx
Seems it's not all that tricky unless you don't like a message box saying "Don't do this"
|
|
|
|
|
That's not a great idea (I think...)
1.
Policies can be modified by software, then, any program will be able to modify the policies and it can be dangerous for the user who would be working at admin level.
2.
Of course that this will be easier than making a new GINA, and depending on the scenery it can be very interesting.
Thank you, always is great to learn new things.
|
|
|
|
|
Using Windows API functions
g_hMsgHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)Msg_HookProc, hInst, 0);
and
g_hKeyHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Key_HookProc, hInst, 0);
you can hook (block) any keys in win9x/NT except ctrl+alt+del.
In win 9x ctrl+alt+del can be locked by SystemParametersInfo(SPI_SCREENSAVERRUNNING, TRUE, &g_bKillAllSysKeys, 0);
In NT ctrl+alt+del can be blocked by writing your own Gina.dll (exported function WlxLoggedOnSAS), but be carefull with Gina...
For more details, see description of these functions in MSDN
|
|
|
|
|
In my application, when I click the minimize button in the upper right corner nothing happens. When I click the maximize button, the application in minimized. I put the following code in CMainFrame, and when I debug, I find that it is never accessed when I click the minimize button. Any suggestions as to why the minimize button is being ignored would be appreciated.
tia
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
UINT nItemID = (nID & 0xFFF0);
switch (nItemID)
{
case SC_MAXIMIZE :
MessageBeep(0);
// Window is maximized.
break;
case SC_MINIMIZE:
MessageBeep(0);
// Window is minimized.
break;
}
// call default functionality
CWnd::OnSysCommand(nID, lParam);
}
|
|
|
|
|
Shouldn't it be: switch (nID)
Regards,
Alvaro
That which does not kill me postpones the inevitable. -- despair.com
|
|
|
|
|
Alvaro
Thanks for the observation. What happens, is that if I hold the cursor over the minimize button, there is no tooltip showing, and if I click it, I never get to OnSysCommand. If I hold the mouse over the maximize button, I get a minimize tooltip, and if I click the maximize button, the app minimizes, and I do get into OnSysCommand. If I hold the cursor just between the maximize button and the close button, I get a maximize tooltip, and if I click, i go into OnSysCommand. Its as if XP is not recognizing the location of the buttons. This only happens with XP. With Win98, it works as it should.
bob
|
|
|
|
|
There is no problem with your code.
You have to check the following 2 conditions
1.Did u added in the Message handler?
BEGIN_MESSAGE_MAP()
ON_WM_SYSCOMMAND()
END_MESSAGE_MAP()
2.Did u declare the fn in .h file?
void OnSysCommand(UINT,LPARAM);
|
|
|
|
|
Yes I did both. The problem is that the maximize button is being treated as if I had clicked the minimize button, while when I click the minimize button nothing happens, and if I click exactly between the maximize buttonb and the close button the application maximizes. This only happens when I run the app under XP. I put this OnSysCommand code in to see if I could figure out what was happening
thanks
bob
|
|
|
|
|