Is this for your own program, or to target another program? For example, do you wnat to be able to press Ctrl-Alt-H and have the cursor locked on the horizontal plain in Photshop?
This is reasonably straight forward to do with ClipCursor(). However, if you need to do it in a target process, it may involve remote code injection to run ClipCursor from the right application.
Code:
// Sample only
#include <windows.h>
#include <stdio.h>
int main(void)
{
POINT pt;
GetCursorPos(&pt);
RECT rc = { pt.x, 0, pt.x + 1, 1024 };
ClipCursor(&rc);
getchar();
ClipCursor(NULL);
return 0;
}