|
-
Apr 3rd, 2002, 12:51 AM
#1
Thread Starter
Member
Forking / New Process in VB .dll ??? Please help :(
Hello Guru's.
I've got some .dll i use for my ASP site. It's all working perfectly, etc etc etc etc.
Now, there's a bit of code in there that emails someone, something. It's a 3rd party product, which we -have- to use. Please, just try me on this.
Now, i was hoping to have my code FORK OFF a new Process, which does the 3rd party email, etc....
Is there any chance i could have this happen? This way, in -MY- code, when i hit the email bit, i fork off the email (which can happen as slow as it wants to), but my code keeps on working normally, not waiting OR CARING about the process at all. If the forked off process fails, or something bad goes wrong .. i don't care. i'll do some other handling in there.
Please tell me this can be done. I'm using Visual Basic to make the .dll also.
Thank you kindly to any help forthcoming.
-Pure Krome-
-
Apr 3rd, 2002, 10:05 AM
#2
If you really want to fork, just call _exec() in VC++ or
call the CreateProcess api from Visual Basic.
You can also get a return status, just like unix.
Download the www.allapi.net api guide (free) - it has good examples of CreateProcess.
-
Apr 4th, 2002, 02:35 AM
#3
Thread Starter
Member
Hi Guys ....
hmm .. interesting..
<spends all day trying some things, including reading those two links>
Ok .. lets see .. the basic gist of those helpful links, etc basically say i need to make an ActiveX EXE, and then asyncy process that.
Sweet.
<makes the activex exe>
<tests the activex exe>
Perfect. Ok. I've done the ActiveX exe, but it's not being called ASYNCRONOUSLY.
I've read the msdn, and also the API downloaded file. I like the downloaded API file example the best, but it still doesn't help with my problem.
This is the code i have on the CLIENT ....
Code:
Dim objMail as SE.Email
Set objMail = New SE.Email
objMail.SendEmail "Test Email", "[email protected]", _
"From Some Sender", strCompanyEmailAddress, strMailMessageBody
So could someone explain to my single cell brain what I would need to do to call this ASYNCRONOUSLY please?
*beg*
-PK-
-
Apr 4th, 2002, 11:43 AM
#4
Well I hate to be on of those selfpromoting guys, BUT download the AsynchTasks sample from my website and Put any code that sends the email in the TimerProc sub of the AsynchProcess component then just call it from your exe. If you didn't compile the activeX exe then you'll need to register or run it first before using it.
-
Apr 4th, 2002, 11:48 AM
#5
What you want is the "T" word - thread. But you cannot thread using VB. It doesn't work - a known bug.
Methods called in VB complete synchronously by default.
The only way you can get this to work is to have a separate entity (read exe file) that you shell to from your ActiveX component.
MyMailServer.exe references the third party dll, your code does not.
MymailServer lives in it own process space. It ends after the mail is sent. It goes off and does it's thing, your code does not wait for it. Forking in other words.
This is what you suggested - I cannot see how it is NOT possible to do this.
-
Apr 4th, 2002, 07:01 PM
#6
Thread Starter
Member
-
Apr 5th, 2002, 10:10 AM
#7
Look into CreateProcess api call. You do not create a 'command' line for it. It's simply a parameter string placed in a struct in memory. I mentioned Shell because it's the poor man's way of doing this.
-
Apr 8th, 2002, 07:27 PM
#8
Thread Starter
Member
Hi Guys...
with lots of trial and errors (is that always the case), i've ended up using Edneeis code example. Though it is a bit more complex / cumbersome that i thought, it does work, and that is all that matters to me right now.
I would have loved to seen an example of CreateProcess which passes a score of params, but not COMMAND-LINE like ... and where these params COULD be either floats, integers AND STRINGS (strings == paragraphs of text .. not a single word).
-PK-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|