文件不随计时器移动 [英] File Not Moving With Timer
本文介绍了文件不随计时器移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在控制台应用程序中使用一个简单的计时器移动文件.计时器似乎正在运行,但是文件没有移动.任何帮助表示赞赏.谢谢你.
I''m trying to move a file with a simple timer in my console app. The timer seems to be working, however the file isn''t moving. Any help is appreciated. Thak you.
// Phonebooth.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <time.h>
#include <windows.h>
#include <iostream>
VOID CALLBACK TimerProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_TIMER message
UINT_PTR idEvent, // timer identifier
DWORD dwTime // current system time
)
{
printf("Die, ****in' world\n");
rename("c:\\PASS\\airport.zip", "c:\\Users\\DS\\Downloads\\");
}
DWORD WINAPI ThreadProc(
LPVOID lpParameter // thread data
)
{
UINT uiTimer = ::SetTimer(NULL, 12354, 100, TimerProc);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
// ranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
int main()
{
HANDLE hThread = ::CreateThread(NULL, NULL, ThreadProc, NULL, NULL, NULL);
CloseHandle(hThread);
::Sleep(10000);
return 0;
}</iostream></windows.h></time.h>
推荐答案
将文件名添加到第二部分.
Add the file name to the second part.
rename("c:\\PASS\\airport.zip", "c:\\Users\\DS\\Downloads\\airport.zip");
这篇关于文件不随计时器移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文