Windows Api
윈도 API(Windows API, WinAPI)는 마이크로소프트 윈도 운영 체제들이 사용하는 API이다. C/C++ 프로그램에서 직접 운영 체제와 상호 작용할 수 있도록 만들어졌으며, 그보다 더 낮은 수준의 제어는 Ntdll.dll을 사용한 낮은 수준의 DLL로 가능하다.
Hide console of Windows
Visual C++ 컴파일러는 아래와 같은 링커 옵션으로 해결할 수 있다.
코드에 삽입하는 방법은 아래와 같다.
FreeConsole();
// OR
#define _WIN32_WINNT 0x0500
#include <wincon.h>
ShowWindow (GetConsoleWindow(), SW_HIDE);
MinGW는 다음과 같은 컴파일 옵션을 사용할 수 있다.
With console window
#include <stdio.h>
#include <windows.h>
int main(void)
{
puts("hi");
MessageBox(NULL, "test", "test", NULL);
GetStockObject(0);
return 0;
}
컴파일러 옵션은 아래와 같다.
List of Windows API
- [http://msdn.microsoft.com/en-us/library/windows/desktop/ff818516(v=vs.85.aspx MSDN: Windows API Index]
Base Services
Base File Services
| Multithread
Advanced Services
GDI User Interface
| Common Dialog Box Library Common Control Library Windows Shell | Network Services
Localization
System Management | Web Multimedia ETC |
Category
- Win32:Hooking
- Win32:Console: 콘솔과 관련된 명령.
- WindowsApi:Handle#HWND vs HINSTANCE: 핸들(HWND)과 인스턴스(HINSTANCE)의 차이점에 대한 설명.
- WindowsApi:ExitWindowsEx#Windows Shutdown: 윈도우 종료 방법에 대한 내용.
- WindowsApi:SECURITY_ATTRIBUTES
- WindowsApi:VirtualAlloc
- WindowsApi:GetSecurityInfo: Finding the Owner of a File Object in C++
- WindowsApi:GetFileSecurity: How to Check Access Rights
- WindowsApi:SerialCommunications: Serial Communications
DLL
- Dynamic-link library
- DLL:Example:Windows - Windows에서 DLL을 동적으로 로드하는 방법.
Debugging
Device
- Stackoverflow - how to get vendor id and product id of a plugged usb device on windows
- SetupDiGetDeviceInterfaceDetail
ETC
- [https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85.aspx Application Registration]
Troubleshooting
Undefined reference to WinMain
주로 MinGW를 사용할 경우 발생되는 문제로, Windows에서 main
대신 사용하는 WinMain
함수를 찾을 수 없는 경우 발생된다. 발생되는 에러 메시지 유형은 아래와 같다.
C:/workspace/root/var/opm/apps/tdmgcc-4.9.2-150419-x86/bin/../lib/gcc/mingw32/4.9.2/../../..\libmingw32.a(main.o):main.c:(.text.startup+0xa7): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
간단히 해결하는 방법은 아래와 같다.
int main(int argc, char ** argc)
{
// ...
return 0;
}
// For Windows Project Entry point.
#if defined(WIN32) || defined(_WIN32)
#include <windows.h>
int APIENTRY
WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine, int cmdShow)
{
return main(__argc, __argv);
}
#endif
Microsoft APIs and frameworks
Graphics | Desktop Window Manager, Direct2D, Direct3D, D3D (extensions), GDI/GDI+, WPF, Silverlight, WinRT XAML, Windows Color System, Windows Image Acquisition, Windows Imaging Component |
Audio | DirectMusic, DirectSound, DirectX plugin, XACT, Speech API, XAudio2 |
Multimedia | DirectX (Media Objects), DirectX (Video Acceleration), DirectInput, DirectShow, Image Mastering API, Managed DirectX, Media Foundation, XNA, Windows Media, Video for Windows |
Web | MSHTML, RSS Platform, JScript, VBScript, BHO, XDR, SideBar Gadgets |
Data access | Data Access Components, Extensible Storage Engine, ADO.NET, ADO.NET Entity Framework, Sync Framework, Jet Engine, MSXML, OLE DB, OPC |
Networking | Winsock (LSP), Winsock Kernel, Filtering Platform, Network Driver Interface Specification, Windows Rally, BITS, P2P API, MSMQ, MS MPI, DirectPlay |
Communication | Messaging API, Telephony API, WCF |
Administration and management | Win32 console, Windows Script Host, WMI(extensions), PowerShell, Task Scheduler, Offline Files, Shadow Copy, Windows Installer, Error Reporting, Event Log, Common Log File System |
Component model | COM, COM+, ActiveX, Distributed Component Object Model, .NET Framework |
Libraries | Base Class Library (BCL), Microsoft Foundation Classes (MFC), Active Template Library (ATL), Windows Template Library (WTL) |
Device drivers | Windows Driver Model, Windows Driver Foundation (KMDF), Windows Driver Foundation (UMDF), WDDM, NDIS, UAA, Broadcast Driver Architecture, VxD |
Security | Crypto API (CAPICOM), Windows CardSpace, Data Protection API, Security Support Provider Interface (SSPI) |
.NET | ASP.NET, ADO.NET, Base Class Library (BCL), Remoting, Silverlight, TPL, WCF, WCS, WPF, WF |
Software factories | EFx Factory, Enterprise Library, Composite UI, CCF, CSF |
IPC | MSRPC, Dynamic Data Exchange (DDE), Remoting, WCF |
See also
Favorite site
References
-
Soenlab_com.7z ↩