快速登录:  

Forum: VirtualDJ Plugins

话题: OnTimer() Function in a "Blank Plugin" Project ?!

由于该帖子已年深日久,可能包含陈旧过时或描述错误的信息。

pernPRO InfinityMember since 2004
I need a OnTimer() function in a "Blank Plugin" Project, what is the best way to do that ?
 

发表时间 Fri 08 Aug 08 @ 2:13 am
SBDJPRO Infinity Member since 2006
What do you need to do in that timer routine? Would it not be best to use an API call to set up a timer with a callback function attached - assuming it's not any DirectX drawing operation of course.
 

发表时间 Fri 08 Aug 08 @ 7:33 am
pernPRO InfinityMember since 2004
It should "monitor" VDJ via GetInfo() and then when changes accours like a new song loaded send it to a LCD display or a Named Pipe connection. So no DirectX etc.


I am going to use this for 3 different things.

1 - Generic VDJ to .NET communications lib. Via Named pipes Full Duplex. This will not just "monitor".

2 - Extra LCD to my DMC1/DAC2 mappers. To show extra info.

3 - Generic LCD for controllers without it. Like DJC, RMX etc.
 

发表时间 Fri 08 Aug 08 @ 7:54 am
djcelPRO InfinityModeratorMember since 2004
You have 2 ways:

* a Timer:

// Declaration
void CALLBACK TimerProc(HWND, UINT, UINT, DWORD);
UINT uTimer;
DWORD speed; // (in ms)

// Constructor
uTimer = (UINT) SetTimer(NULL, NULL, speed, (TIMERPROC)TimerProc);

// Desctructor
KillTimer(NULL, uTimer);

// Your function
void CALLBACK TimerProc(HWND, UINT, UINT, DWORD)
{
// write here to do each 'speed' ms
}

* a new Thread:

==> the easy way:

//Declaration
HANDLE hThread;
DWORD dwThreadId;
DWORD speed; // (in ms)
DWORD WINAPI NewThread( void* lpParameter );

// Constructor
hThread=CreateThread(NULL, 0, NewThread, lpParameter, NULL, &dwThreadId);

// Destructor
DWORD dwRes=WaitForSingleObject( hThread, INFINITE );

or
( BOOL bRes=TerminateThread(hThread, 0); )

// The function
DWORD WINAPI NewThread( void* lpParameter )
{
// write here to do each 'speed' ms
Sleep(speed);
}

==> the advanced and safer way

use an event or other ways
 

发表时间 Fri 08 Aug 08 @ 10:42 am
pernPRO InfinityMember since 2004
Thanks for the info .
 

发表时间 Sat 09 Aug 08 @ 2:12 am


(陈旧帖子或论坛版块会自动关闭)