Click here to Skip to main content
16,003,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: error C2051: case expression not constant Pin
Mark Salsbery7-Aug-07 9:37
Mark Salsbery7-Aug-07 9:37 
GeneralRe: error C2051: case expression not constant Pin
led mike7-Aug-07 10:16
led mike7-Aug-07 10:16 
AnswerRe: error C2051: case expression not constant Pin
David Crow7-Aug-07 8:48
David Crow7-Aug-07 8:48 
QuestionAfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_4737-Aug-07 7:28
p_4737-Aug-07 7:28 
AnswerRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
Mark Salsbery7-Aug-07 7:55
Mark Salsbery7-Aug-07 7:55 
GeneralRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_4738-Aug-07 6:37
p_4738-Aug-07 6:37 
GeneralRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
Mark Salsbery8-Aug-07 7:17
Mark Salsbery8-Aug-07 7:17 
QuestionRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_4739-Aug-07 6:31
p_4739-Aug-07 6:31 
Hello Mark,

thank you for your help. To make the problem clearer, I decided to
put the (fortunately short) code I started from in this mail (see
below and sorry that I didn't already do that before).
I already checked the first point of your advice and my project was
already "use MFC in a shared dll". The entry point settings I didn't
find. In Visual Studio 2005 (which I use) under
Project->Settings->Configuration Properties->Linker ... and then?
Could you tell me where I find the entry point settings?
I also added the global CWinApp object.
You wrote that you are not sure about the last point. - Did you mean
the second AfxWinInit... line or the following part concerning the
app's main message loop?

> Wherever you have access to
> the app's main message loop, add a call to your CWinApp object's
> PreTranslateMessage method

Could I put it in _tWinMain or would that be "too late", do I have to
put it before, e.g. directly after instantiating the global CWinApp
object? And finally:

> ... MFC didn't process the message - let ATL handle it...
> ... pass it on to the ATL message handler...

I tried to figure out how, but didn't find out. As I wrote in my
previous mail, the WinMain() member function of the CAtlExeModuleT<>
object is invoked, which only has the int nShowCmd as a parameter.
How do I get the "msg" object into it, if you meant that? - Is there
an appropriate member function which I have to invoke instead of
the WinMain() member function?
// 1.) Instantiating CWinApp here...
// 2.) Putting the "if (!theMFCApp.PreTranslateMessage(&msg))" here? or
// in _tWinMain() ? When not in _tWinMain(), do I get two main event
// loops then (which I don't want)? Should I substitute the
// _AtlModule.WinMain(nShowCmd) then? If yes, how?

//Here comes the code I started from:

class CSampleModule : public CAtlExeModuleT< CSampleModule >
{
public :
   HRESULT PreMessageLoop(int nShowCmd)
   {
      HRESULT hr = CAtlExeModuleT<CSampleModule>::PreMessageLoop(nShowCmd);
      if (FAILED(hr))
         return hr;

      CMainDialog mainDlg;//CMainDialog is a subclass of CAxDialogImpl<>
      mainDlg.DoModal();
      return S_FALSE;
   }
};

CSampleModule _AtlModule;

//
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, 
                                LPTSTR /*lpCmdLine*/, int nShowCmd)
{
   return _AtlModule.WinMain(nShowCmd);
}
I hope the problem I have is clearer now. I think it only must be a
single step to the solution of the problem, but I yet don't have the
knowledge to do this step. So I hope you could help me with your
advanced knowledge - you would relieve me from this great problem I
am stuck in.

So thanks again for your help you already provided and hopefully
could do until this hard nut is cracked.

Best regards,

Peter.
AnswerRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
Mark Salsbery9-Aug-07 6:46
Mark Salsbery9-Aug-07 6:46 
GeneralRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_4739-Aug-07 21:30
p_4739-Aug-07 21:30 
GeneralRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
Mark Salsbery10-Aug-07 4:49
Mark Salsbery10-Aug-07 4:49 
GeneralRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_47310-Aug-07 7:53
p_47310-Aug-07 7:53 
QuestionRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_47311-Aug-07 1:24
p_47311-Aug-07 1:24 
QuestionRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_47315-Aug-07 4:57
p_47315-Aug-07 4:57 
AnswerRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
Mark Salsbery15-Aug-07 5:23
Mark Salsbery15-Aug-07 5:23 
QuestionRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_47324-Aug-07 7:50
p_47324-Aug-07 7:50 
QuestionRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
p_47327-Aug-07 6:17
p_47327-Aug-07 6:17 
GeneralRe: AfxGetResourceHandle() assertion failure on LoadFrame() Pin
pbor17-Aug-08 21:40
pbor17-Aug-08 21:40 
Questioni need to use a ddk Pin
javad_20057-Aug-07 6:13
javad_20057-Aug-07 6:13 
AnswerRe: i need to use a ddk Pin
Sam_c7-Aug-07 6:42
Sam_c7-Aug-07 6:42 
QuestionSimilar Images Pin
Maynka7-Aug-07 4:03
Maynka7-Aug-07 4:03 
AnswerRe: Similar Images Pin
led mike7-Aug-07 4:42
led mike7-Aug-07 4:42 
GeneralRe: Similar Images Pin
Jim Crafton7-Aug-07 9:36
Jim Crafton7-Aug-07 9:36 
GeneralRe: Similar Images Pin
led mike7-Aug-07 10:14
led mike7-Aug-07 10:14 
GeneralRe: Similar Images Pin
David Crow7-Aug-07 10:24
David Crow7-Aug-07 10:24 

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.