CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241

    Re: MFC Dialog box not working - VC6 upgrade

    Thanks....looking in to the AFX_MANAGE_STATE macro now.

    That's something I've seen littered here and there in these DLLs before, but never really knew what it did.

  2. #17
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241

    Re: MFC Dialog box not working - VC6 upgrade

    I'm still a little confused on exactly how the AFX_MANAGE_STATE works.

    The previous architecture was an APP that called a (MFC) DLL that called this DLL (COM component) to display the resources within a function call.

    Now its similar, but without COM. APP->(MFC)DLL->MFC DLL.

    I tried the AFX_MANAGE_STATE(AfxGetStaticModuleState( )); macro, but to no avail. From another page I looked up and from your comments and what I read on the MS page linked by Vladimir, I'm thinking I need to run in the context of the main app when I open the dialog. Is that right?

    I'm seeing an example on an MSDN forum post that shows passing in the Window Handle (from the APP in my case I'm guessing) and using that in the constructor of the Dialog. Does it sound like I'm on the right track at all?

  3. #18
    Join Date
    Apr 1999
    Posts
    27,449

    Re: MFC Dialog box not working - VC6 upgrade

    Quote Originally Posted by KingTermite View Post
    I'm still a little confused on exactly how the AFX_MANAGE_STATE works.
    My personal experience is that I don't use MFC to handle resources that are found in other modules. I create DLL's (non-MFC DLL's) that need resources loaded from other DLL's, and I have never used anything but the low-level API's to handle the resources.

    It's one of the few cases where IMO it's easier doing this the low-level API way -- just storing HINSTANCE handles of your modules, and then calling LoadResource(), FindResource(), LoadString() etc. with the appropriate instance handle. You have control over which module's resources gets loaded, displayed, etc. instead of relying on what amounts to a "global" setting.

    In my situation, it isn't easy (next to impossible really) to control resources using the AFX_MANAGED_STATE macro (but in most situations other than what I use resources for, it works).

    Regards,

    Paul McKenzie

  4. #19
    Join Date
    Apr 2009
    Posts
    57

    Re: MFC Dialog box not working - VC6 upgrade

    Quote Originally Posted by KingTermite View Post
    Large project that I've been working on converting from VC++ 6.0 to VC++ 8.0 (.NET 2005). It has an app (EXE), a main DLL, and 5 component DLLs (formerly COM, but now are MFC Dlls).

    One of the DLLs has many dialogs and controls that are used. When I converted over, I just copied most of the resource file (.rc) over to the new one (textually).

    Everything looks fine. All dialog boxes and controls appear fine when I look at the resources in the project.

    When I get to the point in my code where a dialog box is called, nothing happens. Nothing comes up, it just goes over the line returning a -1.

    Relevant Code:

    Code:
          CSequenceSelectDialog dlg;
          dlg.m_pTestProperties = m_pTestProperties;
          dlg.m_pConfigurationMatrix = m_pConfigurationMatrix;
          dlg.m_nStationNumber = nStationNumber;
          dlg.m_strUserPath = m_strUserPath;
          dlg.m_strTestPath = m_strTestPath;
    before .NET conversion */
          *nSequenceSelection = m_nSequenceSelection = (int) dlg.DoModal();
          if (*nSequenceSelection == IDOK)
          {
    Is there any reason this isn't working now that you can think of? Any thoughts are appreciated.
    Why did you copy resoure file textually?

    I would start an empty project and copy over the files. I haven't used VC2005 but shouldn't it convert V6S project files?

    Editing resource files is nothing but trouble.

    Start and empty project and copy the files over. I have several large V6S, if I have to copy over the resource file manually for about 60 dialog boxes I'm in trouble.

    Try creating some small projects in V6S and covert them to get idea how to convert them. ... I still think that VS2005 should automattically convert V6 projects, maybe only V2003 does it.

    ...either way, just copying the project files should work though, stay in the C++ world.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured