Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How to link to multiple DLLs
How to link to multiple DLLs [message #43510] Thu, 14 August 2014 07:06 Go to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Greetings

I have a bit of VB6 code which I need to integrate into my U++ application.

I have checked the DLI files commands and Functions4u.Dl, but cannot seem to figure out how to link multiple DLLs using these. The DLLs belong to Windows OS and are the avicap32.dll and user32.dll files

Can someone please help me understand how to convert the attached snippet of code?

Regards
Jerson
Re: How to link to multiple DLLs [message #43511 is a reply to message #43510] Thu, 14 August 2014 08:51 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
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 messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

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

Re: How to link to multiple DLLs [message #43523 is a reply to message #43512] Mon, 18 August 2014 08:46 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Sorry Jerson. I cannot answer you because I am not a DLI expert.

Best regards
Iñaki
Re: How to link to multiple DLLs [message #43524 is a reply to message #43523] Mon, 18 August 2014 09:21 Go to previous message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Hi Koldo

No problem. I have progressed quite a bit since my last posting and now I am able to get the webcam to work using VFW. I am grateful for your tips about SendMessage - that helped a bit. Lot of patience and google makes a happy man.

It will be really helpful if someone more knowledgable can shed some light on how to link multiple DLLs. Right now it is more of an academic exercise for me since my immediate problem is resolved.

Best regards
Jerson
Previous Topic: problem with package locations
Next Topic: From XSD to XML
Goto Forum:
  


Current Time: Thu Mar 28 18:34:23 CET 2024

Total time taken to generate the page: 0.01640 seconds