首先,使程序最小化到托盘肯定是windwos窗口程序(控制台程序没有这个功能的)而用devcpp写窗口程序本身就有一堆复杂代码了,一个最简单的窗口:#include<windows.h>/*Thisiswherealltheinputtothewindowgoesto*/LRESULTCALLBACKWndProc(HWNDhwnd,UINTMessage,WPARAMwParam,LPARAMlParam){switch(Message){/*Upondestruction,tellthemainthreadtostop*/caseWM_DESTROY:{PostQuitMessage(0);break;}/*Allothermessages(alotofthem)areprocessedusingdefaultprocedures*/default:returnDefWindowProc(hwnd,Message,wParam,lParam);}return0;}/*The'main'functionofWin32GUIprograms:thisiswhereexecutionstarts*/intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPSTRlpCmdLine,intnCmdShow){WNDCLASSEXwc;/*Apropertiesstructofourwindow*/HWNDhwnd;/*A'HANDLE',hencetheH,orapointertoourwindow*/MSGmsg;/*Atemporarylocationforallmessages*//*zerooutthestructandsetthestuffwewanttomodify*/memset(&wc,0,sizeof(wc));wc.cbSize=sizeof(WNDCLASSEX);wc.lpfnWndProc=WndProc;/*Thisiswherewewillsendmessagesto*/wc.hInstance=hInstance;wc.hCursor=LoadCursor(NULL,IDC_ARROW);/*White,COLOR_WINDOWisjusta#defineforasystemcolor,tryCtrl+Clickingit*/wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);wc.lpszClassName="WindowClass";wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);/*Loadastandardicon*/wc.hIconSm=LoadIcon(NULL,IDI_APPLICATION);/*usethename"A"tousetheprojecticon*/if(!RegisterClassEx(&wc)){MessageBox(NULL,"WindowRegistrationFailed!","Error!",MB_ICONEXCLAMATION|MB_OK);return0;}hwnd=CreateWindowEx(WS_EX_CLIENTEDGE,"WindowClass","Caption",WS_VISIBLE|WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,/*x*/CW_USEDEFAULT,/*y*/640,/*width*/480,/*height*/NULL,NULL,hInstance,NULL);if(hwnd==NULL){MessageBox(NULL,"WindowCreationFailed!","Error!",MB_ICONEXCLAMATION|MB_OK);return0;}/*ThisistheheartofourprogramwhereallinputisprocessedandsenttoWndProc.NotethatGetMessageblockscodeflowuntilitreceivessomething,sothisloopwillnotproduceunreasonablyhighCPUusage*/while(GetMessage(&msg,NULL,0,0)>0){/*Ifnoerrorisreceived...*/TranslateMessage(&msg);/*Translatekeycodestocharsifpresent*/DispatchMessage(&msg);/*SendittoWndProc*/}returnmsg.wParam;}你用纯C+++SDK写托盘,首先要用消息处理,处理SC_MINIMIZE这个消息并用Shell_NotifyIcon函数将窗口显示到托盘(又要有几十行程序),然后你还要做一个按键或菜单来恢复托盘这个即使一个win32高手至少花费半天时间(请你计算下这个成本)何况,现在很少有人直接用SDK写窗口了。这个用MFC,熟手最多半小时解决而用C++builder,一个控件,分分种就可以了你若自己想研究,建议先看MSDN的消息处理及Shell_NotifyIcon的功能。