How to draw on "existing window"?

Hello, everyone.
I don’t know English well. So please understand me even if statements are wrong.

I learned OpenFrameworks under Windows10 through self-study.
OpenFrameworks Version is 0.11.1.
API “ofRunApp” makes “window” automatically.
But I want to draw on “existing window”. Is this possible?
For example, I wish there was API “ofRunAppEx” like below code.
ofRunAppEx interface has handle of device context and handle of rendering context
and instance pointer derived from ofBaseApp.
(My imagined) ofRunAppEx as stated below don’t make new window.

If it’s possible by other means, would you teach me?

==Pesude code==

  1. class ofAppSamp : public ofBaseApp {

  2. public:

  3. void setup(){

  4. ofBackGround(0,0,0);
  5. ofSetCircleResolution(32);
  6. ofEnableAlphaBlending();
  7. ofSetFrameRate(30);
  8. }

  9. void draw() {

  10. ofDrawCircle(ofRandom(100), ofRandom(100), 10);
  11. }

  12. };

  13. BOOL CWinAppSamp::InitInstance()

  14. {

  15. CWnd* pMainWnd = new CWnd;

  16. int width = 100;

  17. int height = 100;

  18. pMainWnd->CreateEx(0, ::AfxRegisterWndClass(CS_DBLCLKS), _T(“MFC_Window”)

  20.    CRect(CPoint(50,50), CSize(width,height)), NULL, 0);
  21. pMainWnd->ShowWindow(SW_SHOW);

  22. pMainWnd->UpdateWinodw();

  23. HWND hwnd = pMainWnd->GetSafeHwnd();

  24. CDC* pdcSrc = pMainWnd->GetDC();

  25. HDC hdc = pdcSrc->GetSafeHdc();

  26. HGLRC hrc = wglCretaeContext(hdc);

  27. // I want to draw on this hdc. (without creating window)

  28. ofRunAppEx(new ofAppSamp(), hdc, hrc);

  29. }

Hi, I don’t see why you would want to create a window in such way. openFrameworks allows you to create windows easily. Check the examples in examples/windowing,
Because of how the whole OF engine works I think it would be really cumbersome to link the window you created and draw in it with the ofApp::draw() function.
I think you will find the answer to what you need in the examples.

Thank you for answering, roymacdonald.
I will check the examples in examples/windowing as soon as possible.

The reason for linking “existing window” is because I want to incorporate it into the Application I’m working on.

I see. check the examples, in particular look at the main.cpp file of those as there is an important part of how you create and use the windows.