473,503 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with a DLL, please

Hi, I have a problem with a DLL I'm not able to solve.

I need to use this DLL to receive a file from a barcode (a little
terminal) reader.

The DLL only has 2 functions, one for receive and the other to transnit
a file.
The prototype function one the readme file are:

INT __stdcall B30XferRx(LPTSTR CommandStr)
INT __stdcall B30XferTx(LPTSTR CommandStr);

where CommandStr is a string of the kind "p=4,F=filename"

I tried in this way:
void main() {

HINSTANCE hLib=LoadLibrary("B31win32.DLL");
if(hLib==NULL) {

cout << "Unable to load library!" << endl;
getch();
return;
}

INT __stdcall B30XferRx(LPTSTR "p=4,F=mydata.txt");
}

I receive this error massage (my file is pDll.cpp):

C:\Borland\BCC55\Bin>bcc32 pDll.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
pDll.cpp:
Error E2108 pDll.cpp 21: Improper use of typedef 'LPTSTR' in function
main()
Error E2293 pDll.cpp 21: ) expected in function main()
Warning W8004 pDll.cpp 22: 'B30XferRx' is assigned a value that is
never used in
function main()
*** 2 errors in Compile ***

any idea?
Thank you very much

Sandra

Nov 24 '05 #1
3 1773
On 24 Nov 2005 00:28:23 -0800, al****************@virgilio.it wrote:
Hi, I have a problem with a DLL I'm not able to solve.

I need to use this DLL to receive a file from a barcode (a little
terminal) reader.

The DLL only has 2 functions, one for receive and the other to transnit
a file.
The prototype function one the readme file are:

INT __stdcall B30XferRx(LPTSTR CommandStr)
INT __stdcall B30XferTx(LPTSTR CommandStr);

where CommandStr is a string of the kind "p=4,F=filename"

I tried in this way:
void main() {

HINSTANCE hLib=LoadLibrary("B31win32.DLL");
if(hLib==NULL) {

cout << "Unable to load library!" << endl;
getch();
return;
}

INT __stdcall B30XferRx(LPTSTR "p=4,F=mydata.txt");


You are declaring a local variable of type INT __stdcall and name
B30XferRX, and with a wrong parameter list.

What you meant was only:
B30XferRx("p=4,F=mydata.txt");

Please, check some basic C++ text, or this list FAQ.

Best regards,

-- Zara
Nov 24 '05 #2
Ed
Hi. Once you have a valid handle via LoadLibrary you will need to call
GetProcAddress for each function you wish to call. You can create a
couple typedefs like so to accomplish what you were trying to do. Ed

typedef int (*B30XferRx)(LPTSTR CommandStr);
typedef int (*B30XferTx)(LPTSTR CommandStr);

int main(int, char**) {
HMODULE hModule = ::LoadLibrary("B31win32.DLL");
if (hModule != NULL) {
B30XferRx func1 =
reinterpret_cast<B30XferRx>(::GetProcAddress(hModu le, "B30XferRx"));
if (func1 != NULL)
func1("some param data");

B30XferTx func2 =
reinterpret_cast<B30XferTx>(::GetProcAddress(hModu le, "B30XferTx"));
if (func2 != NULL)
func2("some param data");

FreeLibrary(hModule);
}
return 0;
}

Nov 24 '05 #3
al****************@virgilio.it wrote:
[redacted]


This discussion is off topic here. Please take it to a Windows
programming newsgroup.

Thank you.
Nov 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3255
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
1
1909
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
0
1679
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
12
2095
by: Christo | last post by:
borland c++ 5.01 character constant must be one or two characters long get this when compiling my first c++ program can anyone out there help? it is highlighting this line as the problem ...
7
3570
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
2961
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
17
2011
by: JT | last post by:
Help me the following C++ question: Write a program to help a local bookshop automate its billing system. The program should do the following: (a)Let the user enter the ISBN, the system will...
7
3249
by: tyler_durden | last post by:
thanks a lot for all your help..I'm really appreciated... with all the help I've been getting in forums I've been able to continue my program and it's almost done, but I'm having a big problem that...
23
3232
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
2
1526
by: =?Utf-8?B?U2NvdHRSYWREZXY=?= | last post by:
I'm creating a doc project for my c# program. I've done this before but this time sonething is wrong. I build my doc project and is succeeds but when I open the help file, there is no documentation...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.