Commands With Windows.h In Dev C++

Nov 28, 2015  You need to understand that the header file code c /code was created to facilitate calls to System API and the OS, so that programmers could use system calls such as code cdelay (int)/code or code csleep (int) /code in t. Dec 16, 2017 To manually add files, copy graphics.h and winbgim.h files in include folder of your compiler directory which is C: Program Files (x86) CodeBlocks MInGW. And copy libbgi.a to lib folder of your.

C graphics using graphics.h functions or WinBGIM (Windows 7) can be used to draw different shapes, display text in different fonts, change colors and many more. Using functions of graphics.h in Turbo C compiler you can make graphics programs, animations, projects, and games. You can draw circles, lines, rectangles, bars and many other geometrical figures. You can change their colors using the available functions and fill them. Following is a list of functions of graphics.h header file. Every function is discussed with the arguments it needs, its description, possible errors while using that function and a sample C graphics program with its output.

C graphics

C graphics examples

1. Drawing concentric circles

#include <graphics.h>

int main()
{
int gd = DETECT, gm;
int x =320, y =240, radius;
initgraph(&gd,&gm,'C:TCBGI');
for( radius =25; radius <=125; radius = radius +20)
circle(x, y, radius);
getch();
closegraph();
return0;
}

2. C graphics program moving car

#include <graphics.h>
#include <dos.h>

int main()
{
int i, j =0, gd = DETECT, gm;

initgraph(&gd,&gm,'C:TCBGI');

settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
outtextxy(25,240,'Press any key to view the moving car');

getch();

Dev

for( i =0; i <=420; i = i +10, j++)
{
rectangle(50+i,275,150+i,400);
rectangle(150+i,350,200+i,400);
circle(75+i,410,10);
circle(175+i,410,10);
setcolor(j);
delay(100);

if( i 420)
break;
if( j 15)
j =2;

cleardevice();// clear screen
}

getch();
closegraph();
return0;
}

C graphics functions

C graphics programs

Graphics in Windows 7 or Vista

Most of the functions are two dimensional except bar3d which draws a 3d bar, you can also implement these functions using already existing algorithms. You can also use these functions in C++ programs. You can use these functions for developing programs in Windows 7 and Vista using Dev C++ compiler. For that you need to download an additional package WinBGIm, download WinBGIm. Now open Dev C++ compiler go to Tools->Package Manager, use install button and then browse the package location. Now create a new project and select WinBGIm. This library also offers many functions which can be used for image manipulation, you can open image files, create bitmaps and print images, RGB colors and mouse handling.

windows.h is a Windows-specific header file for the C and C++ programming languages which contains declarations for all of the functions in the Windows API, all the common macros used by Windows programmers, and all the data types used by the various functions and subsystems. It defines a very large number of Windows specific functions that can be used in C. The Win32 API can be added to a C programming project by including the <windows.h> header file and linking to the appropriate libraries. To use functions in xxxx.dll, the program must be linked to xxxx.lib (or libxxxx.dll.a in MinGW). Some headers are not associated with a .dll but with a static library (e.g. scrnsave.h needs scrnsave.lib).

Child header files[edit]

There are a number of child header files that are automatically included with windows.h. Many of these files cannot simply be included by themselves (they are not self-contained), because of dependencies.

Commands With Windows.h In Dev C 2017

windows.h may include any of the following header files:

  • excpt.h – Exception handling
  • stdarg.h – variable-argument functions (standard C header)
  • windef.h – various macros and types
  • winnt.h – various macros and types (for Windows NT)
  • basetsd.h – various types
  • guiddef.h – the GUID type
  • ctype.h – character classification (standard C header)
  • string.h – strings and buffers (standard C header)
  • winbase.h – kernel32.dll: kernel services; advapi32.dll:kernel services(e.g. CreateProcessAsUser function), access control(e.g. AdjustTokenGroups function).
  • winerror.h – Windows error codes
  • wingdi.h – GDI (Graphics Device Interface)
  • winuser.h – user32.dll: user services
  • winnls.h – NLS (Native Language Support)
  • wincon.h – console services
  • winver.h – version information
  • winreg.h – Windows registry
  • winnetwk.h – WNet (Windows Networking)
  • winsvc.h – Windows services and the SCM (Service Control Manager)
  • imm.h – IME (Input Method Editor)

Extra includes[edit]

  • cderr.h – CommDlgExtendedError function error codes
  • commdlg.h – Common Dialog Boxes
  • dde.h – DDE (Dynamic Data Exchange)
  • ddeml.h – DDE Management Library
  • dlgs.h – various constants for Common Dialog Boxes
  • lzexpand.h – LZ (Lempel-Ziv) compression/decompression
  • mmsystem.h – Windows Multimedia
  • nb30.h – NetBIOS
  • rpc.h – RPC (Remote procedure call)
  • shellapi.h – Windows Shell API
  • wincrypt.h – Cryptographic API
  • winperf.h – Performance monitoring
  • winresrc.h – used in resources
  • winsock.h – Winsock (Windows Sockets), version 1.1
  • winspool.h – Print Spooler
  • winbgim.h – Standard graphics library

OLE and COM[edit]

  • ole2.h – OLE (Object Linking and Embedding)
  • objbase.h – COM (Component Object Model)
  • oleauto.h – OLE Automation
  • olectlid.h – various GUID definitions

Macros[edit]

Several macros affect the behavior of windows.h.

  • UNICODE – when defined, this causes TCHAR to be a synonym of WCHAR instead of CHAR, and all type-generic API functions and messages that work with text will be defined to the -W versions instead of the -A versions. (It is similar to the windows C runtime's _UNICODE macro.)
  • RC_INVOKED – defined when the resource compiler (RC.EXE) is in use instead of a C compiler.
  • WINVER – used to enable features only available in newer operating systems. Define it to 0x0501 for Windows XP, and 0x0600 for Windows Vista.
  • WIN32_LEAN_AND_MEAN – used to reduce the size of the header files and speed up compilation. Excludes things like cryptography, DDE, RPC, the Windows Shell and Winsock.

See also[edit]

Dev C++ Download Windows 7

Wikibooks has a book on the topic of: Windows Programming

Commands With Windows.h In Dev C 5

Retrieved from 'https://en.wikipedia.org/w/index.php?title=Windows.h&oldid=803199808'