Click here to Skip to main content
16,016,738 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionplease help me:build .c source file with VC++6,error LNK2001? Pin
fbzok12-Aug-05 16:50
fbzok12-Aug-05 16:50 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
Jose Lamas Rios12-Aug-05 18:32
Jose Lamas Rios12-Aug-05 18:32 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
sunit512-Aug-05 22:04
sunit512-Aug-05 22:04 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
fbzok12-Aug-05 22:08
fbzok12-Aug-05 22:08 
GeneralRe: please help me:build .c source file with VC++6,error LNK2001? Pin
Saurabh.Garg12-Aug-05 22:59
Saurabh.Garg12-Aug-05 22:59 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
fbzok12-Aug-05 23:18
fbzok12-Aug-05 23:18 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
fbzok13-Aug-05 4:30
fbzok13-Aug-05 4:30 
Generalrun single instance of app Pin
elephantstar12-Aug-05 12:17
elephantstar12-Aug-05 12:17 
I have an application (A) that will execute my application (B) from its menu. When the menu item is selected, a method within my app called Notify will be called to execute the program. It is a COM interface. The problem that I am having is when the menu item is selected, application B executes and creates a named mutex object. The application window does not appear but it proceeds to the Notify method where the application executes once again and tries to create the same mutex object name. It fails because the mutex object already exists. If the mutex was created in the first run, why didn't the application start up? Here is what I have below:

STDMETHODIMP CWrapper::Notify(DataNotificationType notifyType, VARIANT data)
{ 
   STARTUPINFO stStartUpInfo;
   PROCESS_INFORMATION *pProcessInfo = new PROCESS_INFORMATION;

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

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


    CreateProcess(NULL, "C:\\Program Files\\XXX\\zzz.exe", NULL, NULL, FALSE,
      NORMAL_PRIORITY_CLASS, NULL, 
      NULL, &stStartUpInfo, pProcessInfo);

   return S_OK;
}

BOOL CABCApp::InitInstance()
{
	   
   //*** Run only one instance
	mutex  = ::CreateMutex(NULL, TRUE, named_mutex); 

	DWORD dwMutexErr = GetLastError();
    if (dwMutexErr == ERROR_ALREADY_EXISTS)
    {
	   CWnd *pPrevWnd = CWnd::GetDesktopWindow()->GetWindow(GW_CHILD);

      	   while (pPrevWnd)
	   {
		if ( ::GetProp(pPrevWnd->GetSafeHwnd(), named_mutex )
		{
		   if ( pPrevWnd->IsIconic() )
			  pPrevWnd->ShowWindow(SW_RESTORE);
			
           		   pPrevWnd->SetForegroundWindow();
		   pPrevWnd->GetLastActivePopup()->SetForegroundWindow();
		   return FALSE;
		}
		pPrevWnd = pPrevWnd->GetWindow(GW_HWNDNEXT);
	   }
               return FALSE;
    }
   Return TRUE;
}


Thanks!
GeneralWorking dir in Registry Pin
RickyC12-Aug-05 9:12
RickyC12-Aug-05 9:12 
GeneralRe: Working dir in Registry Pin
David Crow12-Aug-05 10:01
David Crow12-Aug-05 10:01 
GeneralRe: Working dir in Registry Pin
RickyC12-Aug-05 10:31
RickyC12-Aug-05 10:31 
General3rd party Menu Check State... Pin
Jumpin' Jeff12-Aug-05 8:31
Jumpin' Jeff12-Aug-05 8:31 
Generalbracket tournament ctrl Pin
picazo12-Aug-05 8:18
picazo12-Aug-05 8:18 
GeneralLooking for GIS knowledge Pin
prcarp12-Aug-05 8:04
prcarp12-Aug-05 8:04 
GeneralRe: Looking for GIS knowledge Pin
FlamTaps12-Aug-05 9:10
FlamTaps12-Aug-05 9:10 
GeneralVC++ and Java Pin
llp00na12-Aug-05 7:56
llp00na12-Aug-05 7:56 
GeneralRe: VC++ and Java Pin
Luther Baker12-Aug-05 11:41
Luther Baker12-Aug-05 11:41 
GeneralLicense Keys Pin
Luther Baker12-Aug-05 7:47
Luther Baker12-Aug-05 7:47 
GeneralRe: License Keys Pin
Luther Baker12-Aug-05 7:53
Luther Baker12-Aug-05 7:53 
GeneralRe: License Keys Pin
Wes Aday12-Aug-05 9:12
professionalWes Aday12-Aug-05 9:12 
GeneralRe: License Keys Pin
Luther Baker12-Aug-05 11:18
Luther Baker12-Aug-05 11:18 
GeneralRe: License Keys Pin
SunKnight012-Aug-05 10:19
SunKnight012-Aug-05 10:19 
GeneralRe: License Keys Pin
Luther Baker12-Aug-05 11:31
Luther Baker12-Aug-05 11:31 
GeneralRe: License Keys Pin
Trollslayer12-Aug-05 22:28
mentorTrollslayer12-Aug-05 22:28 
GeneralRe: License Keys Pin
Luther Baker13-Aug-05 4:16
Luther Baker13-Aug-05 4:16 

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.