1 ACLLib

Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

ACLLib

ACLLib

Win32API

.c
Dev C++ MinGW

GPL

Windows
.h

github

MSVC

2009
2010
2012
2008

Windows

Windows API

32
Windows
Win32API.
C

C
Windows

Windows

main()?
main()

main

main

WinMain()

As main() is the entry function of an


ordinary C program, WinMain() is the one in
Win32API program.

Windows applications have a different


startup code that needs a function
WinMain()

WinMain()

#include <windows.h>
int WINAPI WinMain(
HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Goodbye, cruel world!", "Note",
MB_OK);
return 0;
}

As main() is the entry function of an


ordinary C program, WinMain() is the one in
Win32API program.

Windows applications have a different


startup code that needs a function
WinMain()

acllib

DC

WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL,
IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW
+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL,
IDI_APPLICATION);

DC

DC

while(GetMessage(&Msg, NULL, 0,
0)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;

DC

DC

DC

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,


WPARAM wParam, LPARAM lParam) {
switch(msg) {
case WM_LBUTTONDOWN: {
char szFileName[MAX_PATH];
HINSTANCE hInstance = GetModuleHandle(NULL);
GetModuleFileName(hInstance, szFileName,
MAX_PATH);
MessageBox(hwnd, szFileName, "This program is:",
MB_OK | MB_ICONINFORMATION);
}
break;

DC

DC

Win32API

WinMain()

Windows OS
Windows

ACLLib

WinMain()

Windows OS
Setup()
Windows

)
(

Setup()

)
(

Setup()

Setup()

Dev C++
ACLLib

Dev C++

Windows
Application

acllib.h

acllib.c

libwinmm.a

Dev

MinGW/lib

"C:/Program Files/Dev-Cpp/MinGW32/lib/libwinmm.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/libmsimg32.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/libkernel32.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/libuser32.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/libgdi32.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/libole32.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/liboleaut32.a"
"C:/Program Files/Dev-Cpp/MinGW32/lib/libuuid.a"

main.c

ACLLib

void initWindow(const char title[],int


left, int top, int width, int height);
void beginPaint();
void endPaint();

void initWindow(const char *name, int left,


int top, int width, int height);
int Setup()
{
initWindow("Hello World",
100, 100, 200, 200);
return 0;
}

Windows
(0,0)

(0,0)

(639,479)

scanf

initConsole();

printf
scanf printf

/
void beginPaint();
void endPaint();

void putPixel(int x, int y, ACL_Color color);


ACL_Color getPixel(int x, int y);

RGB(r,g,b)
> RGB(255,0,0)

BLACK, RED, GREEN, BLUE, CYAN, MAGENTA,


YELLOW, WHITE

void moveTo(int x, int y);


void moveRel(int dx, int dy);
void line(int x0, int y0, int x1, int y1);
void lineTo(int x, int y);
void lineRel(int dx, int dy);
void arc(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect, int nXStartArc, int nYStartArc,
int nXEndArc, int nYEndArc);

void setPenColor(ACL_Color color);


void setPenWidth(int width);
void setPenStyle(ACL_Pen_Style style);
PEN_STYLE_SOLID,
PEN_STYLE_DASH, /* ------- */
PEN_STYLE_DOT, /* ....... */
PEN_STYLE_DASHDOT, /* _._._._ */
PEN_STYLE_DASHDOTDOT, /* _.._.._
PEN_STYLE_NULL

*/

void chrod(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int
nXRadial1, int nYRadial1, int nXRadial2, int nYRadial2);

void ellipse( int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
void pie(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int
nXRadial1, int nYRadial1, int nXRadial2, int nYRadial2);

void rectangle(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);


void roundrect(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int
nWidth, int nHeight);


void setBrushColor(ACL_Color color);
void setBrushStyle(ACL_Brush_Style style);
BRUSH_STYLE_SOLID = -1,
BRUSH_STYLE_HORIZONTAL, /* ----- */
BRUSH_STYLE_VERTICAL, /* ||||| */
BRUSH_STYLE_FDIAGONAL, /* \\\\\ */
BRUSH_STYLE_BDIAGONAL, /* ///// */
BRUSH_STYLE_CROSS, /* +++++ */
BRUSH_STYLE_DIAGCROSS, /* xxxxx */

void setTextColor(ACL_Color color);


void setTextBkColor(ACL_Color color);
void setTextSize(int size);
void setTextFont(char *pFontName);
void paintText(int x, int y, const char *pStr);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy