Page 1 of 3 123 LastLast
Results 1 to 40 of 102

Thread: How to achieve true 100% multi-threading in VB. OLD THREAD

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Talking How to achieve true 100% multi-threading in VB. OLD THREAD

    This is an OLD thread, with OLD code. The new multithreading code can be found at:

    http://www.vbforums.com/showthread.p...hreadid=296315

    I have this kept this thread open for reference purposes, but for the new and improved multithreading please see the link above.

    Cheers,

    Woka




    The attached project demonstrates how to achieve multithreading in VB6.
    The example is only a concept example and merely adds 2 numbers togther, but delays the result by 10 seconds as to simulate code that would take up more processing power.

    You will need to compile the vbTools project 1st, and both the ThreadProxy and the Thread project use core functions from this DLL.
    Once this has been compiled then the Thread project needs compiling.

    After you have compiled these 2 projects then you can launch the Demo group in VB and run the application.

    I appologise for the lack of comments, but it should be pretty straight forward apart from the MemoryFunctions in vbTools2.

    If you have any comments then give me a shout.

    Regards,

    Woka
    Attached Files Attached Files

  2. #2
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    WGTN, New Zealand
    Posts
    338
    How do you debug multiple threads in VB?

  3. #3

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    You can't, I don't think, but you can debug one thread. When you are happy, compile it and then run your app while referencing the ActiveX EXE instead of the VB project.

    Woka

  4. #4

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Right, here's a much more realistic demo.
    The main app spawns new file search windows.
    You can search all directories inside the given path, and search for a certain file extension. If the file extension is blank then the app lists all files.
    Each thread that is searching for files, relays the info that it has got back to the main app. This could be used or say threads that are downloading data and want to display the progress in a grid in the main app.
    The main app here displays how many files, and what the last file was that was found.
    If the thread window is closed then the object is also destroyed from the main app. Also, if the main app is closed then ALL the threads are destroyed.

    This is a better example of passing many varibles between the threads in one call.

    Again, you need to compile vbTools2 first.
    Then compile the Thread Project, requires vbTools2.

    Then run the demo group. The ThreadProxy project in this group requires vbTool2.

    Comments are most welcome.

    Woka
    Attached Files Attached Files

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Not working for me. I compiled vbtool2 and ThreadProxy, and ran the Demo group project. it of course gave me errors of such a magnitude that one could only attribute it to an insane badger. Oh wait a minute...

    Anyways, I got past that by manually referencing the mythread.exe and vbtool2.dll files, but "No public creatable component was detected."

    It's early in the morning, and I am not motivated enough to fix it myself.

  6. #6

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    For soem reason the downlaoded project failed to find some classes. Boooo.
    Anyways, I have made some small alterations...one of which being the search code now no longer errors when it comes accross a file like pagesys

    OK...download the project in my last post.
    Compile vbTools2

    Load Thread project.
    Reference vbTools2
    Compile Thread project

    Load ThreadProxy project
    Reference vbTools2
    Compile ThreadProxy project

    Load UI Project
    Reference ThreadProxy and run the application.

    It will work this time...I promise

    Woka

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Wokawidget

    my last post.

    ...I promise

    Woka
    I certainly hope so!

    OK, checking it, and BBL.

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Your ThreadProxy project has a simple module, not a class module, and you're trying to compile a DLL out of it. Nincompoopy badger, DLLs require CLASS modules!!

    Now I shall have to expend the effort of converting that into a Class Module.

    Be back even later.

  9. #9

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    No, the ThreadProxy SHOULD have 2 class modules in it.
    FileSearch and FileSearches...When I open the project on my PC they automatically get loaded...

    Add them in manually, they are located in the same dir as the project file.

    Woka

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Aah, here's your problem. Apparently it's attempting to reference the place where *you* had kept them. (See attachment)

    Sorry for the bad color, it's a BMP, had to monochrome the sucker.

    Attached Images Attached Images  

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    OK, it's working.

    Great work. What I'm amazed at is how you managed to consistently carry a misspelled word (searhes) across four projects!

    I'd suggest you add an error handler in your UI project, under:

    VB Code:
    1. Private Sub cmdNew_Click()
    2.     If (GetAttr(Trim$(txtPath.Text)) And vbDirectory) = vbDirectory Then
    3.         mobjThread.NewSearch txtPath.Text, txtExt.Text
    4.     Else
    5.         MsgBox "Path doesn't exist", vbExclamation, "Search"
    6.     End If
    7. End Sub

    Make it like this:

    VB Code:
    1. Private Sub cmdNew_Click()
    2.     On Error GoTo stupidbadger
    3.    
    4.     If (GetAttr(Trim$(txtPath.Text)) And vbDirectory) = vbDirectory Then
    5.         mobjThread.NewSearch txtPath.Text, txtExt.Text
    6.         Exit Sub
    7.     Else
    8. stupidbadger:
    9.         MsgBox "Path doesn't exist", vbExclamation, "Search"
    10.     End If
    11. End Sub

    So that it can handle incorrect paths like C:\xyz

    But overall, I'm impressed (finally). You must be sooo overjoyed

    Good work.

  12. #12

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Hahaha. Cheers.
    That error handler won't work.
    The path error will be found in the Thread object and will not be transfered back to the client, unless you create an Error type and pass an ENCOUNTERED_ERROR windows message back to the client, and then handle this in the subclassing sub.


    Who says multi threading is not possible

    Woka

  13. #13
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Wokawidget

    That error handler won't work.
    Whosaysitwontwork.zip!
    Attached Files Attached Files

  14. #14

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    OK, tell a lie...it would be the GetAttr function that causes the error and not the ThreadProxy, which is what i was thinking. I was thinking furtehr ahead

    Can't believe you're having a go at my coding! Hahahahaha
    Any more whinging from you and I will officially demote you to Slop Bagder.

    OK, have uploaded the project, complete with error handler.
    I have used:
    VB Code:
    1. Private Sub cmdNew_Click()
    2. On Error GoTo ErrHandler
    3.     If (GetAttr(Trim$(txtPath.Text)) And vbDirectory) = vbDirectory Then
    4.         mobjThread.NewSearch txtPath.Text, txtExt.Text
    5.     Else
    6.         Err.Raise 53
    7.     End If
    8.     Exit Sub
    9. ErrHandler:
    10.     If Err.Number = 53 Then
    11.         MsgBox "Path doesn't exist", vbExclamation, "Search"
    12.     Else
    13.         MsgBox Err.Number & vbCr & Err.Description, "Error"
    14.     End If
    15. End Sub

    Woka

  15. #15
    Junior Member
    Join Date
    Oct 2003
    Location
    México
    Posts
    20
    Hi

    I have compiled your application, first thing i did was compile vbtools2, then ThreadProxy and then Thread and finally i lanched demo group and run it and it worked, but when in the first form(form1) i click then Start Loop button and i move this window with the mouse the Loop Count stop, why it happened????


    I think your application is good.

    So i need your help cause i need to make an application which it has to do the next task.

    This application actually runs a stored procedure n times, but it do it in a loop, the problem is that this stored procedure take several minutes and i need that this stored runs 2 o 3 with differents parameters at the same time, i know that it is possible with miltithreading, i have tried the API CreateThread but it crashes, in addition i've read that it is not very reliable,

    Also i download and kind of Thread emulator, and running a Stored procedure the most of the times the stored procedure didn´t finish its task, i.e. the stored procedure had to insert 28 registers and sometimes it just inserted 7 or 4 or 9 register, it was strange,

    So how could i use this component, i'd really need some kind of documantation as a guide.


    Does someone can help me please???, any ideas???

  16. #16

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    That is because when you try and resize/move the form it halts the thread. That happens with ALL applications if I am not mistaken.

    If you download my 2nd zipped example above then it will show you in more detail how to pass many varibles to the thread. this would help you in passing varibles to your SP...and returning multiple varibles back to the UI.

    CreateThread API does not work under VB
    MS suck Hahahaha [Only Kidding]

    Woka

  17. #17
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    I've played with the new version now, it's definitely top notch, apart from a few UI issues (which aren't relevant anyway!!)


    my (pointless!) UI comments:
    the mouse & form aren't disabled when you press the "new" button, which means you can get the "Switch to/Retry" dialog.

    the thread forms are very flickery (see how anal I can be? )

    and of course, the more threads you start the less often the main screen updates (as we'd expect, especially on crappy pc's like the one I'm using )


    good work Woka

  18. #18

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Cheers

    Now I'm gonna be picky...in my defence though.

    1) What Retry Error? I have just clicked the new button like mad and created about 50 new threads in about 10 seconds...All loaded and started searching for files perfectly...
    There should be no need to disable the button...explain.

    2) The form flickers is not actually the form, it's the listview. this is because when a thread passes data to the Ui and the UI updates the listview columns, it automatically refreshes itself. This cannot be stopped with a listview (to my knowledge), and to be fair it is getting hammered with updates if you have many threads open and are searching for ALL files

    3)When you have LOADS of threads open the overall speed of your processor is compromised. this starts slowing ALL processes down on your PC...if you had an unrelated app running then this would also start to slow...that is due to the OS. You can demo this by attempting to open 30 MS Windows Search things and getting them to all search at the same time.

    Right, enough of my whinging

    This type of programming is perfect for say multiple download programs liek DAP and such like, but can have many, mnay benefits in other applications.
    Glad you like it.

    Should I copyright the code? Or don't I have a leg to stand on? hahaha

    Woka

  19. #19
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by DipwadWidget
    VB Code:
    1. Private Sub cmdNew_Click()
    2. On Error GoTo ErrHandler
    3.     If (GetAttr(Trim$(txtPath.Text)) And vbDirectory) = vbDirectory Then
    4.         mobjThread.NewSearch txtPath.Text, txtExt.Text
    5.     Else
    6.         Err.Raise 53
    7.     End If
    8.     Exit Sub
    9. ErrHandler:
    10.     If Err.Number = 53 Then
    11.         MsgBox "Path doesn't exist", vbExclamation, "Search"
    12.     Else
    13.         MsgBox Err.Number & vbCr & Err.Description, "Error"
    14.     End If
    15. End Sub
    OH... so suddenly MY code isn't good enough for you? Do I smell... JEALOUSY?

    Anyways, don't copyright it. Else I'll personally come over to your filthy little hamlet and kick your edited by MartinLiss, even though he supports this idea as well .

  20. #20

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Your code was fine. It's just i have a thing about GOTO commands. I ONLY use them for error handlers and not to pass the execution of code to another point in the sub/function...
    I always have a generic errorhandler then distiguish between different err.numbers to decide what action to take.

    That sounded far too serious

    Hahahahaha
    Growly Woof Woofs...I was not fit to be god enough to forget the error handler all together, and for that I am grateful...now go and hide in a long dark cancal and try to mate with a rummpy toad under a full moon Frrroooaaaaarrr.

    Woka

  21. #21
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Superb. Excellent. Absolutely Amazing !!!!!!!!!
    Attached Images Attached Images  
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  22. #22
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Would it be possible to have another example included to see how long a non-multiple threaded app would take to do the file searching?
    Don't Rate my posts.

  23. #23
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    Cool Woka. My best compliments to u.
    I've d/l ur project and it worked gr8.
    But tryin' 2 figure things out of that massive codes is a hard one.

    U dont seem to use outprocess threading, neither do u use
    interprocess threading either. But they really multi-thread!
    it seems u rely on windows messaging? but how?

    anyway, pls input the pseudocodes or method u use.
    it'll be gr8
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

  24. #24
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Ummmm........

    Whats multi-threading and what does it do/whats it for?

  25. #25
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    Woka,

    Are u using a proxy thread?
    Ironically, though it's pretty self-explainatory through ur
    ThreadProxy project, well, ......stupid me

    because i really can't understand how ur codes do that...
    initially i thought it involves some playing with windows
    messaging? because ur codes dont seem to play with thread-like
    stuffs...u know...like CreateThread,CreateObject,SetTimer

    One question for u though, does ur threads live in different
    apartments?


    I recently visit some multi-threading sites at desaware's...

    and they demonstrate apartment threading using Proxy Threading
    and it works very well, albeit some performance trade off due to
    marshalling...

    EDIT: Duh...I mean works very well on VB5
    Last edited by jian2587; Oct 26th, 2003 at 09:43 AM.
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

  26. #26

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    The thread proxy creates a new instance of the ActiveX EXE, which runs in a seperate thread to the calling project, and runs in a seperate process.
    Using the postmessage API I send the uMsg and the memory location of the UDT to the ActiveX EXE, returning execution straight back to the threadproxy, and in turn the UI.
    Once the ActiveX EXE recieves the message it reads the memory from the ThreadProxy process. This is how the varibles are passed. Once it has recieved the varibles it the does whatever work needs to be done...running in a seperate thread.
    Exactly the same is used to pass info back to the UI.

    Make sense?

    Sorry, not that good at explaining things am I
    Doesn't help that I am suffering from a great weekend of parties and clubs...have had 5 hrs kip since Friday morning

    Woka

  27. #27

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    PS:

    Also, what do you mean by Proxy Thread?

    The ThreadProxy project is merely to allow ease of coding in the UI's that u wish to utilise the functionality. This code could just as easily be placed in the UI itself, but splitting it into a standard DLL makes code easier to maintain and read.

    Woka

  28. #28
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    baddge
    im am durnk
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  29. #29
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Madboy
    Ummmm........

    Whats multi-threading and what does it do/whats it for?
    In multithreading, a single process can call several calls. Or you can look at it another way and say that it's the simultaneious execution of several function flows or "threads".

    This is possible if these threads are not dependent upon one another. Since these threads aren't dependent upon one another, it's advantageous to have several different portions of the programs being executed in the most optimum way, instead of having them execute in a serial fashion. I can give you a very small example here:

    Let's say we're to evaluate the following expression

    a=92
    b = a + 382
    c = a*b + a^2
    d = 283+ 28+a

    x = a^2 + 2bc + c^2



    Now if we were to implement multithreading on this, you can easily see that d is independent of b, c and x. "a" is a constant in it, so while the evaluation of b and c are going on, we can get the "d" thread to work, evaluate d, and after b and c get evaluated, we plug them into x.

    This is a redundant example because you wouldn't notice the performance difference on something like this. But there are areas and applications where multithreading would be of good use to you.

  30. #30
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    Woka,

    about that Proxy thread thing...
    well, because i've seen some multithreading techniques involving
    the use of IDispatch interface to act as the proxy for the thread
    u want to create. So while it does thread, it slows down because
    of that extra marshalling. Not compatible with VB6, though.

    anyway, u did a good job and good explaination. albeit using
    another process to thread...sigh...that's VB6...
    well,u're da man!

    I'll see if we can get things better through this technique.
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

  31. #31

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    There is one tiny weeny ickle glitch with my code. Has anyone spotted it yet?

    I am currently working on a newer improved version. Well in my head anyways. The concept will work and it will make the multithreading more reliable and glitch free. I'll get round to writting it in the next few days. My head's still mashed from the wkend

    Don't suppose you could post links to the multithreading you have seen. I have never seen any other code to try at achieve what I am moving towards.

    Woka

  32. #32
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    Originally posted by Wokawidget
    Cheers

    Now I'm gonna be picky...in my defence though.

    1) What Retry Error? I have just clicked the new button like mad and created about 50 new threads in about 10 seconds...All loaded and started searching for files perfectly...
    There should be no need to disable the button...explain.
    I only needed to get up to 4 threads for it to happen, I think it was taking a while to spark the threads off (I'm using a very slow PC - 500Mhz, 128MB )... haven't investigated it to find out where the issue is tho.

    2) The form flickers is not actually the form, it's the listview. this is because when a thread passes data to the Ui and the UI updates the listview columns, it automatically refreshes itself. This cannot be stopped with a listview (to my knowledge), and to be fair it is getting hammered with updates if you have many threads open and are searching for ALL files

    3)When you have LOADS of threads open the overall speed of your processor is compromised. this starts slowing ALL processes down on your PC...if you had an unrelated app running then this would also start to slow...that is due to the OS. You can demo this by attempting to open 30 MS Windows Search things and getting them to all search at the same time.
    all agreed - not important issues at all, I was just being pedantic


    Should I copyright the code? Or don't I have a leg to stand on? hahaha

    Woka
    Shouldn't that be 4 legs?

    Now it's on the web I'm not sure if you could, especially with the AUP of this site (not that I know much about it...). If you created a Dll or whatever with the concepts of this in then it should be fine.

  33. #33

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    OK, I know where this is happening...it's when you create the ActiveX EXE class in the threadproxy and access 2 of it's properties. This can easily be resolved. I will add this into the new revision. I can't force this on my PC as it's a very fast one.

    I too was being pedantic hahahaa

    Only have 3 legs, as I lost one in a horrific accident involving a banana jam pie at the weekend

    Woka

  34. #34
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    Originally posted by Wokawidget
    OK, I know where this is happening...it's when you create the ActiveX EXE class in the threadproxy and access 2 of it's properties. This can easily be resolved. I will add this into the new revision.
    excellent

    I can't force this on my PC as it's a very fast one.
    ******!


    Only have 3 legs, as I lost one in a horrific accident involving a banana jam pie at the weekend
    oh no! I think there's a big banana problem right now... I was attacked yesterday by a massive banana toffee sundae , managed to eat my way put of it tho

  35. #35
    Junior Member
    Join Date
    Oct 2003
    Location
    México
    Posts
    20

    Talking

    Hi Woka, its good your code, i think its gonna hep too mucj, hope so, now i'm trying to understand how your code work, it would be great you could attack some kind of documentation, for example, after i be able to uindarstand i have to adapt to the store procedured than i had mentioned before,.


    I have atached an image; when i create up to 5 searches the CPU usage get to almost 100%, however, i dont need more than 5 threads in my application, thats good.

    Congratulations Woka

  36. #36

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Attached image???

    Documentation will come...in time
    I am sorry I haven't posted any yet, but I am a busy little badger. I promise I will get round to it

    Glad you like the code.

    Woka

  37. #37
    Junior Member
    Join Date
    Oct 2003
    Location
    México
    Posts
    20
    Tnaks for all, anyway
    Attached Images Attached Images  

  38. #38

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Right the reason your processor is at 100% is because the example I have posted is a very fast looping search and is processor hungry If you do:
    VB Code:
    1. Do While Not mblnCancel
    2. Loop
    Then this will scoff CPU time even though it's not actually doing anything.

    Woka

  39. #39
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    I kept thinking about how to put those stuffs in a DLL, so we can
    just create a thread without writing much codes.

    Now tinkering with some of my ideas, will post it when it's working
    rite!

    I'm using apartment threading, but since it's a DLL...well...I'll try
    to put SetTimer in use as well, let's see if it works.
    ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
    Programming is fun, but only if you're not on a tight deadline
    So I consider all those working engineers sad people

    VB FTP class
    3 page PHP crash course
    Crash Course on DX9 Managed with VB.NET covering basics till terrain creation

  40. #40
    Supreme User Madboy's Avatar
    Join Date
    Oct 2003
    Location
    England
    Posts
    3,253
    Sounds confusing too me. Ill stick with what i know best - the basics

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width