- From: Henrik Frystyk Nielsen <frystyk@w3.org>
- Date: Thu, 08 Feb 1996 11:16:58 -0500
- To: www-lib@w3.org
Thanks a lot for the many inputs on getting the Windows version working. Eric
and I have got the windoes handle problem right which turned out not to be due
to compatibility problems with other windos platforms. The code (the
interesting part is between the parts
#ifdef WWW_WIN_ASYNC
...
#endif
is included below. It is taken from HTAccess.c in the library code.
Now, we still have the memory error to fix. Anders Borg <Anders.Borg@axis.se>
has worked on it as well and mentions that it works if using a static library
instead of DLLs. That leaves me to believe that the DLL interface has changed
for this version of msvc.
So the big question is: Does anybody have any idea how we can get this to work?
Thanks for any input!
Henrik
0
\ /
-- CLIP -- CLIP -- CLIP -- x -- CLIP -- CLIP -- CLIP -- CLIP -- CLIP -- CLIP --
/ \
0
/* HTLibInit
**
** This function initiates the Library and it MUST be called when
** starting up an application. See also HTLibTerminate()
*/
PUBLIC BOOL HTLibInit (CONST char * AppName, CONST char * AppVersion)
{
#ifdef WWW_WIN_ASYNC
/*
** We are here starting a hidden window to take care of events from
** the async select() call in the async version of the event loop in
** the Internal event manager (HTEvntrg.c)
*/
HWND htSocketWin;
static char className[] = "AsyncWindowClass";
WNDCLASS wc;
OSVERSIONINFO osInfo;
wc.style=0;
wc.lpfnWndProc=(WNDPROC)AsyncWindowProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hIcon=0;
wc.hCursor=0;
wc.hbrBackground=0;
wc.lpszMenuName=(LPSTR)0;
wc.lpszClassName=className;
osInfo.dwOSVersionInfoSize = sizeof(osInfo);
GetVersionEx(&osInfo);
if (osInfo.dwPlatformId == VER_PLATFORM_WIN32s || osInfo.dwPlatformId ==
VER_PLATFORM_WIN32_WINDOWS)
wc.hInstance=GetModuleHandle(NULL); /* 95 and non threaded platforms */
else
wc.hInstance=GetCurrentProcess(); /* NT and hopefully everything following */
#endif /* WWW_WIN_ASYNC */
#if WWWTRACE_MODE == WWWTRACE_FILE /* Open trace file */
if ((TDEST = fopen(HT_TRACE_FILE, "a")) != NULL) {
if (setvbuf(TDEST, NULL, _IOLBF, 0) < 0) { /* Change to line buffer */
TTYPrint(TDEST, "WWWLibInit.. Can't initialize TRACE buffer - no
TRACE\n");
fclose(TDEST);
TDEST = NULL;
WWW_TraceFlag = 0;
}
} else
WWW_TraceFlag = 0;
#endif /* WWWTRACE_FILE */
if (WWWTRACE)
TTYPrint(TDEST, "WWWLibInit.. INITIALIZING LIBRARY OF COMMON CODE\n");
/* Set the application name and version */
if (AppName) {
char *ptr;
StrAllocCopy(HTAppName, AppName);
ptr = HTAppName;
while (*ptr) {
if (WHITE(*ptr)) *ptr = '_';
ptr++;
}
}
if (AppVersion) {
char *ptr;
StrAllocCopy(HTAppVersion, AppVersion);
ptr = HTAppVersion;
while (*ptr) {
if (WHITE(*ptr)) *ptr = '_';
ptr++;
}
}
HTBind_init(); /* Initialize bindings */
#ifdef WWWLIB_SIG
/* On Solaris (and others?) we get a BROKEN PIPE signal when connecting
** to a port where we should get `connection refused'. We ignore this
** using the following function call
*/
HTSetSignal(); /* Set signals in library */
#endif
#ifdef WWW_WIN_ASYNC
if (!RegisterClass(&wc)) {
TTYPrint(TDEST, "HTEvent_Loop.. Can't RegisterClass \"%s\"\n", className);
return NO;
}
if (!(htSocketWin = CreateWindow(className, "WWW_WIN_ASYNC", WS_POPUP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, 0, 0,
wc.hInstance,0))) {
char space[50];
TTYPrint(TDEST, "HTEvent_Loop.. Can't CreateWindow \"WWW_WIN_ASYNC\" -
error:");
sprintf(space, "%ld\n", GetLastError());
TTYPrint(TDEST, space);
return NO;
}
HTEvent_setWinHandle (htSocketWin, WM_USER); /* use first available
message since app uses none */
#endif /* WWW_WIN_ASYNC */
#ifdef _WINSOCKAPI_
/*
** Initialise WinSock DLL. This must also be shut down! PMH
*/
{
WSADATA wsadata;
if (WSAStartup(DESIRED_WINSOCK_VERSION, &wsadata)) {
if (WWWTRACE)
TTYPrint(TDEST, "WWWLibInit.. Can't initialize WinSoc\n");
WSACleanup();
return NO;
}
if (wsadata.wVersion < MINIMUM_WINSOCK_VERSION) {
if (WWWTRACE)
TTYPrint(TDEST, "WWWLibInit.. Bad version of WinSoc\n");
WSACleanup();
return NO;
}
}
#endif /* _WINSOCKAPI_ */
#ifndef NO_TIMEGM
HTGetTimeZoneOffset(); /* Find offset from GMT if using mktime() */
#endif
HTTmp_setRoot(NULL); /* Set up default tmp directory */
return YES;
}
Received on Thursday, 8 February 1996 11:17:07 UTC