Click here to Skip to main content
15,904,415 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Load bitmap from a file Pin
David Crow10-Aug-05 2:44
David Crow10-Aug-05 2:44 
GeneralRe: Load bitmap from a file Pin
Jose Lamas Rios9-Aug-05 9:36
Jose Lamas Rios9-Aug-05 9:36 
GeneralRe: Load bitmap from a file Pin
mpastchenko9-Aug-05 12:09
mpastchenko9-Aug-05 12:09 
GeneralRe: Load bitmap from a file Pin
PJ Arends9-Aug-05 12:06
professionalPJ Arends9-Aug-05 12:06 
GeneralRe: Load bitmap from a file Pin
mpastchenko9-Aug-05 13:04
mpastchenko9-Aug-05 13:04 
GeneralRe: Load bitmap from a file Pin
Christian Graus9-Aug-05 13:45
protectorChristian Graus9-Aug-05 13:45 
GeneralRe: Load bitmap from a file Pin
PJ Arends9-Aug-05 15:25
professionalPJ Arends9-Aug-05 15:25 
Generalnon-admin logins prevent program execution Pin
elephantstar9-Aug-05 7:40
elephantstar9-Aug-05 7:40 
I am trying to launch a program executable(Program A) from another program's menu (Program B). I coded the program B such that it searches the registry for the installation path of program B's executable. This works fine under an administrator login but not for non-admins. I thought it was because I did not grant proper security access by adding KEY_READ to the following line of code:

bRetVal = regKey.Open(HKEY_LOCAL_MACHINE ,(LPCTSTR)strTmp, KEY_READ);

But when I do include KEY_READ, under an admin login, the above code fails. Why is that? For non-admins, it fails either way. The entire code is shown below. Thanks!

CProgramB::Notify(DataNotificationType notifyType, VARIANT data)
{

STARTUPINFO stStartUpInfo;
PROCESS_INFORMATION pProcessInfo;

memset(&stStartUpInfo, 0, sizeof(STARTUPINFO));

stStartUpInfo.cb = sizeof(STARTUPINFO);
stStartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
stStartUpInfo.wShowWindow = SW_SHOWDEFAULT;

CRegKey regKey;
BOOL bRetVal;
CString strTmp = "Software\\ProgramA";

if (bRetVal==ERROR_SUCCESS)
{
CString key = "InstallDir";
char getValue[256] ;
DWORD d = 255;
bRetVal=regKey.QueryValue( getValue , (LPCTSTR)key , &d);
if (bRetVal==ERROR_SUCCESS)
{
char comLine[300];
CString keyValue = (CString)getValue;
strcpy(comLine, keyValue);
strcat(comLine, "programA.exe");
CreateProcess(NULL, comLine, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &stStartUpInfo,
&pProcessInfo);
}
else
AfxMessageBox("Query Failed");
}
else
{
AfxMessageBox( "Program Fail to open.");
}
regKey.Close();
return S_OK;
}

GeneralRe: non-admin logins prevent program execution Pin
David Crow9-Aug-05 7:58
David Crow9-Aug-05 7:58 
QuestionPlease enter the path for vc60.pdb?? Pin
valerie999-Aug-05 7:33
valerie999-Aug-05 7:33 
AnswerRe: Please enter the path for vc60.pdb?? Pin
David Crow9-Aug-05 7:44
David Crow9-Aug-05 7:44 
GeneralRe: Please enter the path for vc60.pdb?? Pin
valerie999-Aug-05 7:57
valerie999-Aug-05 7:57 
GeneralRe: Please enter the path for vc60.pdb?? Pin
David Crow9-Aug-05 8:00
David Crow9-Aug-05 8:00 
GeneralRe: Please enter the path for vc60.pdb?? Pin
valerie999-Aug-05 8:11
valerie999-Aug-05 8:11 
GeneralProblem with bitmaps in XP Pin
djr_apd9-Aug-05 6:17
djr_apd9-Aug-05 6:17 
GeneralCButton disable/focus conundrum Pin
23_4449-Aug-05 6:09
23_4449-Aug-05 6:09 
GeneralRe: CButton disable/focus conundrum Pin
Ravi Bhavnani9-Aug-05 6:54
professionalRavi Bhavnani9-Aug-05 6:54 
GeneralRe: CButton disable/focus conundrum Pin
Blake Miller9-Aug-05 7:29
Blake Miller9-Aug-05 7:29 
GeneralRe: CButton disable/focus conundrum Pin
23_4449-Aug-05 7:33
23_4449-Aug-05 7:33 
GeneralRe: CButton disable/focus conundrum Pin
David Crow9-Aug-05 8:15
David Crow9-Aug-05 8:15 
GeneralRe: CButton disable/focus conundrum Pin
23_4449-Aug-05 8:23
23_4449-Aug-05 8:23 
GeneralRe: CButton disable/focus conundrum Pin
David Crow9-Aug-05 8:28
David Crow9-Aug-05 8:28 
GeneralRe: CButton disable/focus conundrum Pin
23_4449-Aug-05 8:55
23_4449-Aug-05 8:55 
GeneralRe: CButton disable/focus conundrum Pin
23_44410-Aug-05 7:46
23_44410-Aug-05 7:46 
GeneralRe: CButton disable/focus conundrum Pin
Blake Miller12-Aug-05 5:07
Blake Miller12-Aug-05 5:07 

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.