Shoutbox

Running in background - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Running in background (/showthread.php?tid=14941)

Running in background by wipey on 08-28-2003 at 07:40 PM

okay I'm making this feature in which you type
/xcommand <arg>
and it sets some code running invisibly in the background....anyone know how to do this?


RE: Running in background by wipey on 08-28-2003 at 07:41 PM

oh, and it returns control back to messenger, while this code is running in the background


RE: Running in background by Whacko on 08-29-2003 at 11:03 AM

use threads... BUT the result of the thread cannot be sent to the chatwindow... unless you use a command to retrieve the result... and before you ask... i have no idea on how to use threads  in vb :P


RE: Running in background by wipey on 08-29-2003 at 01:40 PM

how do I use threads??? any examples:$? sorry but someone else mite kno:P


RE: Running in background by Whacko on 08-29-2003 at 01:46 PM

i think you might find it more useful to search on google... its not very easy to explain stuff like that


RE: Running in background by wipey on 08-29-2003 at 02:16 PM

lol well I've found a way of doing what I want using a timer, but where the hell would I place on and it's code?


RE: Running in background by wipey on 08-29-2003 at 03:55 PM

~place the timer? in the options explicit bit:$? someone help me:'(


RE: Running in background by Choli on 08-29-2003 at 06:28 PM

1st: Don't try to use threads with VB6. If you want to use threads, use VC++
2nd: Look for the Win32 API docummentation to see which API calls are reqired to manage threads.
3rd: wipey: Do you know that there is an edit button, so you can edit your posts and to not post twice?
4th: wipey: Why do you ask a lot of things about programing? It seems like you can't code :S


RE: Running in background by wipey on 08-29-2003 at 08:54 PM

1st: I'm not trying to use threads actually if you notice I found a timer would be adequate
2nd: no....you can't read
3rd: I know there's an edit button, I jus didnt click it this time:@
4th: I can program, just not dlls, I mainly program in php and VB.NET and have never programmed a fucking dll b4

sorry but don't act like such a knob head


RE: Running in background by wipey on 08-29-2003 at 09:04 PM

sorry can I just say what I originally meant to ask?:$

where do you put code like functions and timers in a dll?


RE: RE: Running in background by Choli on 08-30-2003 at 02:21 PM

quote:
Originally posted by wipey
sorry can I just say what I originally meant to ask?:$

where do you put code like functions and timers in a dll?

To use timers in a dll you have to use a hidden form and place a timer control in that form or use API functions to create a timer. The first option may be easier for you, but I prefer the 2nd one. It looks more professional :P and gives you more control over the timer. These are the timer API functions (the ones that you need)(declarations for VB)
code:
Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long

Declare Function KillTimer Lib "user32" Alias "KillTimer" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long

As I said you in other thread look for the in Google or in the Microsoft online help (or whatever that is called ;))

About putting functions in a dll (you'll need to do this if you use the SetTimer API), place them in a module or in a class and make then Public. I think that is the easiest way for you.
RE: Running in background by Predatory Kangaroo on 08-30-2003 at 05:10 PM

That's not the way I did it...
I put this in the general declarations part (the very top of the module):

code:
Public WithEvents my_timer As Timer


Then this in the initialize function:
code:
my_timer = New Timer


Then, I set the properties like I would with any normal timer

--EDIT--
Oh, and add a function for the timer to call:
code:
Private Sub my_timer_Timer()
'Code goes here
End Sub