using C because i am stronger in C then C++ at the moment, as i been tutoring C for a while now, and have done very little in c++ in the last 4 years.
and yeah the windows form app i made, i did just that, "I just keep bashing it until it behaves" lol
basically i am taking a circuit i made for the parallel port (8 data outs + 2 control outs) and instead of using the parallel port (as everything after win me BLOCKED direct writes to the port unless you install a modified driver, and of course parallel ports are getting scarse, and usb to parallel dont work as expected)
i replaced the parallel port with the vellman 8055 usb "adapter". using the 8 data outs and 2 analog outs.
the program/circuit uses a "6 pass write" to send data. send one byte(data), trigger flip flop, send i byte (steering) trigger flipflop, then 1 of 320 relays are on.
well my program was running in console in c++, but now that i am using a toughbook with the vellman board as the center of the controller, i want to be able to "see" all 320 "lights" and click the light or a button underneith to switch them. vc++ seemed the way to go, untill i discovered forms ISNT C++!!! so in short falling back to C like i said, becuase i know it better!
is there another route that would be better?? like actually using a C++ GUI, over a C GUI?
my orig program i was already using functions from the api.
Code:
void GetWindowSize()
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(
GetStdHandle( STD_OUTPUT_HANDLE ),
&csbi
))
{
lines = csbi.srWindow.Bottom -csbi.srWindow.Top +1;
columns = csbi.srWindow.Right -csbi.srWindow.Left +1;
}
else lines = columns = 0;
}
void SetWindowSize(int lines,int columns )
{
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(
GetStdHandle( STD_OUTPUT_HANDLE ),
&csbi
))
{
// Make sure the new size isn't too big
if (lines > csbi.dwSize.Y) lines = csbi.dwSize.Y;
if (columns > csbi.dwSize.X) columns = csbi.dwSize.X;
// Adjust window origin if necessary
if ((csbi.srWindow.Top +lines) > csbi.dwSize.Y) csbi.srWindow.Top = csbi.dwSize.Y -lines -1;
if ((csbi.srWindow.Left +columns) > csbi.dwSize.Y) csbi.srWindow.Left = csbi.dwSize.X -columns -1;
// Calculate new size
csbi.srWindow.Bottom = csbi.srWindow.Top +lines -1;
csbi.srWindow.Right = csbi.srWindow.Left +columns -1;
SetConsoleWindowInfo(
GetStdHandle( STD_OUTPUT_HANDLE ),
true,
&csbi.srWindow
);
}
}
void GetLocation()
{
HANDLE hStdout = GetStdHandle( STD_OUTPUT_HANDLE );
CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo = { 0 };
GetConsoleScreenBufferInfo( hStdout, &ScreenBufferInfo );
X=ScreenBufferInfo.dwCursorPosition.X;
Y=ScreenBufferInfo.dwCursorPosition.Y;
}
void GotoXY( short x, short y )
{
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE) ;
COORD position = { x, y } ;
SetConsoleCursorPosition( hStdout, position ) ;
}