473,811 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing a function from DLL

AS
Hi ,

I have exported the following function from a dll ,

extern "C" DECL_MYEXPORTS LRESULT CALLBACK MouseProc(int nCode,WPARAM
wParam,LPARAM lParam);

//in my calling code , I tried to access the function as below:

static HINSTANCE hinstDLL;

typedef LRESULT (CALLBACK *MOUSEPROC)(int nCode,WPARAM wParam,LPARAM
lParam); // typedef a function pointer to access the function

hinstDLL = LoadLibrary(_T( "F:\\inter\\MyF irstDll\\debug\ \MyFirstDll.dll "));
//hInstDLL is valid

MOUSEPROC hproc = (MOUSEPROC)GetP rocAddress(hins tDLL,"MouseProc "); // hProc
is still NULL

Question: I'm not able to access the function thru GetProcAddress. Is the
typedef "typedef LRESULT (CALLBACK *MOUSEPROC)(int nCode,WPARAM
wParam,LPARAM lParam); " is corect or what is goin wrong here ?

Thanks

Sudhakar
Mar 7 '08 #1
2 1763
Tom
On 7 Mrz., 11:54, "AS" <A...@mic.comwr ote:
MOUSEPROC hproc = (MOUSEPROC)GetP rocAddress(hins tDLL,"MouseProc "); *//hProc
is still NULL
Sudhakar

try the "Depency Walker" to check the DLL and see if the function is
exported under the right name. Sometimes the names are "decorated" by
the linker.

Thomas
------------------
Synchronize your Outlook: http://www.easy2sync.com/de/produkte/e2s4o.php

Mar 7 '08 #2
AS
The function name is decorated, if I use the CALLBACK in the function
declaration ,

BUt tell me , how to get rid of this. THe function must have the prototype
" LRESULT CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam);" in
the dll and it is exported with extern "C" But still it is decorated like
_MouseProc@12. Then, How can we use the exported function thru
GetProcAddress in the client application
with
"Tom" <ne***********@ itsth.dewrote in message
news:14******** *************** ***********@m36 g2000hse.google groups.com...
On 7 Mrz., 11:54, "AS" <A...@mic.comwr ote:
MOUSEPROC hproc = (MOUSEPROC)GetP rocAddress(hins tDLL,"MouseProc "); //
hProc
is still NULL
Sudhakar

try the "Depency Walker" to check the DLL and see if the function is
exported under the right name. Sometimes the names are "decorated" by
the linker.

Thomas
------------------
Synchronize your Outlook: http://www.easy2sync.com/de/produkte/e2s4o.php
Mar 10 '08 #3

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

Similar topics

2
2315
by: Steven T. Hatton | last post by:
I find the surprising. If I derive Rectangle from Point, I can access the members of Point inherited by Rectangle _IF_ they are actually members of a Rectangle. If I have a member of type Point in Rectangle, the compiler tells me Point::x is protected. I would have expected Rectangle to see the protected members of any Point. Compiling the following code give me this error: g++ -o rectangle main.cc main.cc: In member function `size_t...
6
2749
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is called "form1", and I have selects called "PORTA", "PORTB" ... etc...
5
2469
by: Mike Oliszewski | last post by:
Given the following c# code: namespace Company2 { public class SomeFunctions { public void FunctionA() { // Do Something. }
0
1579
by: N. Demos | last post by:
Hello, I'm having problems accessing a complex XML child node (latitude & longitude), and passing it to a function when the XML file has been read into a DataSet. Specifically, the returned object from accessing the 'latitude' and 'longitude' nodes is not a DataTable (as specified in the MSDN). I'm not sure what type is being returned, nor how to go about finding out. Any pointers would be appreciated. Below is the relevent Error message,...
3
5009
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
3
7848
by: Frederick Gotham | last post by:
Back in the day, if you wanted a function to be self-contained within a translation unit, you defined the function as "static". If there were an external linkage function by the same name residing in a different translation unit, then the current translation unit was simply oblivious to it and had no way of accessing it. Any time the function name was mentioned in the current translation unit, it referred to the "static" one which...
2
4528
by: Vincent | last post by:
I have been trying to find some API routines that will allow me to determine the name of the computer that is accessing a file on a server. I have found the NetFileEnum call (returns the names of the files in use and the names of the users accessing them). I have also found the NetConnectionEnum call (returns the name of the computer that is accessing a share). I do not see any way of correlating the data that these two api calls...
0
1658
by: aakash | last post by:
Hello Guys I am upsizing ms access project to give it a ms sql connectivity I am having problem in accessing form control values in ms sql function CREATE FUNCTION "ReportList DateRange"() RETURNS TABLE AS Begin RETURN
3
10525
by: judy.j.miller | last post by:
Does anyone know why i can't access a form element value using dot notation in firefox, when i'm in a function. Works ok in the body. I'm trying to do this: var FarTemp = faren.temp.value; I can get at the value using the array method, the getelements by id method, and the bracket-with-the-element-name in it method. But the dot notation doesn't work, in firefox, in the function (which i have in the head).
3
1578
by: Nathan Sokalski | last post by:
I have a validator that I wrote by inheriting from BaseValidator. At certain points in the code, I need to access other controls on the page containing the validator. I have the IDs of these controls, so I use the following statement to access them: Me.Page.FindControl(ControlID) However, this is returning Nothing, even though the control can be accessed in the Load event of the Page containing the control and the validator. I also...
0
9730
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7671
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.