I have an application which needs the UAC elevation.
I have the code which lets me give that but the application opens twice.. which is the issue..
so here i
Elevating your privileges is always going to start a new process. There is no way around that, other than starting with elevated privileges in the first place by setting your application to require administrative privileges. What you can do is end the application right after the elevated process starts, so that you only have one application running.
This scenario is usable for applications that only require certain parts of their function to be elevated - such as an automatically self-updating installer that needs access to Program Files - and not one that requires administrative access all the time.