Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with MFC/.NET 2003

8 views
Skip to first unread message

shisley

unread,
Jun 24, 2003, 9:35:34 PM6/24/03
to
I have a problem with MFC/.NET 2003.
In .NET (2002) I make a new MFC project with MDI named AAA with file
extension .AAA.
Build it and run it once, save a file and exit - it registers file type, and
now you can click on the file to launch in explorer.
Do the same with .NET 2003, name it BBB with file extension BBB.
Now you click on the file you saved, the program runs but no window is ever
displayed !
I have reproduced the same problem on several computers, on both W2K and XP.
If anybody has any ideas what is going on here, please let me know.

Thanks and regards.


Peter Huang [MSFT]

unread,
Jun 26, 2003, 9:25:56 PM6/26/03
to
Hi Shisley,

I have performed researched and found that it is a known issue. I would
like to provide you with the following workaround.

1. Insert the following codes at the head of your MainFrm.cpp.
#include <dde.h> // for DDE execute shell requests
#ifndef _countof
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#endif

2. Revise the message map in your MainFrm.cpp.
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_WM_CREATE()
//…………
ON_MESSAGE(WM_DDE_EXECUTE, OnDDEExecute)
END_MESSAGE_MAP()

3. In your MainFrm.h file, insert the following codes
protected:
afx_msg LRESULT OnDDEExecute(WPARAM wParam, LPARAM lParam);

4. Insert the following code in your MainFrm.cpp file
LRESULT CMainFrame::OnDDEExecute(WPARAM wParam, LPARAM lParam)
{
// unpack the DDE message
UINT_PTR unused;
HGLOBAL hData;
//IA64: Assume DDE LPARAMs are still 32-bit
VERIFY(UnpackDDElParam(WM_DDE_EXECUTE, lParam, &unused,
(UINT_PTR*)&hData));

// get the command string
TCHAR szCommand[_MAX_PATH * 2];
LPCTSTR lpsz = (LPCTSTR)GlobalLock(hData);
lstrcpyn(szCommand, lpsz, _countof(szCommand));
GlobalUnlock(hData);

// acknowledge now - before attempting to execute
::PostMessage((HWND)wParam, WM_DDE_ACK, (WPARAM)m_hWnd,
//IA64: Assume DDE LPARAMs are still 32-bit
ReuseDDElParam(lParam, WM_DDE_EXECUTE, WM_DDE_ACK,
(UINT)0x8000, (UINT_PTR)hData));

// don't execute the command when the window is disabled
if (!IsWindowEnabled())
{
TRACE(traceAppMsg, 0, _T("Warning: DDE command '%s' ignored because
window is disabled.\n"),
szCommand);
return 0;
}

// execute the command
if (!AfxGetApp()->OnDDECommand(szCommand))
TRACE(traceAppMsg, 0, _T("Error: failed to execute DDE command '%s'.\n"),
szCommand);

return 0L;
}


Please perform the steps above and let me know if they are successful.
Thank you for your time.


Regards,

Peter Huang
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "shisley" <shi...@pacbell.net>
>Subject: Problem with MFC/.NET 2003
>Date: Tue, 24 Jun 2003 18:35:34 -0700
>Lines: 14
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <OtrCQlr...@TK2MSFTNGP10.phx.gbl>
>Newsgroups: microsoft.public.vc.mfc
>NNTP-Posting-Host: adsl-66-121-254-34.dsl.lsan03.pacbell.net 66.121.254.34
>Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.vc.mfc:380187
>X-Tomcat-NG: microsoft.public.vc.mfc

Master Programmer

unread,
Jun 27, 2003, 12:00:17 AM6/27/03
to
You can also just modify winfrm.cpp's onddeexecute directly and recompile
the mfc source files.

mp
"Peter Huang [MSFT]" <v-ph...@online.microsoft.com> wrote in message
news:yRPGhsEP...@cpmsftngxa06.phx.gbl...


> Hi Shisley,
>
> I have performed researched and found that it is a known issue. I would
> like to provide you with the following workaround.
>
> 1. Insert the following codes at the head of your MainFrm.cpp.
> #include <dde.h> // for DDE execute shell requests
> #ifndef _countof
> #define _countof(array) (sizeof(array)/sizeof(array[0]))
> #endif
>
> 2. Revise the message map in your MainFrm.cpp.
> BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
> ON_WM_CREATE()

> //....

0 new messages