473,671 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Callback function from unmanaged dll to vb.net-- display problems

1 New Member
I am using a 3rd party dll (not COM). One of the dll functions requires a callback function. I have used either DllImport or Declare to properly (I think) declare the function. The function requires a pointer to a function for the call back, and a pointer to a data duffer. I am using a delegate to define the callback function.

The callback is triggered correctly and I am able to print the result of the callback to Debug.Write. I can verify that the data has been transferred into the callback function. However, I can't update a textbox or label from within the callback function. The text is indeed being updated, as I can get the text property from the control and it has been updated. However the display won't update.
I have tried setting the textbox's text property or using appendtext. I have also tried more direct methods using a couple win32 calls to UpdateWindow or forcing an Invalidate event. Neither of those approaches work either. I even tried to set the textbox text directly with SetWindowText() but that did not work either.

The calls to the callback function fire a few times a second. This is in vb.net 2005

I am at a loss as to how to get this to work. Any advice appreciated.
Thanks
Oct 15 '07 #1
1 1715
debasisdas
8,127 Recognized Expert Expert
Question moved to .NET Forum.
Nov 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1516
by: PengYu.UT | last post by:
Hi, Would you tell me what callback function is used? Why we need it? I searched the web. But most webpages only mention that how to use it but not why to use it. Best wishes, Peng
3
6324
by: ThinkRS232 | last post by:
I have a Win32 DLL that has a standard _stdcall (WINAPI) exports. I am able to call these fine from C#. One call in particular however has a callback to a CDECL function. How would I set that up? Following is the specific. Win32 DLL Declaration for function in MyDLL.dll extern "C" int WINAPI SpecialTimerFunction(int Val, int (*Callback)(int InVal)) C# Declaration public class MyClass
3
2040
by: Jim | last post by:
I have a windows application that is accessing unmanaged code and providing a callback function that will create events at unknown time spans. When the EventHandler (callback function) fires it causes my program to crash or freeze, or do strange stuff. When I remove this callback function it works great. Problem is I need this callback function to implement my state machine for the program so I think I need to encapsulate this callback...
2
1716
by: Niks | last post by:
Hi, I have just now installed VS.NET on my system and created basic .aspx files using <asp:label id="Message1" font-size="16" font-bold="true" forecolor="red" runat=server>Test</asp:label> tags to test the pages. When I save and run the pages, I am able to see the text but not the font or color which i have specified in ASP.Label. If I view source the page I see the tags correctly.
8
572
by: kurtcobain1978 | last post by:
-------------------------------------------------------------------------------- I need to do the exactly same thing in VB.NET. Load a unmanaged C DLL dynamically and then call a function in which I pass the callback function as an argument. My C function being called callback as type _cdecl. Does anybody have any ideas?
2
1871
by: Marcus Kwok | last post by:
I have processing code (I'll call it the "model") written in native unmanaged pure C++, and I have put a GUI on top of it written using Windows Forms (.NET 1.1). The GUI is used to set the parameters for the model, and once all parameters are set and checked to be valid, I run the model. The model takes a long time to run, so I decided to run it in a background thread, and have it notify the GUI when it is complete. The GUI will then...
6
14065
by: Bart Burkhardt | last post by:
Hi, I could use some help in setting a C# callback function that an external unmanaged dll will call on a event. Using a delegate and use the external callback set function doesn't work. The carbage collector says hello here (-; I have pasted some code below, any help is greatly appreciated! //Bart
1
4943
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: http://munich.schwarz-interactive.de/autocomplete.aspx
0
1267
by: Michibeck | last post by:
Hi, I need some help regarding callback function written in c# and called from unmanaged c code. (c dll). The problem is that the callback function crashs after the first call with a memory access exception. I tried to protect the callback function to be handle by the GC but it doesn't work. What could I do to fix that problem?? Thanks, Michibeck C Code: /*********************************************************************** **
0
8471
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
8388
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
8817
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...
1
8593
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8663
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...
0
7423
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
2804
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 we have to send another system
2
2046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1799
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.