mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-30 02:50:05 +00:00
Tidied up some win32 DLL loading code, and fixed a call type mismatch with the windows media format class.
This commit is contained in:
parent
a2845d8895
commit
584c444ffd
5 changed files with 17 additions and 17 deletions
|
|
@ -829,8 +829,8 @@ public:
|
|||
void setMMThreadPriority()
|
||||
{
|
||||
DynamicLibrary dll ("avrt.dll");
|
||||
JUCE_DLL_FUNCTION (AvSetMmThreadCharacteristicsW, avSetMmThreadCharacteristics, HANDLE, dll, (LPCWSTR, LPDWORD))
|
||||
JUCE_DLL_FUNCTION (AvSetMmThreadPriority, avSetMmThreadPriority, HANDLE, dll, (HANDLE, AVRT_PRIORITY))
|
||||
JUCE_LOAD_WINAPI_FUNCTION (dll, AvSetMmThreadCharacteristicsW, avSetMmThreadCharacteristics, HANDLE, (LPCWSTR, LPDWORD))
|
||||
JUCE_LOAD_WINAPI_FUNCTION (dll, AvSetMmThreadPriority, avSetMmThreadPriority, HANDLE, (HANDLE, AVRT_PRIORITY))
|
||||
|
||||
if (avSetMmThreadCharacteristics != 0 && avSetMmThreadPriority != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,9 +134,8 @@ public:
|
|||
currentPosition (0),
|
||||
bufferStart (0), bufferEnd (0)
|
||||
{
|
||||
typedef HRESULT (*WMCreateSyncReaderType) (IUnknown*, DWORD, IWMSyncReader**);
|
||||
WMCreateSyncReaderType wmCreateSyncReader = nullptr;
|
||||
wmCreateSyncReader = (WMCreateSyncReaderType) wmvCoreLib.getFunction ("WMCreateSyncReader");
|
||||
JUCE_LOAD_WINAPI_FUNCTION (wmvCoreLib, WMCreateSyncReader, wmCreateSyncReader,
|
||||
HRESULT, (IUnknown*, DWORD, IWMSyncReader**))
|
||||
|
||||
if (wmCreateSyncReader != nullptr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -142,17 +142,17 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* Used with DynamicLibrary to simplify importing functions
|
||||
/* Used with DynamicLibrary to simplify importing functions from a win32 DLL.
|
||||
|
||||
dll: the DynamicLibrary object
|
||||
functionName: function to import
|
||||
localFunctionName: name you want to use to actually call it (must be different)
|
||||
returnType: the return type
|
||||
object: the DynamicLibrary to use
|
||||
params: list of params (bracketed)
|
||||
*/
|
||||
#define JUCE_DLL_FUNCTION(functionName, localFunctionName, returnType, object, params) \
|
||||
#define JUCE_LOAD_WINAPI_FUNCTION(dll, functionName, localFunctionName, returnType, params) \
|
||||
typedef returnType (WINAPI *type##localFunctionName) params; \
|
||||
type##localFunctionName localFunctionName = (type##localFunctionName)object.getFunction (#functionName);
|
||||
type##localFunctionName localFunctionName = (type##localFunctionName) dll.getFunction (#functionName);
|
||||
|
||||
//==============================================================================
|
||||
#elif JUCE_LINUX
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ namespace MACAddressHelpers
|
|||
void getViaGetAdaptersInfo (Array<MACAddress>& result)
|
||||
{
|
||||
DynamicLibrary dll ("iphlpapi.dll");
|
||||
JUCE_DLL_FUNCTION (GetAdaptersInfo, getAdaptersInfo, DWORD, dll, (PIP_ADAPTER_INFO, PULONG))
|
||||
JUCE_LOAD_WINAPI_FUNCTION (dll, GetAdaptersInfo, getAdaptersInfo, DWORD, (PIP_ADAPTER_INFO, PULONG))
|
||||
|
||||
if (getAdaptersInfo != nullptr)
|
||||
{
|
||||
|
|
@ -392,7 +392,7 @@ namespace MACAddressHelpers
|
|||
void getViaNetBios (Array<MACAddress>& result)
|
||||
{
|
||||
DynamicLibrary dll ("netapi32.dll");
|
||||
JUCE_DLL_FUNCTION (Netbios, NetbiosCall, UCHAR, dll, (PNCB))
|
||||
JUCE_LOAD_WINAPI_FUNCTION (dll, Netbios, NetbiosCall, UCHAR, (PNCB))
|
||||
|
||||
if (NetbiosCall != 0)
|
||||
{
|
||||
|
|
@ -449,10 +449,9 @@ bool Process::openEmailWithAttachments (const String& targetEmailAddress,
|
|||
const String& bodyText,
|
||||
const StringArray& filesToAttach)
|
||||
{
|
||||
typedef ULONG (WINAPI *MAPISendMailType) (LHANDLE, ULONG, lpMapiMessage, ::FLAGS, ULONG);
|
||||
|
||||
DynamicLibrary mapiLib ("MAPI32.dll");
|
||||
MAPISendMailType mapiSendMail = (MAPISendMailType) mapiLib.getFunction ("MAPISendMail");
|
||||
DynamicLibrary dll ("MAPI32.dll");
|
||||
JUCE_LOAD_WINAPI_FUNCTION (dll, MAPISendMail, mapiSendMail,
|
||||
ULONG, (LHANDLE, ULONG, lpMapiMessage, ::FLAGS, ULONG))
|
||||
|
||||
if (mapiSendMail == nullptr)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ public:
|
|||
{
|
||||
if (direct2dDll.open ("d2d1.dll"))
|
||||
{
|
||||
JUCE_DLL_FUNCTION (D2D1CreateFactory, d2d1CreateFactory, HRESULT, direct2dDll, (D2D1_FACTORY_TYPE, REFIID, D2D1_FACTORY_OPTIONS*, void**))
|
||||
JUCE_LOAD_WINAPI_FUNCTION (direct2dDll, D2D1CreateFactory, d2d1CreateFactory,
|
||||
HRESULT, (D2D1_FACTORY_TYPE, REFIID, D2D1_FACTORY_OPTIONS*, void**))
|
||||
|
||||
if (d2d1CreateFactory != nullptr)
|
||||
{
|
||||
|
|
@ -86,7 +87,8 @@ public:
|
|||
|
||||
if (directWriteDll.open ("DWrite.dll"))
|
||||
{
|
||||
JUCE_DLL_FUNCTION (DWriteCreateFactory, dWriteCreateFactory, HRESULT, directWriteDll, (DWRITE_FACTORY_TYPE, REFIID, IUnknown**))
|
||||
JUCE_LOAD_WINAPI_FUNCTION (directWriteDll, DWriteCreateFactory, dWriteCreateFactory,
|
||||
HRESULT, (DWRITE_FACTORY_TYPE, REFIID, IUnknown**))
|
||||
|
||||
if (dWriteCreateFactory != nullptr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue