473,657 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RE: Can anyone suggest a better design approach?

You should never WaitForMultiple Objets or WaitForSingleOb ject on a GUI thread
(unless there's a very short timeout).

Creating another thread to perform the blocking (calling WaitFor...) is the
recommended approach.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"vi***@gmail.co m" wrote:
Hi,

I have a forms application which hosts an unmanaged dll. This dll
exposes some simple c style functions which I just call using pinvoke.
But all native functions call WaitForMultiple \singleObject and wait
for a particular event to come. The problem is, this event can fire
only when messages on the windows message queue gets processed. Hence
if I call these blocking functions from native DLL directly from .NET
code they just block the application forever.
The solution I thought is to start a new thread and make this thread
call the dll method. I shall also create an event and pass its handle
into the thread created, so that this newly created thread can wait
for this event to happen. But then I would end up creating thread each
time for every native dll API call(every native DLL APi call does a
waitforsingle\m ultiple objects). This is not good..
Can anybody suggest a better design approach?

Regards,
Vishal.
Jun 27 '08 #1
0 949

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

Similar topics

14
4622
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like eBay, Yahoo and others. This is what she wants my program to be able to do: (try this test at different websites just for fun). At eBay: - enter the word 'television' in a search field ŕ you will get 2155 items.
17
2694
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to ASP.net objects and write the code to make the page work (normally I do this as I go - can't do this...
2
1926
by: msnews.microsoft.com | last post by:
Hello, I have the scenario. I m building an application either in asp.net or window application. This application is base on n-tier application model. Let us take example of Northwind Database in SQL SERVER. i build an asp.net page. On that page i place the grid with one template column. In that column i put HTML Table with two rows. In First row there are one combobox and two textboxes. In the second row there is another DataGrid means...
31
2764
by: Jim Hubbard | last post by:
I am downloading the REALbasic 5.5 demo and was just wondering if anyone else had tried it. I am tired of Microsoft constantly changing things and breaking backward compatibility ON PURPOSE. I'd like to offer my customers the ability to run my apps on Windows, MAC or Linux - and REALbasic claims the ability to do that from one set of source code.
39
3211
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
8
1665
by: rAinDeEr | last post by:
Hi, I have a table with the following 2 Fields - one is the description name and the second is its description to be stored in a table. description name description ------------------------------ ------------------ Terms and Conditions ( to store large amounts of text, Dont know which data type to select) Attachment limit (integer)
1
1378
by: yang__lee | last post by:
Dear Gurus, I have been programming since 4 years and I am not a computer science literate. I am basically a Mechanical engineer. I am working in GIS field I do c++, C and VC++ programming well basically our projects do not involve that much std procedures .. I am not working in CMM level company. But basically programming is complex involving CAD. we design roughly and start working and then there is application testing and...
20
3065
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in like 65% of the time of the second routine. Yet both do the same thing. However, the second one seems better in terms of the way the code is written since it helps encapsulate the transformation in the inner loop better making it easier to read,...
4
2047
by: MyRedz | last post by:
hi i just got into my first class and the prof already ask me to suggest a project for database structure and algorithm design can anyone suggest me some topics that i can make into a project like search engine or poker? i need many suggestions thanks
0
8827
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
8732
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
8504
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
8606
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
6169
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
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
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
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
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.