How do I get the CDC of the modal dialog under MFC?

Updated on technology 2024-02-09
12 answers
  1. Anonymous users2024-02-05

    How can I use getdlgitem and getdc before the dialog box is created?

    Who said that the text displayed by the static control cannot be dynamically refreshed, modify the id number of the static control, as long as it is not IDC static, you can use setdlgitemtext to dynamically update it, provided that it is displayed in the dialog box.

  2. Anonymous users2024-02-04

    The first one you do: your is p=null;

    Of course you can't go to p->getdc();

    My thoughts in No. 2.

    Mine is this kind of learning;

    c***dlg* dlg=new c***dlg();Modal dialogs.

    dlg->showwindow(sw_show);

    dlg->upwindow();

    cdc* pdc=dlg->getdc();

  3. Anonymous users2024-02-03

    Set a member variable flag bit in c to determine whether it is a or b, such as int flag;

    a, ccdlg dlg;;;

    bWhen called, ccdlg dlg;;;

  4. Anonymous users2024-02-02

    You do this by adding a flag to the category C:

    class c

    Then whether it's a or b, do it when domodal out of the c dialog;

    true or false");It can be set to true for a and false for b.

  5. Anonymous users2024-02-01

    afxgetmainwnd, but note that you can't access interface-related content, such as control variables in the main window.

    cmainframe *)afxgetmainwnd()) variable name;

  6. Anonymous users2024-01-31

    Get the handle to get the form via findwindow and then sendmessage closes!

  7. Anonymous users2024-01-30

    There are many ways to do this: 1. overload onok(), 2. postmessage(window handle, wm close); 3. Call enddialog

  8. Anonymous users2024-01-29

    Postmessage or SendMessage sends a message to the dialog box.

  9. Anonymous users2024-01-28

    You describe that there is a problem. What you want to get is the pixel of the desktop.

    cwnd* desk = getdesktopwindow();

    cdc* pdc = desk->getdc();

    colorref cr = pdc->getpixel(30,30);

    desk->releasedc(pdc);I guess you forgot about that.

  10. Anonymous users2024-01-27

    The modal dialog cannot execute the following statement without returning, so if lz does not need to use the modal dialog, you can use the ideasoft method, and if you insist on using the modal dialog, you can overload the oncreate function in the dialog class to complete the relevant functions.

  11. Anonymous users2024-01-26

    In general, non-modal is used, but if you have to use modal, you can use what IdealSoft says, set a variable in the DLG to hold the function pointer (or save the pointer of the instance if you want to call the method of an instance of a class).

    PS: I do this a lot, but it's a serious undermine of the aesthetics of C++ programs.

  12. Anonymous users2024-01-25

    csheetdiadlg dlg;

    m_pmainwnd = &dlg;

    int_ptr nresponse = ;

    if (nresponse == idok)else if (nresponse == idcancel)Here you can see the ** displayed in the main dialog, you will write a non-modal dialog, naturally you know how to change it.

    But I look at your needs, this method is not good, look at MFC's cpropertysheet and cpropertypage classes, maybe you will find a better way, reference.

Related questions
9 answers2024-02-09

If you're using aspnet, he has a special function in. NET to get a computer name, IP address and current username is very simple, the following are a few methods I commonly use, if you have other good methods, you can reply and sort it out together: >>>More

7 answers2024-02-09

int sum=0;

for(int i = 0 ;i< -1;i++) assumes that the ID of the datalist is datalist1 >>>More

2 answers2024-02-09

Know, you can earn 42 experience points per day:

2 points for the first login, 20 points for voting, and 20 points for the first 10. >>>More

7 answers2024-02-09

Hello! We're sorry, but our smartphones don't have root access at the moment. There are two main reasons: >>>More

6 answers2024-02-09

2. At this time, the "New Web Query" dialog box pops up, you can type the address of the web page you want to add data in the "Address" column, and click the Go button. >>>More