Solved

How to keep dll loaded?

Posted on 2002-05-21
17
473 Views
Last Modified: 2010-05-18
hi experts,
I'm using VC++ 6.0 to write a dll as wrapper class to allow my java program to interact with crystal report. I managed to preview the report but the preview screen just dispapear once the dll is unloaded, at the moment i need to display a modal dialog box in order the make the preview screen alive. So my question is, how can i keep the dll loaded or in other word, make the preview screen displayed until i hit the close button..

cheers..
0
Comment
Question by:pleasure
  • 5
  • 5
  • 3
  • +4
17 Comments
 
LVL 4

Expert Comment

by:Chase707
ID: 7026205
The DLL should stay loaded until all process have stopped using it.  I'm not familiar with using COM in java, but the DLL normally will be unloaded automatically by windows after the last referencing process has called Release.   So somehow you are Releasing your reference to the DLL in Java before you are done using it.

Chase707
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7026352
The answer is to not unload the DLL until you are finished with it.

Why are you unloading it now?

An alternative might be to take a 'snapshot' of the report as a BMP.  That would make sense if it is a graphic like a pie chart or something.

-- Dan
0
 
LVL 1

Accepted Solution

by:
thegroup earned 50 total points
ID: 7026949
Don't use automatic loading, use LoadLibrary instead before the first use of the DLL.
Once you call LoadLibrary (it gives you a handle) you have full control over Dll unloading (you must call FreeLibrary)

This procedure garantees you have full control over the DLL load and unload.

Hope this helps.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7027728
hi thegroup,
Welcome to EE!  The experts in this section have agreed to post Comments rather than Answers.  This prevents the question from getting 'locked' which makes it more likely that the Asker will recieve exactly the kind of help needed.  In this case, there is still a lot that needs to be explained about the question before anyone has any right to post an Answer.  So, in the future, please post Comments like everybody else.  Thanks!
-- Dan
0
 
LVL 22

Expert Comment

by:nietod
ID: 7053540
>> The experts in this section have agreed to post Comments rather than Answers.
Actually only some experts have.  

You are welcome to post an answer if your answer does answer the question and no one else has posted a previous answer in a comment.  (i.e. don't post an answer as an answer if other experts have already answered the question in comments.)

In this case the question is so unclear that its not clear that your answer really does answer the question and it largely duplicates answers previously posted by other experts, so it probably should have been a comment.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7054744
>>Actually only some experts have
Check the Locked Q's section of the C++ TA list and notice that *none* of the top experts are locking questions these days.  The only recent ones in there are this and another obvious newbie mistake.

>>so it probably should have been a comment.
At some point 'probably should be a comment' crosses the line into 'very definitely, without a doubt, hand-to-bible, really, really, really *must* be a comment' territory.  The thing is, the realm on the one side of that line is a couple of square microns while the other side is a few parsecs.

-- Dan
0
 
LVL 22

Expert Comment

by:nietod
ID: 7054753
>> notice that *none* of the top experts are locking
>> questions these days.
Tnen that is what you should say.  What yous said was that all experts in the area have agreed not to answer questions.  That is not true.

And I assure you that not all the top experts agree.  This one doesn't!

>> At some point 'probably should be a comment' crosses
>> the line into 'very definitely, without a doubt,
I don't have the authority to tell someone that their post has to be a comment.  I can only make a suggestion.  They have to decide.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7054858
nietod,
>>All
Your word, not mine ...
>>This one doesn't
Ah, the exception that proves the rule!

There is a discusion going on the Expert Input section that you might want to join.  These things have been hashed and rehashed, but there is some actual possibility that coding changes are about to take place.  The concensus is that Answer Locking is bad and needs to be restricted or conceptually modified.  I'm sure you will want to air your opinion:

    http:Q.20304200.html

-- Dan
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 22

Expert Comment

by:nietod
ID: 7055022
>> The experts in this section
"the experts"  That means all the experts.  

If I say would say "the comments from Dan are wrong"  does that botter you?  Certainly some comments are wrong, but that implies that all of them are wrong.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7055113
My phrasing was precise, in order leave some intentional ambiguity.  If I say "Seattle weather is rainy" there's room to interpret it as "always rainy" or "often rainy" or "usually rainy."   If the reader imagines rainfall 24/7/356, then it's his problem, not mine.

Anyway, if you said that, I'd assume you were referring to thread-local or recent comments.  If you add 'all' I'd broaden the scope, but even then I'd sensibly limit it to only comments posted here at EE.

-- Dan
0
 
LVL 22

Expert Comment

by:nietod
ID: 7055212
"rainy" doesn't mean it rains all the time.  It specifically means it rains often.  

However "The experts in this section have agreed "  can't possibly be interpretted to mean "some" of the experts.  It says "the experts".   It means that if one is an expert in this section they have agreed to this.  Not all have.

0
 
LVL 30

Expert Comment

by:Axter
ID: 7147451
>>It says "the experts".   It means that if one is an
>>expert in this section they have agreed to this.  Not
>>all have.

If I say the people voted George Bush in office, it doesn't mean all the voters.  It's implied to mean that the majority voted George Bush in office.  More over, in actuallity, not even the majority voted George Bush in office, but that's another topic.. :-) :-)

The point is, that the word "ALL" exist for a purpose.  It service to give a more defined meaning to communication.
With out it, the sentance is ambiguous, and can be interpret to mean ALL, MOST, or SOME.
0
 
LVL 30

Expert Comment

by:Axter
ID: 7147454
Hi pleasure,
I think you forgot this question.
Can you please remove it from the LOCK Question list by either awarding the points to deserving expert, or rejecting the posted answer.

Thank you
0
 
LVL 22

Expert Comment

by:nietod
ID: 7147463
"people voted for bush" means that some peeople did.    "the people voted for bush" means that they all did.   "The people" means ALL the people.  
0
 
LVL 30

Expert Comment

by:Axter
ID: 7147501
>>"the people voted for bush" means that they all >>did.   "The people" means ALL the people.  
That's not true.  That's a very common expression, which I hear all the time.  Surely you don't think when someone saids that, that they actually mean ALL the people.
If you do believe that, then you're one of the few that does.
Most people know that "MOST" is implied in such a statement.

Just as if I said "The stars are bright."
That doesn't mean that all stars in the galaxcy are bright.

If you believe "THE" in front of a noun is the same as "ALL", then you're in the minority.
Most people know that "The Stars" and "All the Stars" are not the same.
Otherwise, there would be no purpose for the word "ALL"
0
 
LVL 11

Expert Comment

by:griessh
ID: 7178883
Dear pleasure

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "DanRollins"

comment(s) as an answer since you never gave more feedback.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/


PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 

Author Comment

by:pleasure
ID: 7275784
i had give up using this method..anyway..thanks all for the advice u all given..thanks..
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now