|
to go a little further -- how does the whole world of UAC apply to services?
How would a service go about getting admin priveleges?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: I looked at autoElevate -- Microsoft looks quite restrictive on that, as most of their own apps aren't allowed to use it.
As it should be.
Peter Weyzen wrote: Is my only recourse here to tell the user they "can't have it" unless they elevate it or disable UAC?
Correct. In my opinion the UAC changes are just as much a cultural change as a functional change. In my opinion both Windows users and developers have really bad habits. I have never hear any Unix/Linux develpers complain because they don't automatically have root access.
Peter Weyzen wrote: Are there any runtime API's which I can call to request elevation of the process? Or, is it the case that the security mode cannot change once the app has started?
A process with a restricted token cannot impersonate a higher access level. You will have to deal with the UAC prompts if you continue to use functions which require administrative access. You could however use an elevated DCOM component or an out-of-process COM server with broker functions.
Some documentation:
Redesign for UAC Compatibility[^]
How Access Tokens Work[^]
The COM Elevation Moniker[^]
Best Wishes,
-David Delaune
|
|
|
|
|
UAC is a good thing -- I think process security is an important thing.
But think about me. I write backup software, and I want to add "volume shadow copy" support to my stuff.
When UAC is in place, I am denied access to it to the shadow services...
Is there a way the user can get backup rights without getting into the UAC mess?
(for me it's a mess)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
I need to know what the Active Page is before the User goes to another Page. The reason for this, I need to collect the data on the Page the User just left. I may need to insert the data the User entered on the Previous Page into the Page the User has selected to go to next. This is not a "Wizard" type CPropertySheet!
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
Supperman wrote: "Use CPropertySheet::GetActivePage[^] to get the active CPropertyPage object. "
Remember, I may want to display data to the now Active Page BEFORE it is presented. I need to be able to do that!
How do I stop the showing of a selected Page before I have a chance to update the Data that may need to be displayed on the selected page?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Override the OnKillActive method in the property page derived class.
From here you can communicate with the property sheet class using messages or events.
The property sheet class can then act as a mediator to copy the necessary data.
|
|
|
|
|
As he said:
OnSetActive and OnKillActive should be overridden on each panel. When you exit one panel, OnKillActive is called -- at that point save data from that panel... then on the new panel OnSetActive can load the data needed.
I do this all the time, it works great!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Yes, that works great. Thanks.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Hi
I am trying to understand how to solve this one:
There is given a table with clients and products
Like that
client_code product_code1
client_code product_code2
client_code product_code3
Each row has client code and product code.
Table is sorted according to clients.
Program should count how many times given client bought products.
Unfortunately it should be done with pessimistic complexity O(log n)
where n is amount of elements in the table.
Any ideas?
|
|
|
|
|
I assume you are storing this information in a container that supports iteration.
Cowork wrote: Each row has client code and product code.
Table is sorted according to clients.
Program should count how many times given client bought products.
So client details will be repeated as one client can purchase multiple products?
With your current storage structure, it is tough to get O(log n) complexity. Work with std::lower_bound to get an iterator to the element matching search criteria. This does a binary search and will have logarithmic complexity. Now move the iterator forward and increment a counter until you reach to a different client. This will have linear complexity.
If you can arrange your data in such a way that client holds the products he purchased, you can get the information easily. std::lower_bound will give the client and call a method on it to get the products purchased. This will lead into logarithmic complexity.
I hope you are aware that binary search is slow on collections that has few items. I believe mixing linear search and binary search depending on the container size will give you better performance.
Best wishes,
Navaneeth
|
|
|
|
|
I am sorry
Would you please explain more clearly how can I use binary search to _count_ products bought by the same client ?
As far as I understand it ,it only allows me to find given element in a table (if the element exists in the table)
Thanks
|
|
|
|
|
What do you meant by table? Are you referring to a database table? What data structure are you using to keep the records?
Cowork wrote: how can I use binary search to _count_ products bought by the same client ?
I have explained it in the first post. Please check that.
Cowork wrote: ,it only allows me to find given element in a table (if the element exists in the table)
From there you need to move forward and increment a counter until you reach on a different client. When you find a different client stop iterating and just report the counter value. This will have linear complexity. If you need logarithmic complexity, rearrange your data like I said in the other post.
Best wishes,
Navaneeth
|
|
|
|
|
Hi friends.
How my parent window class could be notified of its child's windows movement?
a code block could be more useful.
|
|
|
|
|
I am assuming that you are using C++. Here is how I would solve the problem. When the child window is created, you should save a pointer to the class that represents the parent window. When
the child window gets the message that it has moved (WM_MOVE) it can call a function (method)
in the parent window notifying the parent.
I am not sure that I answered your question. I think I could give you a better answer if I knew
a little bit more about your application such as what tools you are using to program the GUI?
Are you using SDK, MFC, or something else? Feel free to ask a follow up question.
Bob
|
|
|
|
|
Thanks for your suggestion of course the olution above works fine.
And I am using MFC Application Programming if there is any other solution (for exapmle MFC built-in solution) It would be more better.
|
|
|
|
|
I do not know of any MFC built-in solution for this problem.
Bob
|
|
|
|
|
Hi, everyone!
I build the exe file for a program. When I start this exe to do one particular task, it takes different time to finish the task with the same settings and the same results.
How can this happen?
|
|
|
|
|
There's a lot more going on besides your program - take a look at the Taks Manager and see how many processes are running on your machine.
The processor time allotted to your program by the OS is varying due to other demands on the system. To get truly repeatable results, you'd have to eliminate every other task consuming processor cycles.
|
|
|
|
|
I think the group could give you a better answer if they knew a little more. Here are some things
I would like to know:
1) How long does the program take?
2) How much is the variation in time?
3) Is it CPU bound? Is it disk bound?
4) How are you measuring the time it takes to run?
I will also make some general comments. If the time varies by less than 10%, I would call that insignificant. Also, if the running time is very small (say under 30 seconds) it is difficult to get accurate measurements. Also, if you run the same program twice in a row, the second run will often take less time because the program is already in memory. What I am trying to say is that if you want accurate timings you need to be very carefully about what you do.
Bob
|
|
|
|
|
I build a release version exe program in MFC for image segmentation.
I start the exe.
I open an image and a child window appears, after the command for segmentation is executed, the time is recorded. Note I use the same setting in each run and stop all irrelevant programs in computer.
I do this operation several times and record time expense for each run.
here are a list of time expense:
first, 2.609s;
second,3.297s;
third, 3.469s;
fourth,3.406s---.
They vary mysteriously!
If I restart this exe, the time for the first run also changes, but the first runs always spend less time than later runs.
If I want to get stable time expense, What should I do to improve my code?
|
|
|
|
|
First, I want to be honest with you, I do not know what is going one. Therefore, what
I am going to suggest is probably wrong. One possibility is that your code makes heavy
use of dynamic memory allocation and that the heap is not in the best of shape. Therefore, later runs take more time.
Another possibility is that the times you are seeing are not quite right. That is, they are only accurate with a second. I am also wondering if it could be machine specific. Does it exhibit this behavior on more than one machine?
By the way, if it was my program, I would not worry about this variation in time. I hope this helps.
Bob
|
|
|
|
|
|
|