#include "skygi/skygi.h" /* Include GI Functions */ void * EventHandler(HANDLE hWnd, s_gi_msg *msg); /* Prototype our Event Handler */ int main() { sCreateApplication *app; /* Create our Main Application Struct */ s_gi_msg msg; /* Create our Messaging Passing Interface */ HANDLE MainWin; /* Create our HANDLE for the Main Window */ if (GI_Initialize() != 0) { /* Initialize GI and check for failure */ fprintf(stderr, "Unable to Init GI"); return -1; } app = GI_ApplicationStructCreate(); /* Create Application Struct */ strcpy(app->ucApplicationName, "Testing"); /* Set the Title */ app->uiX = 0; /* Set Starting X Coordinate */ app->uiY = 0; /* Set Starting Y Coordinate */ app->uiHeight = 480; /* Set Window Height */ app->uiWidth = 640; /* Set Window Width */ app->uiStyleApplication = 0; /* Set Application Style to Default */ app->uiStyleFrame = 0; /* Set Frame Style to Default */ app->uiStyleTitle = 0; /* Set Title Style to Default */ app->uiStyleMenu = 0; /* Set Menu Style to Default */ app->uiStyleBar = 0; /* Set Bar Style to Default */ app->uiStyleClient = 0; /* Set Client Style to Default */ app->uiBackGroundColor = 0; /* Set Background Color to Default */ app->fwndClient = EventHandler; /* Set Event Handler Name, * The value of fwndClient will * have to be the same as the name * of the Event Handler Function * we prototyped earlier */ MainWin = GI_ApplicationCreate(app); /* Creates Application using * Settings we specified earlier */ if (GI_ApplicationWindowShow(MainWin) != S_OK) { /* Show Application Window and check return value */ fprintf(stderr, "Unable to Show Application Window"); return -1; } int run; while (1) { /* Endless loop, to make the Window stay open */ run = GI_MessageWait(&msg, NULL); /* Get return value to check for messages */ /* GI_MessageWait() returns 0 on MSG_QUIT */ if (!run) /* If GI_MessageWait returned 0 */ if (msg.win == MainWin) /* Check if MSG_QUIT was sent to MainWin */ break; /* If so, break out of the while loop */ GI_MessageDispatch(msg.win, &msg); } GI_WindowDestroy(MainWin); /* Close Window */ return 0; /* End Program */ } void * EventHandler(HANDLE hWnd, s_gi_msg *msg) { switch (msg->type) { /* Check for messages */ case MSG_DESTROY: /* If message is MSG_DESTROY: */ GI_MessageQuitPost(hWnd); /* Send MSG_QUIT to MainWin */ break; case MSG_COMMAND: /* If message is a command: */ switch (msg->para1) { /* Check type of message */ /* * This will be where you specify what action will take place * when a button is clicked or a key pressed, et cetera */ break; } break; } }