Solved

DDE code kills DDEML.dll and USER.exe

Posted on 1998-03-19
1
234 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
ID: 1317097
You never updated "t" in the while loop, so (t<20) is always true. That's an endless loop at least.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

815 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

9 Experts available now in Live!

Get 1:1 Help Now