473,811 Members | 2,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BUG: CFrameWnd::OnDD EExecute MFC 7.1

This function is executed when a application file is
double-clicked to open in a VC++ application.
Specifically, this function is enabled by
RegisterShellFi leTypes () in the application's
InitInstance.
However, under MFC 7.1 for VC++ .NET 2003,
CFrameWnd::OnDD EExecute has a bug that repeatedly
generates this error message in the debugger

Error: failed to execute DDE command ''.

Therefore, the problem is that the command is not being
propagated properly to this function, since the string
should be something like
'[open("C:\YourFi leNameHere")]'
rather than the empty string
''

Examining the code for this function in more detail, we
can see the bug here:

LPCTSTR lpsz = (LPCTSTR)Global Lock(hData);
int commandLength = lstrlen(lpsz);
if (commandLength >= _countof(szComm and))
{
// The command would be truncated. This
could be a security problem
TRACE0("Warning : Command was ignored
because it was too long.\n");
return 0;
}
GlobalUnlock(hD ata);

The data string '[open("C:\YourFi leNameHere")]' is stored
in the LPCTSTR lpsz. Then a check is done to make sure
that the length of this string is not longer than the new
buffer szCommand. However, the string is never copied in
szCommand, and the data is effectively released by
GlobalUnlock! Then when this command is executed

if (!AfxGetApp()->OnDDECommand(s zCommand))

szCommand is empty, and the error is generated.

Hopefully, Microsoft will address this bug and issue a
patch. Please respond to this posting to indicate if this
problem is being addressed.

Thank you,
Marc Gustafson
Nov 16 '05 #1
5 4141
Marc Gustafson wrote:
This function is executed when a application file is
double-clicked to open in a VC++ application.
Specifically , this function is enabled by
RegisterShellF ileTypes () in the application's
InitInstance .
However, under MFC 7.1 for VC++ .NET 2003,
CFrameWnd::OnD DEExecute has a bug that repeatedly
generates this error message in the debugger

Error: failed to execute DDE command ''.

Therefore, the problem is that the command is not being
propagated properly to this function, since the string
should be something like
'[open("C:\YourFi leNameHere")]'
rather than the empty string
''

Examining the code for this function in more detail, we
can see the bug here:

LPCTSTR lpsz = (LPCTSTR)Global Lock(hData);
int commandLength = lstrlen(lpsz);
if (commandLength >= _countof(szComm and))
{
// The command would be truncated. This
could be a security problem
TRACE0("Warning : Command was ignored
because it was too long.\n");
return 0;
}
GlobalUnlock(h Data);

The data string '[open("C:\YourFi leNameHere")]' is stored
in the LPCTSTR lpsz. Then a check is done to make sure
that the length of this string is not longer than the new
buffer szCommand. However, the string is never copied in
szCommand, and the data is effectively released by
GlobalUnlock ! Then when this command is executed

if (!AfxGetApp()->OnDDECommand(s zCommand))

szCommand is empty, and the error is generated.

Hopefully, Microsoft will address this bug and issue a
patch. Please respond to this posting to indicate if this
problem is being addressed.


Known problem. The solution I've seen recommended is to handle
WM_DDE_EXECUTE in your main frame window, copy the code from the MFC source,
and adding the missing line.

--
Doug Harrison
Microsoft MVP - Visual C++
Nov 16 '05 #2
Hi Marc,

Thank you very much for your post and feedback on the product.

Doug is right. This is a know issue. To workaround it, we could handle
WM_DDE_EXECUTE and add:

* Problem: CFrameWnd::OnDD EExecute in VC7/8 omitted the following 2 lines:
LPCTSTR lpsz = (LPCTSTR)Global Lock(hData);
lstrcpyn(szComm and, lpsz, _countof(szComm and));
* Solution: add the missing lines (or better, use strings).

The issue will be fixed in VS.NET 2003 SP1.

If you have follow up questions, please post here.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #3
Handled WM_DDE_EXECUTE in my MainFrame class and
implemented this work-around solution.
It's good to know that it will be fixed in SP1.

Thanks,
Marc
Nov 16 '05 #4
Hi Marc,

Thanks a lot for your feedback! :-)

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #5
sabapathy
4 New Member
Hello,
I did, but got the 10 errors as follows:
c:\...\Sources 0.9.57\MainFrm. cpp(5196) : error C2065: 'WM_DDE_EXECUTE ' : undeclared identifier
c:\...\Sources 0.9.57\MainFrm. cpp(5196) : error C3861: 'UnpackDDElPara m': identifier not found, even with argument-dependent lookup
c:\...\Sources 0.9.57\MainFrm. cpp(5202) : error C3861: '_countof': identifier not found, even with argument-dependent lookup
c:\...\Sources 0.9.57\MainFrm. cpp(5211) : error C2065: 'WM_DDE_ACK' : undeclared identifier... and the like.
What I did is: Copied the function LRESULT CFrameWnd::OnDD EExecute(WPARAM wParam, LPARAM lParam) from winfrm.cpp and pasted at the end of my mainframe.cpp file and added 2 more lines to fix the bug.
Do we need something else such as include any header?
Thanks & Regards,
--
sabapathy [email address removed]
Yamaha Corporation<htt p://global.yamaha.c om>
Japan
Mar 14 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2209
by: delerious | last post by:
I just found a bug that's related to positioning in IE 5.5 (could someone please tell me if this bug exists in IE 6, and if so, if my solution works in that browser?). I don't know if this bug has been reported before, but here it is, and its solution, in case anyone else runs into it. On the following page there is a box (DIV) that contains six anchors. The anchors have a style of display:block, so you should be able to move the mouse...
5
7237
by: K. Shier | last post by:
when attempting to edit code in a class file, i see the bug "Visual Basic ..NET compiler is unable to recover from the following error: System Error &Hc0000005&(Visual Basic internal compiler error) Save your work and restart Visual Studio .NET." has anyone seen this bug and can you confirm one way or the other whether or not it can corrupt your source files? (by 'corrupt' i mean: do anything to it that will cause it to fail to load and...
102
7158
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality of its documentation, it is a impeccability. it has or possesses properties of:
16
1741
by: Edward Diener | last post by:
After spending more than a day reducing a complicated compiler bug to a simple case I reported it to the MSDN Product Feedback Center as a bug just now. However this bug is completely stymying my development of a VC++ component. Does Microsoft still offer any free bug reporting cases for VS2005, as they did two for VS2003 so that I can talk with a technical representative directly to try to find a workaround for the compiler bug ? While...
26
2154
by: Patient Guy | last post by:
The code below shows the familiar way of restricting a function to be a method of a constructed object: function aConstructor(arg) { if (typeof(arg) == "undefined") return (null); this.property1 = arg; this.property2 = aConstantDefinedGlobally; this.method1 = function (anArg) {
158
6453
by: Giovanni Bajo | last post by:
Hello, I just read this mail by Brett Cannon: http://mail.python.org/pipermail/python-dev/2006-October/069139.html where the "PSF infrastracture committee", after weeks of evaluation, recommends using a non open source tracker (called JIRA - never heard before of course) for Python itself. Does this smell "Bitkeeper fiasco" to anyone else than me? --
8
2059
by: gw7rib | last post by:
I've been bitten twice now by the same bug, and so I thought I would draw it to people's attention to try to save others the problems I've had. The bug arises when you copy code from a destructor to use elsewhere. For example, suppose you have a class Note. This class stores some text, as a linked list of lines of text. The destructor runs as follows: Note::~Note() {
0
1991
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 385 open (+21) / 3790 closed (+21) / 4175 total (+42) Bugs : 1029 open (+43) / 6744 closed (+43) / 7773 total (+86) RFE : 262 open ( +4) / 291 closed ( +4) / 553 total ( +8) New / Reopened Patches ______________________
0
1802
by: LiveTecs | last post by:
http://www.livetecs.com TimeLive Web Collaboration Suite is an integrated suite that allows you to manage project life cycle including tasks, issues, bugs, timesheet, expense, attendance. TimeLive is available in two different flavors. Hosted version and downloadable version. Downloadable version required certain system requirement to install on local server. Whereas hosted version is already installed on our fully managed server on...
12
2061
by: Juan T. Llibre | last post by:
re: !I found an MSDN document that explains why what I'm trying to do should work Lee, From : http://www.w3.org/TR/REC-xml/ "A special attribute named xml:lang may be inserted in documents to specify the
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.