Assigning administrator rights to an application requires administrative privileges. So while it does not have these, you can't change it. And you can not elevate the privileges of a running process.
You can use a manifest to specify that your application should run elevated, use the "runas" command or start other applications elevated from within your program. But in all these cases there will be a UAC prompt.
UAC is there for a reason. It is a security feature. The user decides which level of security should be used. An application can not bypass these settings.
l want to ask how l can do the following things in a tab control.
1)That is, for instance: In tab1, when a button is clicked, previous text is wiped and another is written. l had tried but all the texts overlaps and none cleanses off fornew texts.
2)How can l erase the content of a tab control when l switch tabs. As in, when tab2 is clicked, contents in tab1 clears off and the things in tab2 only shows.
When you get the TCN_SELCHANGE notification (in a WM_NOTIFY message) you have to clear or hide the contents of the old tab and show the contents of the new tab yourself - the API doesn't help you with it.
1. MFC class CWinThread does not have a member of the CAsyncSocket type. Perhaps, you meant that you created a CWinThread derived class which contain a CAsyncSocket derived object?
2. To handle CAsyncSocket notifications you have to override the CAsyncSocket::OnSend, CAsyncSocket::OnReceive and probably other virtual methods. See MSDN article Windows Sockets: Socket Notifications[^]
I sent him a e-mail earlier about the problem my workaround was to save the threadid before doing the connect After getting the notification I did a PostThread to the Thread did the connect
Joe said that the reason this Happened (getting the notification to the Main Thread)
Because I had declared my CAsynSocket Class on the Stack e.g. CAsynSocket mysocket.
As opposed to the heap CAsynSocket *mysocket
I've got my program associated with a file extension and clicking on a file of that type in Windows Explorer will open the program and load that file. All's well so far. Now I need to be able to click on another file of the type from WE and load that file into the same instance of the program already running. What happens now when I click on another file is the focus just switches to the program and nothing loads.
When the program isn't running and you click on a file associated with it, the program starts and in the loading of the App instance you check the command line, which is loaded into a CCommandLineInfo structure and the program deals with the command. I can't figure out how to get the second file to load when the program is already running by selecting it in WE (opening a file from within the program has been working fine from the start).
I have looked at WM_ACTIVATE and WM_ACTIVATEAPP which are called when the program gets focus while running, but I don't know how you would get the information about the file just selected in Windows Explorer. I'm probably missing some key terminology in my searches. I can't find any information on how to do this. Maybe I'm slow kid in class today...
Additionally if I select multiple files in Windows Explorer and open them at the same time, it opens multiple instances of the program instead of opening one instance any loading those files into that one instance. Is there any way to handle that?
The Explorer will scan the registry searching for the application name associated with the file extension. When found it reads the shell/open keys and checks if there are entries for command, ddeexec, and DropTarget. Then it will use the found method with the highest priority to pass the data (file names) to your application after starting it if necessary.
Nothing must be installed in the Explorer. You must only create the registry keys and add code to your application to handle the data (the code for basic command handling is already present). Other file browsers should do it like the Explorer.
One reason why IDropTarget was choosen is explained in the link:
This method leverages an application's existing drop target implementation (if one exists), making it easy for applications that already support drag-and-drop through an IDropTarget implementation on their top level window to map that functionality into a verb that ise presented in the explorer.
I don't think Word is still using DDE (while old versions probably used it). It will probably use IDropTarget.
Last Visit: 31-Dec-99 19:00 Last Update: 19-Jan-21 17:59