473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error message getting addresses.

Hi

I keep getting an error:

error C2664: 'GetProcAddress' : cannot convert parameter 1 from 'struct
HINSTANCE__' to 'struct HINSTANCE__ *'
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called

My code is:
HINSTANCE hinstWNASPI32;
hinstWNASPI32=LoadLibrary("WNASPI32");

DWORD (*pfnGetASPI32SupportInfo)( VOID );
DWORD (*pfnSendASPI32Command)( LPSRB );
BOOL (*pfnGetASPI32Buffer)(PASPI32BUFF);
BOOL (*pfnFreeASPI32Buffer)(PASPI32BUFF);
BOOL (*pfnTranslateASPI32Address)(PDWORD,PDWORD);

if( !hinstWNASPI32 )
{
MessageBox ("Not loaded");
}
pfnGetASPI32SupportInfo =GetProcAddress ( hinstWNASPI32,
"GetASPI32SupportInfo" );

Can anyone help me......

Mark
VBGUYINOVERHEAD


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 22 '05 #1
3 2603
Intermouse wrote:
Hi

I keep getting an error:

error C2664: 'GetProcAddress' : cannot convert parameter 1 from 'struct
HINSTANCE__' to 'struct HINSTANCE__ *'
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called

My code is:
HINSTANCE hinstWNASPI32;
hinstWNASPI32=LoadLibrary("WNASPI32");

DWORD (*pfnGetASPI32SupportInfo)( VOID );
DWORD (*pfnSendASPI32Command)( LPSRB );
BOOL (*pfnGetASPI32Buffer)(PASPI32BUFF);
BOOL (*pfnFreeASPI32Buffer)(PASPI32BUFF);
BOOL (*pfnTranslateASPI32Address)(PDWORD,PDWORD);

if( !hinstWNASPI32 )
{
MessageBox ("Not loaded");
}
pfnGetASPI32SupportInfo =GetProcAddress ( hinstWNASPI32,
"GetASPI32SupportInfo" );

Can anyone help me......


LoadLibrary returns HMODULE and not HINSTANCE. GetProcAddress needs
HMODULE as its first argument. Perhaps that's what you need to give
it to keep it happy...

V
Jul 22 '05 #2
Intermouse posted:
Hi

I keep getting an error:

error C2664: 'GetProcAddress' : cannot convert parameter 1 from 'struct HINSTANCE__' to 'struct HINSTANCE__ *'
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called

My code is:
HINSTANCE hinstWNASPI32;
hinstWNASPI32=LoadLibrary("WNASPI32");

DWORD (*pfnGetASPI32SupportInfo)( VOID );
DWORD (*pfnSendASPI32Command)( LPSRB );
BOOL (*pfnGetASPI32Buffer)(PASPI32BUFF);
BOOL (*pfnFreeASPI32Buffer)(PASPI32BUFF);
BOOL (*pfnTranslateASPI32Address)(PDWORD,PDWORD);

if( !hinstWNASPI32 )
{
MessageBox ("Not loaded");
}
pfnGetASPI32SupportInfo =GetProcAddress ( hinstWNASPI32,
"GetASPI32SupportInfo" );

Can anyone help me......

Mark
VBGUYINOVERHEAD

Firstly, Win32 is off-topic, but you're question is still
kind of on-topic because it's to do with the language
itself.

If I'd never used Win32 before, I'd just tell you that that
function wants a pointer to a HINSTANCE, so give it:

pfnGetASPI32SupportInfo = GetProcAddress ( &hinstWNASPI32,
"GetASPI32SupportInfo" );
But... I know the Win32API. LoadLibrary should return a
HMODULE and GetProcAddress should receive a HMODULE. I've
edited your code:
HMODULE hWNASPI32 = LoadLibrary("WNASPI32");

DWORD (*GetASPI32SupportInfo)( VOID );
DWORD (*SendASPI32Command)( LPSRB );
BOOL (*GetASPI32Buffer)(PASPI32BUFF);
BOOL (*FreeASPI32Buffer)(PASPI32BUFF);
BOOL (*TranslateASPI32Address)(PDWORD,PDWORD);

if( !hWNASPI32 )
{
MessageBox("Not loaded");

//Don't forget to quit!
}

GetASPI32SupportInfo = GetProcAddress ( hWNASPI32,
"GetASPI32SupportInfo" );

if ( !hWNASPI32)
{
MessageBox("No such function or error");

//Don't forget to quit!
}
There's no need for the prefixes on the function pointer
names, as they can be used exactly like functions:

GetASPI32SuppportInfo(BLAH);
BTW, are you sure you need to load the dynamically? Why not
use static linkage, as in how you used LoadLibrary.

-JKop
Jul 22 '05 #3
> if ( !hWNASPI32)
{
MessageBox("No such function or error");

//Don't forget to quit!
}
The second one should've been

if (!GetASPI32SupportInfo)
BTW, are you sure you need to load the dynamically? Why not use static linkage, as in how you used LoadLibrary.


TYPO

BTW, are you sure you need to load the library and function
dynamically? Why not use static linkage, as in how you used
LoadLibrary?

-JKop

Jul 22 '05 #4

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

Similar topics

0
by: Craig | last post by:
I keep getting the error "Error: Bad/No Recipient" when submitting a form using formmail.pl Here is the part of the formmail.pl that you are supposed to alter to suit your needs using fake url...
2
by: newbie | last post by:
Hi all , I'm using CDO from my vb component to fire email. The problem is whenever one of the email addresses in to, or cc is wrong then none of the mails are fired even to the correct...
6
by: Charles Crume | last post by:
Hello; My index.htm page (www.charlescrumesoftware.com for those interested in looking) contains 3 frames (left = content, top right = logo, bottom right = navigation). This domain name is...
7
by: Steve Jorgensen | last post by:
Here is some code to generate code for raising and getting information about custom errors in an application. Executing the GenerateXyzErrDefs procedure generates the code. <tblXyzError>...
4
by: Stephen | last post by:
I've got a really annoying problem with a datagrid. I have an application which populates a datagrid on the onclick event of a button. The datagrid is bound to an ArrayList which holds the values. ...
4
by: Sanjay | last post by:
I have written a web service to return information from the database. This works and the data is returned in XML format from the database and displayed on the web page as well when this web service...
4
by: =?Utf-8?B?TWlrZSBI?= | last post by:
I'm using a block of ASP to allow a user to send a form via e-mail. However, someone keeps sending me spam through this form and they're using a bogus return address. I'm testing for a successful...
0
by: Larry D | last post by:
I have a client with a site that users can register at, we collect their emails, if they have one, in an Access db. I have a page that uses CDOSYS to send messages to those emails but I am getting...
1
by: bhavanirayala | last post by:
Hi, I am sending the values from one method to another method to get the values from xml file based on the inputs. I am getting the error like:: Variable "$collType" will not stay shared...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...

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.