|
Roger Stoltz wrote: I think Newcomer's site is a fantastic gold mine of information
That is exactly the point !
|
|
|
|
|
hINTModuleState wrote: That is exactly the point !
Enjoy!
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
In the past I thought that QueryPerformanceCounter achieves this by querying a counter that is incremented each time that a particular thread spends an addtional CPU cycle. It measure the CPU cycles from the turning on the PC, not "a particular thread" (this include all other threads).
You received the same result as Sleep, because ... well, Sleep is very accurate, that is why people use it instead of WM_TIMER.
Now to your question ... QueryPerformanceCounter will not do the job.
P.S. I doubt it cost a CPU time, as previously somebody stated, at least not more than WaitForSingleObject.
modified on Monday, November 24, 2008 10:39 AM
|
|
|
|
|
akirilov wrote: Sleep is very accurate, that is why people use it instead of WM_TIMER.
I'm sorry, but you are so incredibly wrong.
Using ::Sleep() is a common mistake and is almost always wrong.
Read more here[^] and here[^] before advising someone on this matter.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello,
I used the following procedure to find if the app is running under administrator account on XP:
IsUserAdmin()
{
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);
}
The problem is that it will always return FALSE when running on Vista even if the account is with administrator's rights. That's because of the UAC, I guess. But how to check the real account type?
Thank you.
|
|
|
|
|
mkoroudjiev wrote: The problem is that it will always return FALSE when running on Vista
It will return TRUE if the process is running on Vista AS an administrator.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
OK, this is obvious. But how to find whether an account is standard or administrator's if the user is running the app with non elevated privileges?
Martin
|
|
|
|
|
mkoroudjiev wrote: this is obvious
Not when your topic is "How to check if running under administrator account on Vista".
From the context of your app, it doesn't matter - if the app isn't running
elevated then even if an administrator is the invoker of the app, there's still
no administrative privileges for the app.
Checking if a user is a member of an administrator group is a different thing.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I understand your point. Any suggestions on how to check if a user is a member of an administrator group?
Thanks.
|
|
|
|
|
|
Hi All
How can i get installation path of application?
|
|
|
|
|
Well it all depends on the approach a developer takes.
Do you want to acquire the installation path of your application itself?
If yes, than you should have the source code and you must be writing it somewhere in the registry (ideally) or to some text file during the installation. You can read it from either of the places.
If it's the installation path of a third party application, that you need than you need to know before hand where they are writing it.
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
You can use GetModuleFileName to get the full path to your application.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Do you want to get the path of an installed application which is listed in the Add/Remove programs?
If yes, then,
Windows keep the un-installation information under this registry key - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall . Under this key for each item there will be DisplayName subkey, which holds the name of application and InstallLocation subkey, which holds the path of the installed application.
Refer this article[^] about how to iterate through the registry uninstall information and get those values.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I am using the listview in record view mode . Now I have selected the Listview row and it becomes blue . Now I want to remove the selection of this row without clicking on the list view . I want to write code on button click . is there any message to send to listview to diselect the row .
Ashish
|
|
|
|
|
See SetItemState & SetSelectionMark
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
not doing anything that I need . i.e. not diselecting the row
Ashish
|
|
|
|
|
How are you using them? Can you post some code...
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I select the listview row it get highlighted with blue color. Now what I want ,I want diselected the row i.e. not highlighted the row without clicking on the listview i.e. from button . for that I write the following code on the button click
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_LIST1),-1);
but nothing happen list view row is still selected.
Ashish
|
|
|
|
|
int i = m_list.GetSelectionMark();
ListView_SetItemState(m_list.GetSafeHwnd(),-1,LVIS_DROPHILITED,LVIS_STATEIMAGEMASK );
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
still not working . I could not where you are using i;
Ashish
|
|
|
|
|
you won't need to use i. The snippet was from a previous code and I just forgot to remove the GetSelectionMark() thing from the code before posting it. BTW it does work for me when I use it in ListView. Have you selected the property of always showing a selected item whatever the case may be. ie the user click out of the list view or otherwise
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
your code is still not working
ListView_SetItemState(GetDlgItem(hDlg,IDC_LIST1),-1,LVIS_DROPHILITED,LVIS_STATEIMAGEMASK );
Ashish
|
|
|
|
|
Hi,
I am working on a project and require the button coordinates of office applications. e.g. open, save etc. I am not interested in what the buttons do I just need to know where they are. The main toolbars are what I am really interested in. If anyone has any examples or can point me in the right direction that would be much appreciated.
Thanks
|
|
|
|
|
i want to fire leave event of a textbox when it's max length is exceeded , how can i call the event
|
|
|
|