Can't compile MTPad from WTL samples - retry post 
Author Message
 Can't compile MTPad from WTL samples - retry post

I previously posted this message thru the MS site and there were some
wacky formatting problems, sorry. Here is the correct post:

Hello All,

I recently downloaded the PSDK with WTL. I'm using NT Server 4.0 SP5,
VC++ 6.0

The AttachMenu function of the CCommandBarCtrlImpl class is throwing
an ATLASSERT as follows:

...
// Add buttons for each menu item
if(m_hMenu != NULL)
{
        int nItems = ::GetMenuItemCount(m_hMenu);

        T* pT = static_cast<T*>(this);
        pT;     // avoid level 4 warning
        TCHAR szString[pT->_nMaxMenuItemTextLength];
        for(int i = 0; i < nItems; i++)
        {
                CMenuItemInfo mii;
                mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU;
                mii.fType = MFT_STRING;
                mii.dwTypeData = szString;
                mii.cch = pT->_nMaxMenuItemTextLength;
                bRet = ::GetMenuItemInfo(m_hMenu, i, TRUE, &mii);
                // following added by me
                DWORD dwErr = 0;
                if(!bRet)  
                        dwErr = ::GetLastError();
                // end additions
                ATLASSERT(bRet); // this is the         culprit
        ...

GetLastError returns 87 - The parameter is incorrect. (How helpful)

The m_hMenu parameter appears to be a valid handle -
GetMenuItemCount(m_hMenu) returns the proper number (4). Anyone have
any ideas?

Any help would be greatly apppreciated
Thanks,
James



Wed, 08 Oct 2003 22:07:23 GMT  
 Can't compile MTPad from WTL samples - retry post
Hi James,

I posted this before, perhaps you missed it.

If you're not running your development environment on Win2000, then you'll
need to either comment the following lines out or change their values in the
StdAtl.h file of the MTPad example:

#define WINVER 0x0500
#define _WIN32_WINNT 0x0500
#define _WIN32_IE 0x0501

John



Sun, 19 Oct 2003 07:25:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Can't compile MTPad - ATLASSERT!

2. MSoft's sample STL code won't compile

3. can't compile PSDK's samples by using VC6

4. Help with compiling a "canned" program

5. Newbie Post: My program compiles fine but exe doesn't work

6. RegExplore sample doesn't compile

7. VC6 Sample Projects won't compile in VC.NET..help please

8. can't compile sample code with global interface table (yes i have the plat sdk)

9. WTL - Very new to WTL - Trying to insert new COM object in WTL

10. Question about WTL′s Alpha Sample

11. Need WTL sample of explorer style layout

12. Splitter Window sample in WTL

 

 
Powered by phpBB® Forum Software