By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,189 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,189 IT Pros & Developers. It's quick & easy.

public function name() as Boolean ... boolean help needed

P: 4

I am working on a windows dll and this is my problem:
Expand|Select|Wrap|Line Numbers
  1. 'api
  2. Public Declare Function myFunction Lib "Functionmine.dll" (byval ProgieName as String) as Boolean
Expand|Select|Wrap|Line Numbers
  1. 'entry point in module
  2. Public Function myFunction(byval ProgieName as string) as Boolean
  3. 'some code here and then:
  4. Load Form1 'a form inside the dll, load form - same thing in this case
  5. End Function
My problem is that i want the boolean value from the function to be filled by the events of the form, and not the events of this function. I have tried adding myFunction = true, and = false etc etc and i have left it blank as i have here.
I have even tried to declare a global boolean and fill the function that way but its just not working.
Should i run it through a timer or something like that? or is it jus not possible, although i'm 100% sure it is possible.

any help would be so good

btw when form1 loads it sends a winsock connection, the connect sends the data, and the data goes to the data arrival. This is where i want to set the boolean value for the myFunction api call.
Apr 26 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 8,434
Let's deal with one thing at a time. Are you saying that even if your function just says MyFunction = True the true result is not returned? If so, let's forget about the form until we work out why your function isn't communicating properly with the caller. Nothing you do with your form will achieve much if your caller can't get your return value anyway.

If the function OK and the problem is in getting the value back to it from the form, try using Form1.Show vbModal. This will show the form "modally", so control won't return until it is unloaded or hidden. So, once your form is finished what it's doing, you can just hide it, and control should continue here after the Show method.

Another method to achieve much the same effect is to show the form, then go into a loop (making sure you have a DoEvents statement inside the loop!) until something (such as the form's Visible property) tells you it has been hidden.

You may want to use a slightly different method if you only want to load the form, and not show it. Keep in mind, you could make the form look like a simple "please wait..." indicator or something.

I'll leave it as "an exercise for the reader" as to how you get your boolean value from the form back to the function.

Let us know whether this is any help.
Apr 26 '07 #2

Post your reply

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