Editor’s Note

The Internet never ceases to amaze. Our latest Web-page plaything has become Search Voyeur (http://voyeur.mckinley.com/voyeur.cgi), brought to you by the folks at Excite. This page shows you a sampling of search queries currently being run on the Magellan search engine. The results are not surprising—the Web is clearly a melting pot of character. Let’s just take a look at ten of these Search Voyeur samplings. (The samples have been sanitized to remove the seven things you can’t say on television, plus a few more phrases.)

judge fujisaki

hallucination chatroom

instantaneous matter transport

enema

nervousing

kinky stuff

auto claims adjustor exam questions

clams

clinical rheumatology

l. ron hubbard

What does this say about folks searching the Web? What do they want? Do hopeful insurance reps like to drop acid and beam over to Fujisaki’s courtroom? Once they become accredited adjustors, do they throw clambakes for Scientologists? And what is Nervousing?

We see a challenge for Web programmers (beyond trying to satisfy those looking for kinky arthritis treatments): we better write some pretty sophisticated unnatural-language processing software for our Web apps. Even though the Internet and email have made writers out of almost everyone, it hasn’t helped anyone’s spelling. Every third query displayed by Search Voyeur is mispelled. Even our wired schoolkids seem to have a little trouble with spelling: type "congradulations" into AltaVista and check out the 3000 or so hapless spellers working the Web. It’s Web Darwinism: spell it right and you’ll get the right info; spell it wrong and you’ll get the wrong info!

Speaking of sophisticated text-processing challenges, how many of you typed "Where’s the missing text between Page 26 and Page 28 of the December 1996 MSJ?" into Yahoo this month? While we were busy scurrying around trying to get a "Tickle Me Elmo" for less than the price of a Pentium Pro, we seemed to let a few words slip away. Here’s the entire two paragraphs, in case your search engine came back empty-handed:

Don’t create threads with the C runtime functions beginthread or beginthreadex if the threads will access any MFC objects. The framework uses CWinThread to manage thread-specific data. You should use AfxBeginThread to start your threads (or call the CWinThread constructor and its CreateThread method). CWinThread::CreateThread eventually calls beginthreadex after taking care of some setup and synchronization.

Don’t expect to be able to access any MFC objects not created within your thread. Each thread gets its own handle map within MFC, which means, for instance, that a handle to a CWnd passed to a thread method may be invalid inside the thread. Instead, pass handles to threads as their native HANDLE type, and then use the FromHandle or Attach methods to obtain a handle to an MFC object. Sometimes you don’t have to go to this much trouble. CThreadSafeWnd::PaintBall, for instance, takes a pointer to a CWnd as an argument and works fine. It would take delving deeply into Windows internals to determine which situations require special handling and which don’t. I suggest that you try the simple approach first and then, if that doesn’t work, resort to FromHandle or Attach.

Hey, don’t stay up too late with that Search Voyeur page—we wouldn’t want to see you doing anything nervousing. D.E.comments, or suggestions for MSJ? Send them to the editor: ericm@microsoft.com

Microsoft, Visual Basic, Visual C++, Windows, Windows NT, and Win32 are registered trademarks and ActiveX and Developer Studio are trademarks of Microsoft Corporation. Other trademarks or tradenames mentioned herein are the property of their respective owners.

Microsoft Systems Journal does not make any representation or warranty, express or implied with respect to any code or other information herein. Microsoft Systems Journal disclaims any liability whatsoever for any use of such code or other information.

Other ways to get code: MSJ articles, source code, and other developer information is available through membership in the Microsoft Developer Network (MSDN). For membership info and a free demo diskette, call 800-759-5474 (U.S. and Canada). In Europe, please call +31 10 258 88 64. Outside Europe and North America, call 303-684-0914 for local contact information.

Via anonymous ftp on the Internet

ftp.microsoft.com

Look in the /developr/MSJ directory

CIX (The United Kingdom)

0181 296 1255

Microsoft Web site

http://www.microsoft.com

Select Support, then look in the Microsoft Software Library or Knowledge Base

Channel1 (Massachusetts)

617-354-3230

J 6 (Microsoft Conference) at Channel1 Commands Menu: use (F)ile directories to scan files

Microsoft Download Service (Washington)

206-936-6735

(F)ile Index

5 Languages and Windows SDK

or (F)ile Search for MSJ keyword

This article is reproduced from Microsoft Systems Journal. Copyright © 1997 by Miller Freeman, Inc. All rights are reserved. No part of this article may be reproduced in any fashion (except in brief quotations used in critical articles and reviews) without the prior consent of Miller Freeman.

To contact Miller Freeman regarding subscription information, call (800) 666-1084 in the U.S. and Canada, or (303) 678-0439 in all other countries. For other inquiries, call (415) 905-2200.