RU EN
Main Page Download Addons Forum Blog Feedback
News: AIMP for Android v4.00
 
0 Members and 1 Guest are viewing this topic. Previous topic - Next topic

bescheidener

miketsoft подсказал (без изменений в SDK):

//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#include "aimp2_sdk.h"
//---------------------------------------------------------------------------
class TMyPlug: public TInterfacedObject, public IAIMPAddonHeader
{
private:
  IAIMP2Controller *ctrl;
public:
  HRESULT __stdcall QueryInterface(const GUID& IID, void **Obj)
    { return TInterfacedObject::QueryInterface(IID, (void *)Obj); }
  ULONG __stdcall AddRef()
    { return TInterfacedObject::_AddRef(); }
  ULONG __stdcall Release()
    { return TInterfacedObject::_Release(); }
  BOOL __stdcall GetHasSettingsDialog() { return false; }
  PWCHAR __stdcall GetPluginAuthor() { return L"MikeTSoft"; }
  PWCHAR __stdcall GetPluginName() { return L"Cool MikeTSoft Plugin"; }
  void __stdcall Finalize() {}
  void __stdcall Initialize(IAIMP2Controller *AController) { ctrl=AController; }
  void __stdcall ShowSettingsDialog(HWND AParentWindow) {}
};
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) BOOL __stdcall AIMP_QueryAddonEx(IAIMPAddonHeader *&AHeader)
{
  AHeader=dynamic_cast<IAIMPAddonHeader *>(new TMyPlug());
  return TRUE;
}
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
  return 1;
}
//---------------------------------------------------------------------------



Artem

Quote from: IldarM on March 29, 2010, 15:39:01
после чего методы начали  работать, но вылетает AV,  ждем комментариев Artem

Последовательность такая:


  FAddonHeader := AHeader;
  FPluginAuthor := AHeader.GetPluginAuthor;
  FPluginName := AHeader.GetPluginName;
  FAddonHeader.Initialize(AddonController);

miketsoft

Прототип ф-ции должен быть аналогичен прототипу ф-ции QueryInterface, имхо, например, такой:

extern "C" __declspec(dllexport) BOOL __stdcall AIMP_QueryAddonEx(IAIMPAddonHeader* &AHeader);

Т.е. нужно передавать ссылку на указатель на интерфейс (ну или указатель на указатель, кому как больше нравится). Делфя все эти вещи очень хитро скрывает... :)
Каком Ваш вердикт, братья-Сишники? :)

bescheidener

Переписал один из своих аддонов "по-новому" и появился вот такой "варнинг":
[BCC32 Warning] aimp2_sdk.h(10): W8058 Cannot create pre-compiled header: initialized data in header


Добавлено через 31 сек.

?

miketsoft

А ты aimp2_sdk.h подключил до строки "#pragma hdrstop" или после? Скорее всего, до. Переcтавь include после этой строки и должно пройти :)

bescheidener

Да. :) Перенёс все #includ'ы после #pragma hdrstop и стало хорошо.

IldarM

miketsoft и bescheidener

есть примеры на новом SDK

bescheidener


IldarM

извиняюсь, это был вопрос)

bescheidener

Quote from: IldarM on March 31, 2010, 23:33:41
извиняюсь, это был вопрос)
Тот, что в 60-ом посте, не пробовал?

miketsoft

Выкладываю свой (подправленный и дополненный официальный) заголовочный файл aimp2_sdk.h и два примера плагинов (общий и визуализация) созданных с этим файлом. В заголовочный файл добавлены описания (пока еще не везде) и вспомогательный класс для создания плагинов. Все еще находится в стадии отладки, так что комментарии и замечания приветствуются (особенно от разрабов AIMP'а)  :)



Добавлено через 3 мин. 23 сек.

Почему-то не добавился архив с плагами

bescheidener

Как мне запустить таймер при инициализации с этой новой структурой?

Это TimerP=SetTimer(NULL, 0, 500 , (TIMERPROC)Timer); не работает.

miketsoft

Quote from: bescheidener on April 06, 2010, 13:38:32
Как мне запустить таймер при инициализации с этой новой структурой?

Это TimerP=SetTimer(NULL, 0, 500 , (TIMERPROC)Timer); не работает.

Хз, нужно глянуть весь код... А почему бы не использовать компонент VCL TTimer?

bescheidener

Ну что там код... Как написал выше, таймер пытаюсь запустить из Init-функции. А функцию таймера void CALLBACK _export TimerProc(HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime)
размещаю "вне" и "до" класса. Плагин собирается и в списке плеера появляется, но не грузится.

bescheidener

Помогите с GDI+

Как начать, что нужно. Нашел в сети какой-то проектик для примера (аттач). Но он не компилится. Вылезает вот такой ворох ошибок и варнингов (BCB6):

[C++ Warning] Unit1.cpp(22): W8018 Assigning unsigned long to TColor
[C++ Warning] Unit1.cpp(37): W8018 Assigning unsigned long to TColor
[C++ Warning] Unit1.cpp(40): W8018 Assigning unsigned long to TColor
[C++ Error] GdiplusTypes.h(459): E2268 Call to undefined function 'min'
[C++ Error] GdiplusTypes.h(461): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(483): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(484): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(485): E2268 Call to undefined function 'min'
[C++ Error] GdiplusTypes.h(486): E2268 Call to undefined function 'min'
[C++ Error] GdiplusTypes.h(647): E2268 Call to undefined function 'min'
[C++ Error] GdiplusTypes.h(648): E2268 Call to undefined function 'min'
[C++ Error] GdiplusTypes.h(649): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(650): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(671): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(672): E2268 Call to undefined function 'max'
[C++ Error] GdiplusTypes.h(673): E2268 Call to undefined function 'min'
[C++ Error] GdiplusTypes.h(674): E2268 Call to undefined function 'min'
[C++ Warning] GdiplusHeaders.h(582): W8022 'Bitmap::Clone(const Rect &,int)' hides virtual function 'Image::Clone()'
[C++ Warning] GdiplusBrush.h(617): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusBrush.h(656): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusPen.h(316): W8027 Functions containing switch are not expanded inline
[C++ Warning] GdiplusPath.h(124): W8027 Functions containing some if statements are not expanded inline
[C++ Warning] GdiplusPath.h(1204): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusPath.h(1234): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusPath.h(1374): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusPath.h(1416): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusGraphics.h(1410): W8027 Functions containing for are not expanded inline
[C++ Error] GdiplusGraphics.h(34): E2015 Ambiguity between 'Gdiplus::Graphics::Graphics(void *)' and 'Gdiplus::Graphics::Graphics(void *,int)'
[C++ Warning] GdiplusFontCollection.h(70): W8027 Functions containing for are not expanded inline
[C++ Warning] GdiplusFont.h(127): W8027 Functions containing some if statements are not expanded inline
[C++ Error] gdip.cpp(25): E2015 Ambiguity between 'Gdiplus::Graphics::Graphics(void *)' and 'Gdiplus::Graphics::Graphics(void *,int)'