
10E. C Languages II. SOFTWARE GUIDES - 10. Driver488/W31
II-226 Personal488 User’s Manual, Rev. 3.0
#include “iotmc60w.h”
#include “stdio.h”
/* Global variables */
DevHandleT ieee, adc, devhandle; /* handles for IEEE devices */
char textstr[2048], response[64];
/* strings for Driver488/W31 responses*/
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR
lpszCmdLine, int nCmdShow)
{
/*******************************************************************/
/* HANDLE hInstance; handle for this instance */
/* HANDLE hPrevInstance; handle for possible previous instances */
/* LPSTR lpszCmdLine; long pointer to exec command line */
/* int nCmdShow; Show code for main window display */
/*******************************************************************/
MSG msg; /* MSG structure to store your messages */
int nRc; /* return value from Register Classes */
strcpy(szAppName, “EXAMPLE3");
hInst = hInstance;
if (!hPrevInstance) {
/* register window classes if first instance of application */
if ((nRc = nCwRegisterClasses()) == -1) {
/* registering one of the windows failed */
LoadString(hInst, IDS_ERR_REGISTER_CLASS, szString,
sizeof(szString));
MessageBox(NULL, szString, NULL, MB_ICONEXCLAMATION);
return nRc;
}
}
/* create application’s Main window */
hWndMain = CreateWindow(
szAppName /* Window class name */
“Driver488/W31 Simple Example”, /* Window’s title */
WS_CAPTION | /* Title and Min/Max */
WS_SYSMENU | /* Add system menu box */
WS_MINIMIZEBOX | /* Add minimize box */
WS_MAXIMIZEBOX | /* Add maximize box */
WS_THICKFRAME | /* thick sizeable frame */
WS_CLIPCHILDREN | /* don’t draw in child windows areas */
WS_OVERLAPPED,
CW_USEDEFAULT, 0, /* Use default X, Y */
CW_USEDEFAULT, 0, /* Use default X, Y */
NULL, /* Parent window’s handle */
NULL, /* Default to Class Menu */
hInst, /* Instance of window */
NULL); /* Create struct for WM_CREATE */
if (hWndMain == NULL) {
LoadString(hInst, IDS_ERR_CREATE_WINDOW, szString,
sizeof(szString));
MessageBox(NULL, szString, NULL, MB_ICONEXCLAMATION);
return IDS_ERR_CREATE_WINDOW;
}
ShowWindow(hWndMain, nCmdShow); /* display main window */
while (GetMessage(&msg, NULL, 0, 0)) { /* Until WM_QUIT message */
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Komentáře k této Příručce