How to use Windows.h functions fonts etc

hello everyone!
i am learning windows.h but i have problems that how to use the functions like Arc(); CreateFont(); CreatePen(); CreateSolidBrush(); etc.
what is meant by hdc and what will be passed to it?
A hDC is a handle to a device context. A device context is a kind of drawing context where you can draw images, hsapes or text. Normally you get it from BeginPaint in your Windows proc when you handle WM_PAINT
I could not solve, can you please write a little program as an example?
Thomas1665
closed account (E0p9LyTq)
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp
closed account (E0p9LyTq)
See also:

http://www.winprog.org/tutorial/

You can download a PDF so you read the tutorial offline:

http://slav0nic.org.ua/static/books/C_Cpp/theForger%27s_Win32APITutorial.pdf
closed account (E0p9LyTq)
The Windows API is C-based, and uses a lot of different data types that can be confusing:

https://docs.microsoft.com/en-us/windows/desktop/WinProg/windows-data-types

64-bit Windows added a number of new data types:

https://docs.microsoft.com/en-us/windows/desktop/WinProg64/the-new-data-types

Learning to program Windows can be intimidating, the API is HUGE.
Actually this is the code:
But I don't Know What will be passed to first argument, which I have mentioned in the comment:
1
2
3
4
5
6
7
8
9
10
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
int main()
{
	Arc(/*what will be passed here?*/,23,12,42,14,24,54,32,12);
	getch();
    
}
For a real GUI you need to create a windows application not a console application.
Though it's possible to draw on the console this is only suitable for some quick demos.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main()
{
  const COLORREF WHITE = RGB(255, 255, 255);
  HWND hConsole = ::GetConsoleWindow();
  HDC hDC = ::GetDC(hConsole);
  SetBkColor(hDC, WHITE);
  Ellipse(hDC, 10, 10, 100, 100);
  ::Sleep(5000); /* wait 5 sec */
  ::ReleaseDC(hConsole, hDC);

  return 0;
}
Topic archived. No new replies allowed.