|
写了一个小的应用程序,通过修改注册表,设置成开机自动运行.(我用vs2005远程跑是没问题的)
可是,开机时会卡在log界面上.请问下高手,问题在哪里?
添加注册表如下:
[HKEY_LOCAL_MACHINE\init]
"Launch50"="startup.exe"
"Depend50"=hex:14,00, 1e,00
starup.exe 代码如下:
void NotifyWavDevByFm(DWORD Command)
{
HANDLE hWavDev = CreateFile(TEXT("WAV1:"), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_ALWAYS, 0, 0);
if (hWavDev == NULL)
{
return ;
}
//以下操作是打开音频设备
DWORD OutBuf = 0;
MMDRV_MESSAGE_PARAMS InBuf;
InBuf.uMsg= WPDM_CONTROL_AUXOUT_PATH;
InBuf.uDeviceId = 0;
InBuf.dwUser = 0;
InBuf.dwParam1 = Command;
DeviceIoControl(hWavDev, IOCTL_WAV_MESSAGE, &InBuf, sizeof(InBuf), &OutBuf,sizeof(OutBuf),
NULL, NULL);
if (hWavDev != NULL)
CloseHandle(hWavDev);
}
int _tmain(TCHAR argc,TCHAR* argv[])
{
NotifyWavDevByFm(1);
SignalStarted(50); //notify the OS
return 1;
}
WAV是音频驱动,built-in driver.应该在我的应用之前就加载了吧.
|
|