2007-09-26

Receive windows message

Recently, I work on how to receive windows message.
In fact, there's two way to achieve this.

If you have MFC window, or your AP is already a window, it's easy to handle all kinds of messages as long as you overwrite this function, PreTranslateMessage.

However, how about there's no any window in your AP?

The answer is we can create a window for your AP to receive windows message.

Firstly, set your dummy window properties and set the function to receive window message by assigning function pointer to lpfnWndProc. (We call dummy window because it doesn't have its own form, it is just used for some purpose)

WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) DummyWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = _AtlBaseModule.GetModuleInstance();
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = CLMLSVC_CLASS_NAME;


Second, register and create this window.
RegisterClass(&wc);
m_hDummyWnd = ::CreateWindow(CLMLSVC_CLASS_NAME,
L"",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0,
CW_USEDEFAULT, 0,
NULL, NULL, _AtlBaseModule.GetModuleInstance(), NULL);

Finally, pass some user data for later use. We'll know why we use this.
if (IsWindow(m_hDummyWnd))
::SetWindowLong(m_hDummyWnd, GWL_USERDATA, (long)this);
Now, to handle the message, we just implement the function mentioned above.
LRESULT CALLBACK CMLSvc::DummyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Note that, if we want to use the user data we passed previously, just write this line in the function.
CMLSvc* pCLMLSvc = (CMLSvc*)::GetWindowLong(hWnd, GWL_USERDATA);

2007-09-21

Powerset

Here comes another type of search engine. It is said that it will be released soon.

This search engine is based on natural language rather than on keyword, which is used by most of the search engines, such as google. Imagine that you are asking a question with someone. So you can type a sentence, such as "Who is A-Rod".

Of course, machine learning technology always needs user feedback. More feedback will make the answer more precisely. If one thousand people ask the same question, I think, you, as the one thousand first, will get the answer most satisfying you.

Is it possible to kick google out of the leading position in search area?
Who knows? But I'm sure that natural language will be the next generation.
(A smart robot is coming soon?)

For more information, please visit Powerset homepage

2007-09-20

Google blog

Well, this is my.. uh ... I forgot how many bloggers I already have.

Proceeding less than four steps, choosing a word for your space, and now this is what I've seen.
This is a trend.

In the future, technology will make user look more stupid, because it is the goal of those designers and inventors.

You'll see what will happen in the future. There are only a small group of the smart guys in the earth, and the others will have relinquished brains.