DEV Community

海前 王
海前 王

Posted on

some import mfc

#include<iostream>
using namespace std;

app 的构造里面    
AllocConsole();
    freopen("CONIN$", "r", stdin);
    freopen("CONOUT$", "w", stdout);
    freopen("CONOUT$", "w", stderr);
    std::cout << "hello";


void CMFCApplication22View::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
    std::cout << "hello";
    ClientToScreen(&point);
    cout << endl;
    cout << point.x << " " << point.y<<"\n";
    CPoint z=point;
    ScreenToClient(&z);
    // 创建一个 CEdit 控件
    CEdit* pEdit = new CEdit;

    // 设置控件的边框风格、可见性等
    pEdit->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
        CRect(z.x, z.y, z.x + 100, z.y + 20),
        this,
        10009);

    // 设置控件文本(可选)
    pEdit->SetWindowText(_T("Hello, World!"));


    OnContextMenu(this, point);
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)