Click here to Skip to main content
15,913,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRTI - related (Zac Howland) can help [modified] Pin
Jay0310-Jul-06 4:43
Jay0310-Jul-06 4:43 
AnswerRe: RTI - related (Zac Howland) can help Pin
Zac Howland10-Jul-06 5:01
Zac Howland10-Jul-06 5:01 
GeneralRe: RTI - related (Zac Howland) can help Pin
Jay0310-Jul-06 5:16
Jay0310-Jul-06 5:16 
GeneralRe: RTI - related (Zac Howland) can help Pin
Jay0310-Jul-06 6:33
Jay0310-Jul-06 6:33 
GeneralRe: RTI - related (Zac Howland) can help Pin
Zac Howland10-Jul-06 6:54
Zac Howland10-Jul-06 6:54 
GeneralRe: RTI - related (Zac Howland) can help Pin
Jun Du10-Jul-06 7:20
Jun Du10-Jul-06 7:20 
AnswerRe: RTI - related (Zac Howland) can help Pin
earl10-Jul-06 7:24
earl10-Jul-06 7:24 
QuestionDeleting desktop shortcut while not administrator [modified] Pin
clemb10-Jul-06 4:04
clemb10-Jul-06 4:04 
Hi all,
My app needs to destroy a shortcut on the desktop (located in "AllUsers", running on Windows XP). Since the users are not administrators, I use the following code to connect with a dedicated admin account. The (existing) link to delete is "bcFile".
This code works fine with an administrator account and return with no error for normal users. In the later, the shortcut diseapear from the destop only to reappear when the end user press F5. I personnaly guess for a problem in the quotation marks from wCommand or wParams.


PROCESS_INFORMATION pi;
AnsiString sCommand = "C:\\windows\\system32\\cmd.exe";
int iBuffSize = sCommand.WideCharBufSize();
wchar_t* wCommand = new wchar_t[iBuffSize];
wCommand[0] = 0;
sCommand.WideChar(wCommand, iBuffSize);
AnsiString sParams = " del \"/C \"" + bcFile + "\"\" ";
wchar_t wParams[MAX_PATH + 1];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sParams.c_str(), -1, wParams, MAX_PATH);
AnsiString sUsername = "masteraccount";
AnsiString sDomain = "production";
AnsiString sPassword = "234l2k3j4";
if (CreateProcessWithLogonW(
static_cast<const wchar_t*>(sUsername.data()),
static_cast<const wchar_t*>(sDomain.data()),
static_cast<const wchar_t*>(sPassword.data()),
LOGON_NETCREDENTIALS_ONLY, wCommand,
wParams, 0, NULL, NULL, NULL, &pi) != 0) {
// Notify the shell for delete operation.
SHChangeNotify(SHCNE_DELETE, SHCNF_PATH, bcFile.c_str(), NULL);
}
else {
CustomErrorHandler(ERR_ABORT, ERR_DEL_SHORTCUT);
}

Any help on this or another way to do the shortcut delete will be appreciated.

-- modified at 8:34 Tuesday 11th July, 2006
AnswerRe: Deleting desktop shortcut while not administrator Pin
clemb21-Jul-06 4:51
clemb21-Jul-06 4:51 
QuestionGetting the Parent Window Handle Pin
HakunaMatada10-Jul-06 3:53
HakunaMatada10-Jul-06 3:53 
AnswerRe: Getting the Parent Window Handle Pin
Sarath C10-Jul-06 4:15
Sarath C10-Jul-06 4:15 
GeneralRe: Getting the Parent Window Handle Pin
HakunaMatada10-Jul-06 17:20
HakunaMatada10-Jul-06 17:20 
AnswerRe: Getting the Parent Window Handle Pin
Abhi Lahare10-Jul-06 4:15
Abhi Lahare10-Jul-06 4:15 
AnswerRe: Getting the Parent Window Handle Pin
FarPointer10-Jul-06 4:18
FarPointer10-Jul-06 4:18 
AnswerRe: Getting the Parent Window Handle Pin
ThatsAlok10-Jul-06 19:20
ThatsAlok10-Jul-06 19:20 
Questionlist control Pin
jokefake10-Jul-06 3:49
jokefake10-Jul-06 3:49 
AnswerRe: list control Pin
Sarath C10-Jul-06 4:17
Sarath C10-Jul-06 4:17 
AnswerRe: list control Pin
David Crow10-Jul-06 4:19
David Crow10-Jul-06 4:19 
GeneralRe: list control Pin
jokefake10-Jul-06 5:46
jokefake10-Jul-06 5:46 
GeneralRe: list control Pin
David Crow10-Jul-06 6:11
David Crow10-Jul-06 6:11 
GeneralRe: list control Pin
jokefake10-Jul-06 6:39
jokefake10-Jul-06 6:39 
QuestionRe: list control Pin
David Crow10-Jul-06 6:41
David Crow10-Jul-06 6:41 
AnswerRe: list control Pin
jokefake10-Jul-06 6:48
jokefake10-Jul-06 6:48 
GeneralRe: list control Pin
David Crow10-Jul-06 7:31
David Crow10-Jul-06 7:31 
GeneralRe: list control Pin
jokefake11-Jul-06 1:57
jokefake11-Jul-06 1:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.