// Notify_Icon.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include <shellapi.h>int g_count=5;
VOID CALLBACK TimerProc( HWND hwnd,   UINT uMsg,   UINT idEvent,   DWORD dwTime )
{
//这里根本没被调用过。为什么?
OutputDebugString("done\n");
if(!(--g_count))PostQuitMessage(0);;
return ;
}
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
int MyTimer= SetTimer(NULL,1,100,TimerProc);//返回值表示成功
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)){
}
KillTimer(NULL,MyTimer);
return 0;
}

解决方案 »

  1.   

    建立一个Win32的工程,然后再设置定时器你的程序不全,窗口都没有建立
      

  2.   

    非要建立窗口不可么?
    这个是完全版本的程序
    用了 precomplier 的。
    编译没问题,问题是出在调用不生效。
      

  3.   

    晕,你连消息分发函数都没有
    你的定时处理函数怎么会被调用啊在while (GetMessage(&msg, NULL, 0, 0)){
    }
    中加上TranslateMessage(&msg);
    DispatchMessage(&msg);
    就可以了