Home » Community » Newbie corner » How to link to multiple DLLs
|
Re: How to link to multiple DLLs [message #43511 is a reply to message #43510] |
Thu, 14 August 2014 08:51 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
![](https://www.ultimatepp.org/forums/images/custom_avatars/648.jpg) |
koldo
Messages: 3372 Registered: August 2008
|
Senior Veteran |
|
|
Hello Jerson
There is no problem to call many DLLs from a single program.
In case of Functions4U you can have as many Dl classes as you want. Every Dl class represents a DLL through Dl::Load(fileDll). With Dl::GetFunction(functionName) you get a pointer to the functions you will use.
Anyway user32 functions can be called directly. I mean, for example, you can include this in your C++ code:
::SendMessage(hwnd, WM_SYSCOMMAND, 0xf008, MAKELONG(p.x, p.y));
::SetWindowPos(hdlg, NULL, p.x, p.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
::DestroyWindow(hwnd);
Best regards
Iñaki
|
|
|
Re: How to link to multiple DLLs [message #43512 is a reply to message #43511] |
Thu, 14 August 2014 13:46 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
jerson
Messages: 202 Registered: June 2010 Location: Bombay, India
|
Experienced Member |
![embedded.design%40yahoo.com](theme/default/images/yahoo.png)
|
|
Hello Koldo
Thanks for your valuable input
Am I doing this DLI declaration right?
FN(WORD, capCreateCaptureWindowA, (String WindowName, int32 Style,int32 x, int32 y, int32 Width, int32 Height, int32 hParent, int32 ID));
/*
* '--The capCreateCaptureWindow function creates a capture window--
* Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
* (ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
* ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
* ByVal nHeight As Short, ByVal hWnd As Integer, _
* ByVal nID As Integer) As Integer
*
I keep getting this error with the pointer under capCreateCaptureWindowA
c:/..../avicap32.dli:1:10: error: expected ')' before 'capCreateCaptureWindowA_type'
FN(WORD, capCreateCaptureWindowA, (char *WindowName, long Style,long x, long y, long Width, long Height, long hParent, long ID));
^
C:\upp\uppsrc/Core/dli.h:42:23: note: in definition of macro 'FN_CN'
typedef retval (call fn##_type) args; fn##_type *fn;
I have not used a header file and have put the following lines into my main.c
#define DLLFILENAME "avicap32.dll"
#define DLIMODULE avicap32
#define DLIHEADER <LM/avicap32.dli>
#define DLLCALL LNPUBLIC
#include <Core/dli.h>
What am I doing wrong?
PS:
I think I figured it out somewhat. this is what compiled for me. However, I will still appreciate some insight into why this works. Why does FN_C work and not FN?
void MyAppWindow::CapStart(void)
{
HWND hwnd;
hwnd = avicap32().capCreateCaptureWindowA("WebCam", WS_VISIBLE | WS_CHILD,0,0,640,480,picCapture.GetHWND(), 0);
}
In DLI file
FN_C(HWND, WINAPI, capCreateCaptureWindowA,
(const char *WindowName, UINT Style,UINT x, UINT y, UINT Width, UINT Height, HANDLE hParent, UINT ID))
[Updated on: Thu, 14 August 2014 14:45] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Mon Jun 17 04:22:02 CEST 2024
Total time taken to generate the page: 0.02454 seconds
|