Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Execute a function using command line parameters. Pin
CodingLover17-Jan-08 23:03
CodingLover17-Jan-08 23:03 
GeneralRe: Execute a function using command line parameters. Pin
CPallini17-Jan-08 23:09
mveCPallini17-Jan-08 23:09 
GeneralRe: Execute a function using command line parameters. Pin
CodingLover22-Jan-08 18:41
CodingLover22-Jan-08 18:41 
GeneralRe: Execute a function using command line parameters. [modified] Pin
CPallini22-Jan-08 21:15
mveCPallini22-Jan-08 21:15 
GeneralRe: Execute a function using command line parameters. Pin
CodingLover22-Jan-08 21:41
CodingLover22-Jan-08 21:41 
GeneralRe: Execute a function using command line parameters. Pin
CPallini22-Jan-08 21:49
mveCPallini22-Jan-08 21:49 
GeneralRe: Execute a function using command line parameters. Pin
CodingLover22-Jan-08 22:14
CodingLover22-Jan-08 22:14 
GeneralOpening a running process programmatically Pin
lctrncs17-Jan-08 18:46
lctrncs17-Jan-08 18:46 
I am a beginner who wants to restore the main window of a clock program that resides in the System Tray when running. What I want to do programatically is done normally by right clicking on the clock program's icon in the System Tray, then selecting "Restore Main Window" from the context menu.

I have tried many things, and the closest I can get is using SetForegroundWindow, which will only work when I have already selected "Restore Main Window" from the context menu and then minimized the restored main window.

I think I must be missing some fundamental concept about what I am trying to do.

Consider the pseudocode below...

void MyApp::OnLaunchSysTrayApp<br />
{<br />
CWnd*m_hWnd = FindWindow(NULL, "System Tray Application Name")<br />
if (m_hWnd)<br />
{<br />
m_hWnd->SetForegroundWindow();   //Displays restored main window if not on top<br />
//m_hWnd->GetWindow(NULL);       //Fails<br />
//m_hWnd->ShowWindow(SW_RESTORE);    //Fails<br />
//m_hWnd->SetActiveWindow();    //Fails<br />
<br />
BOOL m_bIconic;<br />
m_bIconic=m_hWnd->IsIconic()<br />
if (m_bIconic)<br />
{<br />
//m_hWnd->GetWindow(NULL);       //Fails<br />
//m_hWnd->ShowWindow(SW_RESTORE);    //Fails<br />
//m_hWnd->SetActiveWindow();    //Fails<br />
} etc.<br />
}<br />
}<br />
<br />


I would appreciate any suggestions about how I might achieve my goal, or information about whatever basic concept I (probably) currently fail to understand.

Thank you.

"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash

GeneralRe: Opening a running process programmatically Pin
Iain Clarke, Warrior Programmer18-Jan-08 2:34
Iain Clarke, Warrior Programmer18-Jan-08 2:34 
GeneralRe: Opening a running process programmatically Pin
Member 75496018-Jan-08 7:37
Member 75496018-Jan-08 7:37 
GeneralFull screen stop function Pin
gentleguy17-Jan-08 17:48
gentleguy17-Jan-08 17:48 
GeneralRe: Full screen stop function Pin
Hamid_RT17-Jan-08 17:56
Hamid_RT17-Jan-08 17:56 
GeneralRe: Full screen stop function Pin
gentleguy17-Jan-08 18:04
gentleguy17-Jan-08 18:04 
GeneralRe: Full screen stop function Pin
Nishad S17-Jan-08 19:38
Nishad S17-Jan-08 19:38 
GeneralRe: Full screen stop function Pin
gentleguy17-Jan-08 20:19
gentleguy17-Jan-08 20:19 
GeneralRe: Full screen stop function Pin
Cedric Moonen17-Jan-08 20:33
Cedric Moonen17-Jan-08 20:33 
GeneralRe: Full screen stop function Pin
Nishad S17-Jan-08 23:37
Nishad S17-Jan-08 23:37 
QuestionRe: Full screen stop function Pin
David Crow18-Jan-08 2:52
David Crow18-Jan-08 2:52 
GeneralSDI Document Pin
msr_codeproject17-Jan-08 17:23
msr_codeproject17-Jan-08 17:23 
GeneralRe: SDI Document Pin
Cedric Moonen17-Jan-08 20:34
Cedric Moonen17-Jan-08 20:34 
GeneralSDI Document Pin
msr_codeproject17-Jan-08 20:44
msr_codeproject17-Jan-08 20:44 
GeneralRe: SDI Document Pin
Iain Clarke, Warrior Programmer18-Jan-08 2:45
Iain Clarke, Warrior Programmer18-Jan-08 2:45 
GeneralCFile title Pin
CodingLover17-Jan-08 16:41
CodingLover17-Jan-08 16:41 
GeneralRe: CFile title Pin
Iain Clarke, Warrior Programmer18-Jan-08 2:48
Iain Clarke, Warrior Programmer18-Jan-08 2:48 
GeneralRe: CFile title Pin
David Crow18-Jan-08 2:57
David Crow18-Jan-08 2: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.