我刚为Winamp制作了这个非常简单的.dll插件。它在我的电脑上工作得非常好,但我是为一位要求这个的朋友做的。这是我第一次使用Visual Studio 2013 并使用c ++制作dll文件...我的问题是我无法弄清楚为什么它不能在他的电脑上工作,我认为这是一个出口问题,但我不完全确定。
#include "stdafx.h"
#include <windows.h>
#include "gen_InfinitePlay.h"
#include "wa_ipc.h"
#include <stdio.h>
using namespace System;
using namespace System::Threading;
// these are callback functions/events which will be called by Winamp
int init(void);
void config(void);
void quit(void);
// this structure contains plugin information, version, name...
// GPPHDR_VER is the version of the winampGeneralPurposePlugin (GPP) structure
winampGeneralPurposePlugin plugin = {
GPPHDR_VER, // version of the plugin, defined in "gen_InfinitePlay.h"
PLUGIN_NAME, // name/title of the plugin, defined in "gen_InfinitePlay.h"
init, // function name which will be executed on init event
config, // function name which will be executed on config event
quit, // function name which will be executed on quit event
0, // handle to Winamp main window, loaded by winamp when this dll is loaded
0 // hinstance to this dll, loaded by winamp when this dll is loaded
};
void play(){
while (true){
if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) != 1)
SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_STARTPLAY);
Sleep(60000);
}
}
// event functions follow
int init() {
Thread^ t = gcnew Thread(gcnew ThreadStart(play));
t->Start();
return 0;
}
void config() {
//A basic messagebox that tells you the 'config' event has been triggered.
//You can change this later to do whatever you want (including nothing)
//MessageBox(plugin.hwndParent, L"Config event triggered for gen_InfinitePlay.", L"", MB_OK);
}
void quit() {
//A basic messagebox that tells you the 'quit' event has been triggered.
//If everything works you should see this message when you quit Winamp once your plugin has been installed.
//You can change this later to do whatever you want (including nothing)
//MessageBox(0, L"Quit event triggered for gen_InfinitePlay.", L"", MB_OK);
}
// This is an export function called by winamp which returns this plugin info.
// We wrap the code in 'extern "C"' to ensure the export isn't mangled if used in a CPP file.
extern "C" __declspec(dllexport) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin() {
return &plugin;
}
答案 0 :(得分:1)
您缺少Visual Studio 2013运行时。安装它的正确方法是通过Visual Studio 2013可再发行组件。
http://www.microsoft.com/en-us/download/details.aspx?id=40784
答案 1 :(得分:0)
MSVCR120.DLL丢失了,它可能不是让它工作的“正确”方式,但我只是把我复制到他的插件目录......我仍然认为它可以通过一些出口标志或其他东西解决但我是懒惰的这个