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

C / C++ / MFC

 
AnswerRe: disply Pin
Super Lloyd8-Aug-09 0:23
Super Lloyd8-Aug-09 0:23 
AnswerRe: disply Pin
Code-o-mat8-Aug-09 5:07
Code-o-mat8-Aug-09 5:07 
QuestionVirtual Driver Development Pin
Sipder7-Aug-09 20:50
Sipder7-Aug-09 20:50 
AnswerRe: Virtual Driver Development Pin
Super Lloyd8-Aug-09 0:28
Super Lloyd8-Aug-09 0:28 
QuestionProblem with use of Mutex and System Tray Icon Together. Pin
Le@rner7-Aug-09 19:03
Le@rner7-Aug-09 19:03 
AnswerRe: Problem with use of Mutex and System Tray Icon Together. Pin
«_Superman_»7-Aug-09 19:25
professional«_Superman_»7-Aug-09 19:25 
GeneralRe: Problem with use of Mutex and System Tray Icon Together. Pin
Le@rner7-Aug-09 19:49
Le@rner7-Aug-09 19:49 
AnswerRe: Problem with use of Mutex and System Tray Icon Together. Pin
Randor 7-Aug-09 20:44
professional Randor 7-Aug-09 20:44 
"_$h@nky_" wrote:

i want when application is already running or its hide than if i click on exe than the hide application show.
please tell me how can i do this.
if possible please explain me with any example .


One option is to use the FindWindow Function[^] to retrieve a handle to the top-level window of your target application instance. Something like this:

HANDLE hMutex = ::CreateMutex(NULL, TRUE, _T("YOUR_GUID"));
if(ERROR_ALREADY_EXISTS == GetLastError())
{
	TCHAR szCaption[MAX_PATH];
	LoadString(m_hInstance,AFX_IDS_APP_TITLE,szCaption,MAX_PATH);
	
	CWnd* pwndFirst = CWnd::FindWindow(NULL,szCaption);
	if (pwndFirst)
	{
		CWnd* pwndPopup = pwndFirst->GetLastActivePopup();								   
		pwndFirst->SetForegroundWindow();
		if (pwndFirst->IsIconic())
		{
			pwndFirst->ShowWindow(SW_SHOWNORMAL);
			pwndFirst->PostMessage(WM_SYSCOMMAND, SC_MAXIMIZE);
		}
		if (pwndFirst != pwndPopup)
		{
			pwndPopup->SetForegroundWindow();
			pwndPopup->PostMessage(WM_SYSCOMMAND, SC_MAXIMIZE);
		}
	}
}


Best Wishes,
-David Delaune
GeneralRe: Problem with use of Mutex and System Tray Icon Together. Pin
Le@rner7-Aug-09 22:30
Le@rner7-Aug-09 22:30 
GeneralRe: Problem with use of Mutex and System Tray Icon Together. Pin
PJ Arends8-Aug-09 6:34
professionalPJ Arends8-Aug-09 6:34 
GeneralRe: Problem with use of Mutex and System Tray Icon Together. Pin
Randor 8-Aug-09 6:52
professional Randor 8-Aug-09 6:52 
GeneralRe: Problem with use of Mutex and System Tray Icon Together. Pin
PJ Arends8-Aug-09 8:09
professionalPJ Arends8-Aug-09 8:09 
GeneralRe: Problem with use of Mutex and System Tray Icon Together. Pin
Randor 9-Aug-09 11:39
professional Randor 9-Aug-09 11:39 
Questionsome confuse about compatible DC and compatible Bitmap Pin
xtwgigu7-Aug-09 17:24
xtwgigu7-Aug-09 17:24 
AnswerRe: some confuse about compatible DC and compatible Bitmap Pin
Rozis9-Aug-09 8:41
Rozis9-Aug-09 8:41 
GeneralRe: some confuse about compatible DC and compatible Bitmap Pin
xtwgigu9-Aug-09 14:21
xtwgigu9-Aug-09 14:21 
QuestionChanging DefaultSecurity Settings on a New Folder. Pin
Bram van Kampen7-Aug-09 14:44
Bram van Kampen7-Aug-09 14:44 
Question[Message Deleted] Pin
transoft7-Aug-09 9:16
transoft7-Aug-09 9:16 
AnswerRe: C++ question Pin
David Crow7-Aug-09 9:44
David Crow7-Aug-09 9:44 
GeneralRe: C++ question Pin
transoft7-Aug-09 10:15
transoft7-Aug-09 10:15 
QuestionTVN_SELCHANGED double access Pin
Vaclav_7-Aug-09 5:53
Vaclav_7-Aug-09 5:53 
AnswerRe: TVN_SELCHANGED double access Pin
Le@rner7-Aug-09 19:14
Le@rner7-Aug-09 19:14 
GeneralRe: TVN_SELCHANGED double access [modified] Hacked to solve! Pin
Vaclav_8-Aug-09 12:16
Vaclav_8-Aug-09 12:16 
Questionstack,graphics Pin
kumarashoka7-Aug-09 5:46
kumarashoka7-Aug-09 5:46 
AnswerRe: stack,graphics Pin
harold aptroot7-Aug-09 6:01
harold aptroot7-Aug-09 6:01 

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.