65,211
社区成员
发帖
与我相关
我的任务
分享
int loop()
{
int temp = 0,iCount = 0,i = 0,j = 0;
int *idata;
scanf("%d",&iCount);
idata = (int*)malloc(iCount*sizeof(int));
for (i = 0;i < iCount;i++)
{
scanf("%d",&idata[i]);
}
for (i = 0;i < iCount;i++)
{
for (j = i;j < iCount;j++)
{
if (idata[i] < idata[j])
{
temp = idata[i];
idata[i] = idata[j];
idata[j] = temp;
}
}
}
for (i = 0;i < iCount;i++)
{
printf("%d\t",idata[i]);
}
delete(idata);
return 1;
}
#include "windows.h"
void CALLBACK OnThreadTimer(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
{
printf("ok");
}
int main()
{
UINT_PTR nTimerID = SetTimer(NULL,1,1000,OnThreadTimer);
cout<<nTimerID<<endl;
HWND hwndTimer=::FindWindow(NULL,L"d:\\x\\test\\structin\\debug\\structin.exe"); // handle to window for timer messages
MSG msg; // message structure
while (GetMessage(&msg, // message structure
NULL, // handle to window to receive the message
NULL, // lowest message to examine
NULL) // highest message to examine
!= 0 && GetMessage(&msg, NULL, NULL, NULL) != -1)
{
// Post WM_TIMER messages to the hwndTimer procedure.
if (msg.message == WM_TIMER)
{
msg.hwnd = hwndTimer;
}
TranslateMessage(&msg); // translates virtual-key codes
DispatchMessage(&msg); // dispatches message to window
}
Sleep(10000);
system("pause");
return 0;
}