On 3/1/2011 8:25 PM, Tyro[a.c.edwards] wrote:
On 3/1/2011 7:18 PM, Bekenn wrote:
On 3/1/2011 12:25 AM, Tyro[a.c.edwards] wrote:
Nevertheless, execution haults
at the very next line following/catch and Create() never returns.

CreateWindow sends a few messages to your window proc; anything
interesting happening there?

Not sure how to check those messages, but I guess that's a cue for me to
do some more research. Off to Google land I go...

After much searching, I've finally located the actual cause of the problem:

class TopWinClass: WinClass
{
        this(ushort resId, HINSTANCE hInst, WNDPROC wndProc)
        {
                super(resId, hInst, wndProc);
                SetResIcons(resId);
                wc.lpszMenuName = MAKEINTRESOURCEA(resId);  // [PROBLEM]
        }
}

The root cause of the problem begins with a lack of understanding of how to create a proper resource file for D. I simply took the C++ version, compiled it with rcc and linked it to my project: No changes whatsoever. Turn out that made the compiler/linker stop complaining, however MAKEINTRESOURCEA(resId) still cannot locate the correct resources or cannot properly use the resource it finds to initialize wc.lpszMenuName. Every access to wc.lpszMenuName after this point fails. If initialize wc.lpszMenuName with one of the default strings, say "STATIC" at this point, the program runs to completion. I've attached the resource file, it hopes that someone could help me with it's conversion.

Thanks.
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUT DIALOG DISCARDABLE  20, 20, 145, 82
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,47,62,50,14,WS_GROUP
    ICON            ID_RS,IDC_RS,7,7,20,20,WS_GROUP
    CTEXT           "Generic",IDC_STATIC,51,17,42,11
    CTEXT           "(c) Reliable Software 1997, 98",IDC_STATIC,19,30,103,11
    CTEXT           "http://www.relisoft.com",IDC_STATIC,7,47,130,10
END


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include <windows.h>\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
ID_MAIN                 ICON    DISCARDABLE     "generic.ico"
ID_RS                   ICON    DISCARDABLE     "rs.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Menu
//

ID_MAIN MENU DISCARDABLE 
BEGIN
    POPUP "&Program"
    BEGIN
        MENUITEM "&About...",                   IDM_ABOUT
        MENUITEM SEPARATOR
        MENUITEM "E&xit",                       IDM_EXIT
    END
    POPUP "&Help", HELP
    BEGIN
        MENUITEM "&Please",                     IDM_HELP
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    ID_MAIN                 "GenericClass"
    ID_CAPTION              "Generic Windows Program"
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

Reply via email to