Click here to Skip to main content
16,017,745 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEnumerating ODBC drivers... Pin
dandy721-Jun-05 8:25
dandy721-Jun-05 8:25 
GeneralRe: Enumerating ODBC drivers... Pin
trelliot1-Jun-05 22:13
trelliot1-Jun-05 22:13 
GeneralRe: Enumerating ODBC drivers... Pin
dandy722-Jun-05 3:18
dandy722-Jun-05 3:18 
QuestionTooltip without hwnd? Pin
Anonymous1-Jun-05 8:21
Anonymous1-Jun-05 8:21 
AnswerRe: Tooltip without hwnd? Pin
Christian Graus1-Jun-05 13:13
protectorChristian Graus1-Jun-05 13:13 
Generalpostmessage windclass Pin
pc_dev1-Jun-05 7:03
pc_dev1-Jun-05 7:03 
GeneralRe: postmessage windclass Pin
S. Senthil Kumar1-Jun-05 8:28
S. Senthil Kumar1-Jun-05 8:28 
GeneralRe: postmessage windclass Pin
racenjason1-Jun-05 12:01
professionalracenjason1-Jun-05 12:01 
If you know the location of the other program (XProgram's full path) it's much simpler then that. If you don't know the location..and technically this is the best method rather then hardcoding it in, have the other program write a "ThisIsXProgramsFilePath" registry entry in the InitInstance function (or somewhere that gets hit when XProgram is starting) that the controlling program can read (use a common registry folder...generally your business name). Then use this code from the program that wants control of XProgram:


CString csProgramsFilePath = ...get this from the registry as mentioned above
CWinProcessList process;
DWORD dwProcessID = 0;
DWORD dwProgramID = 0;
if(process.GetProcessInfo(csProgramsFilePath, dwProcessID, dwProgramID))
{
HANDLE hProg = OpenProcess(PROCESS_ALL_ACCESS, TRUE, dwProcessID);
if(hProg)
{
if(AfxMessageBox("I'm going to close this program...you OK with that?", MB_YESNO) == IDYES)
{
if(TerminateProcess(hProg, 0))
{
// The program is terminated
}
}
}
else // We failed to get a handle to the program
}
else // The program is most likely not running...or somehow we failed

GeneralRe: postmessage windclass Pin
ThatsAlok1-Jun-05 18:25
ThatsAlok1-Jun-05 18:25 
GeneralChange File's Accessed Time Pin
RedDragon2k1-Jun-05 7:02
RedDragon2k1-Jun-05 7:02 
GeneralRe: Change File's Accessed Time Pin
Toni781-Jun-05 8:24
Toni781-Jun-05 8:24 
GeneralHDC and CStatic control question Pin
Steve Messer1-Jun-05 6:54
Steve Messer1-Jun-05 6:54 
GeneralRe: HDC and CStatic control question Pin
David Crow1-Jun-05 7:02
David Crow1-Jun-05 7:02 
GeneralRe: HDC and CStatic control question Pin
Steve Messer1-Jun-05 7:10
Steve Messer1-Jun-05 7:10 
GeneralRe: HDC and CStatic control question Pin
David Crow1-Jun-05 7:30
David Crow1-Jun-05 7:30 
GeneralRe: HDC and CStatic control question Pin
Steve Messer1-Jun-05 7:38
Steve Messer1-Jun-05 7:38 
GeneralRe: HDC and CStatic control question Pin
Ryan Binns1-Jun-05 18:25
Ryan Binns1-Jun-05 18:25 
GeneralRe: HDC and CStatic control question Pin
Steve Messer13-Jun-05 20:38
Steve Messer13-Jun-05 20:38 
Generalworking with binary files in C++ Pin
knapak1-Jun-05 5:55
knapak1-Jun-05 5:55 
GeneralRe: working with binary files in C++ Pin
David Crow1-Jun-05 7:07
David Crow1-Jun-05 7:07 
GeneralRe: working with binary files in C++ Pin
knapak1-Jun-05 8:21
knapak1-Jun-05 8:21 
GeneralRe: working with binary files in C++ Pin
S. Senthil Kumar1-Jun-05 8:33
S. Senthil Kumar1-Jun-05 8:33 
GeneralRe: working with binary files in C++ Pin
knapak1-Jun-05 9:23
knapak1-Jun-05 9:23 
GeneralRe: working with binary files in C++ Pin
S. Senthil Kumar2-Jun-05 1:15
S. Senthil Kumar2-Jun-05 1:15 
GeneralRe: working with binary files in C++ Pin
knapak2-Jun-05 11:48
knapak2-Jun-05 11:48 

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.