Solved

DDE code kills DDEML.dll and USER.exe

Posted on 1998-03-19
1
232 Views
Last Modified: 2013-11-19
why does this code eat memory and wind up GPFing the system?


CheckDlg::OnOK()
{
        // TODO: Add extra validation here
        DWORD pidInst =0;
        WORD result = DdeInitialize(&pidInst,DdeCallback,APPCMD_CLIENTONLY
,0L);
       
        //create a string handle for the Dde conversation
        HSZ server = DdeCreateStringHandle(pidInst,"MrktLink",CP_WINANSI);
       
        HSZ topic = DdeCreateStringHandle(pidInst,"Rates",CP_WINANSI);

        //connect to the DDE server application
        HCONV thisconv = DdeConnect(pidInst,server,topic,NULL);
        bool ok =  (thisconv !=NULL);

        DdeFreeStringHandle(pidInst,server);
        DdeFreeStringHandle(pidInst,topic);
        int t =0;
        HSZ item = DdeCreateStringHandle(pidInst,"NZD",CP_WINANSI);
        m_TOTAL=0;
        while (t <20)
        {
                HDDEDATA nzdat = DdeCreateDataHandle(pidInst,0,0,0,item,CF_
TEXT,NULL);
                LPDWORD result =0;
                nzdat = DdeClientTransaction(NULL,0L,thisconv,item,CF_TEXT,XT
YP_REQUEST,1200,result);
                LPDWORD sizereturned=0;
                CString tempText2 =(CString) DdeAccessData(nzdat,sizereturned);
                DdeUnaccessData(nzdat);
                DdeFreedataHandle(nzdat);
                m_RESULT = tempText2;
                m_TOTAL +=1;
                UpdateData(false);
        }
0
Comment
Question by:bryceb
1 Comment
 
LVL 3

Accepted Solution

by:
byang earned 100 total points
Comment Utility
You never updated "t" in the while loop, so (t<20) is always true. That's an endless loop at least.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now