Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2006

Tip: Looking for answers? Try searching our database.

Callbacks and Managed Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Spyder - 11 Jul 2006 22:50 GMT
I am trying to wrap a very old dll from Epson with a Managed Dll.
Their declaration for the callback is this:

typedef int (WINAPI* DLL_BiSetStatusBackFunction)(int, int (CALLBACK EXPORT
*pStatusCB)(DWORD dwStatus));

but when I compile it, I get the following errors:

Error    1    error C2143: syntax error : missing ')' before
'*'    c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h    48   
Error    2    error C2143: syntax error : missing ',' before
'*'    c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h    48   
Warning    3    warning C4229: anachronism used : modifiers on data are
ignored    c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h    48   
Error    4    error C2059: syntax error :
')'    c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h    48   
Error    5    error C2091: function returns
function    c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h    48   

Obviously, the syntax has changed.
All of the non-callback functions are declared as follows:

typedef int (WINAPI* DLL_BiOpenMonPrinter)(int, LPSTR);
typedef int (WINAPI* DLL_BiSetMonInterval)(int, WORD, WORD);

These work fine when I use LoadLibrary and GetProcAddress.
Does anyone know the proper syntax for the callback?

Steve
Microsoft Certified Partner
DrZogg - 11 Jul 2006 23:15 GMT
Why would you want to use a callback?.. are you callingback into
unmanaged code?

Try using Delegates for managed callbacks

Christopher
Spyder - 12 Jul 2006 00:50 GMT
Epson's Dll has a callback function that will notify my managed dll of a
status change to the printer.  My previous post stated the declaration for
the callback from their dll.  That is what is giving me the error.
I want to get the callback into my dll and then send notifications to the
application that is using my managed dll.

Signature

Steve
Microsoft Certified Partner

> Why would you want to use a callback?.. are you callingback into
> unmanaged code?
>
> Try using Delegates for managed callbacks
>
> Christopher

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.