|
BOOL IsUserAdmin(VOID)
/*++
Routine Description: This routine returns TRUE if the caller's process
is a member of the Administrators local group. Caller is NOT expected
to be impersonating anyone and is expected to be able to open its own
process and process token.
Arguments: None.
Return Value:
TRUE - Caller has Administrators local group.
FALSE - Caller does not have Administrators local group. --
*/
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
return(b);
}
Taken from MSDN
|
|
|
|
|
Good, thanks
-----------------
conglt
|
|
|
|
|
Radu Sorin wrote: Taken from MSDN
try NetUserGetInfo api
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
while using putcollect() to insert a record to sql,program abnormal termination and provide warning message like the title upon,but "Insert table .." is ok. why?
m_Record->MoveFirst();
m_Record->Delete(adAffectCurrent);
m_Record->Move((long)12);
m_Record->AddNew();
m_Record->PutCollect("ID",_variant_t((long)23));
m_Record->PutCollect(L"[Cage Number]",_variant_t((long)18));
m_Record->Update();
Lee
|
|
|
|
|
vDataType = m_inet.OpenURL(vURL,vType);
I am not able to OpenURl with this method.Can u please suggest what has to be done..
Rgds,
Aparna
|
|
|
|
|
What goes wrong ? What does you call return ?
~RaGE();
|
|
|
|
|
m_inet.Execute(vURL,fun,fun1,fun2);
where
tagVARIANT fun1;
fun1=m_inet.OpenURL(vURL,vType);
tagVARIANT fun;
CString dwSize;
fun.pcVal="GET";
tagVARIANT fun2;
fun2=m_inet.OpenURL(vURL,vType);
VARIANT vURL ;
vURL.vt = VT_BSTR ;
vURL.bstrVal= (BSTR) ("http://www.codeguru.com/forum/images/cg-logo.gif") ;
It is giving "cannot coerce type" error and OnStateChangedInet1 gives state as 11.
|
|
|
|
|
aparnakamath wrote: It is giving "cannot coerce type" error and OnStateChangedInet1 gives state as 11.
What actually you want to achieve
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I have to enumerate all toolbars attached to a window and programatically launch them(clicking), Cld you suggest a way to do this?
Currently am using EnumChildWindows() to get handle of the respective control attached to the window and GetWindowText() and can enumerate and launch all buttons attached to the window but not a toolbar.
e.g spy++ shows a toolbar on wordpad having class name ToolbarWindow32 and Toolbar window caption as ""
so i can't identify the particular toolbar to retrieve the handle of the toolbar in question and launch it using ::PostMessage(hwnd, BM_CLICK, 0, 0) as i can do all buttons etc attached to the window.
Waiting for a response.
Thanks.
Sincerely
Giftsana
|
|
|
|
|
|
Thank you for the reply.
Let me try it, but how do i identify the toolbar because ::GetWindowText() returns "" for a toolbar. so there is no means of identifying which toolbar is this to launch it i.e. simulating a button press?
Sincerely
Giftsana
|
|
|
|
|
Hello Michael
Thanks for the suggestion.
I used ::SendMessage(hwnd, TB_PRESSBUTTON, (WPARAM) (int) 222, TRUE) for programatically launching individual toolbar buttons using their controlid in this case (WPARAM) (int) 222, but the button click does not happen and it does not launch the asssociated button window. it greys the corresponding buttons and i can see the effect on the toolbar.
after getting the toolbar handle and indvidual toolbar buttons control id i want to perform a click on each button and launch their resp window programatically one after the other?
Am i missing something.Waiting for a suggestion.
Thanks in advance.
Sincerely
Giftsana
|
|
|
|
|
Hi
My scenario is:
For example developing a big project.You divide project to some pieces.And start to writing components.And then coding UI and binding them with your components.
You must disturb you exe with your dll's.But how can we restrain that other coders to use our dll's in your application.
I mean for example i installed sygate firewall.In its directory there are some dll's like:
IdsTrafficPipe.dll,Netport.dll,PSSensor.dll etc...
1-)Here how can we use like these dll's methods?(We can use win32api:system32.dll, gdi32.dll...)
2-)If i develop my application and make dll files to store my methods, how can i avoid to using these dll's other's by binding runtime?
Thanks.
|
|
|
|
|
hi all,
i have to dynamically increase the Dialog and its controls when the Dialog Box is Dragged. Any Solution.
please let me know.
thanks,
uday.
uday kiran
|
|
|
|
|
Hi kiran janaswamy,
Whats question?
|
|
|
|
|
check here^
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
See the "Extras" section of this article.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
How can I start an external program - probably an .exe file - in a C++ program. And which would be the best way to be sure the external program has finished?
|
|
|
|
|
Create to process using CreateProcess or ShellExecute (there are other options). Use WaitForSingleObject on the process HANDLE to wait till process has exited.
Steve
|
|
|
|
|
Hi MrChefman,
maybe it is some helpful to you
if you run an application from your program use
PROCESS_INFORMATION l_ProcessInfo;
STARTUPINFO l_StartupInfo;
ZeroMemory(&l_StartupInfo, sizeof(STARTUPINFO));
l_StartupInfo.cb = sizeof(STARTUPINFO);
l_StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
l_StartupInfo.wShowWindow = SW_SHOWMAXIMIZED;
CreateProcess(NULL,
"Notepad.exe",
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&l_StartupInfo,
&l_ProcessInfo);
}
|
|
|
|
|
To complete this example:
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
PROCESS_INFORMATION l_ProcessInfo;
STARTUPINFO l_StartupInfo;
ZeroMemory(&l_StartupInfo, sizeof(STARTUPINFO));
l_StartupInfo.cb = sizeof(STARTUPINFO);
l_StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
l_StartupInfo.wShowWindow = SW_SHOWMAXIMIZED;
if ( CreateProcess(NULL,
"Notepad.exe",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&l_StartupInfo,
&l_ProcessInfo))
{
CloseHandle(l_ProcessInfo.hThread);
WaitForSingleObject(l_ProcessInfo.hProcess, INFINITE); // Wait for it to finish.
CloseHandle(l_ProcessInfo.hProcess);
}
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Forgetting to close the handles is a common source of resource leaks.
Steve
|
|
|
|
|
|
Thanks a lot. But I still have a problem in Building the .exe file. Linking works but when trying to build the .exe there are errors:
unresolved external symbol _WinMain@16
I hope, my translation from the German version into English is right
I included both header-files windows.h and winbase.h into my win32-application-project.
Where is my mistake?
|
|
|
|
|
You must insert library Kernel32.lib to your project
-----------------
conglt
|
|
|
|
|
The linker is looking for the entry point for a console application, but the application is being compiled and linked as a windows application (i.e. not a console application).
This error has been observed after changing the project settings from using MBCS to UNICODE characters.
Under the project settings, under the ‘Link’ tab, category ‘output’, set the ‘Entry-point symbol’ to ‘wWinMainCRTStartup’.
|
|
|
|