I assume you are talking about GUI programming?
This really depends on the platform you are running on. If you are programming a win32 application, inside the windowproc function you will provide a case WM_KEYDOWN.
Code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_KEYDOWN:
// check the key code for the ctrl button against wParam
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
There is also third party libraries you can use in order to make the program more portable. For example, QT is widely used and the code is reusable on windows / unix / linux (as long as the QT library is installed on that machine).
Also wxWidgets is a good one, which supports GDK, Windows and MacOS.