Results 1 to 10 of 10

Thread: Simple question about making my application a service

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    I already know what I have to do to the registry to make my .exe a service, but what I am not sure about is this: Should I just open up a 'new standard exe' and make the form invisible. I need to use some components, like winsock, so I need to have the form there to add the components to. Any suggestions on this will be greatly appreciated.

    Thanks,
    jk

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    India
    Posts
    85
    Dont use forms
    Use Module with

    Sub main()
    .....
    End sub

    then set the project Properties start up as Sub main

    Most of the sites I referred warned me of adding a VB exe as a service. Hence I have to do with Running it at start up.

    We have an exe running always in our machine. But we have added the exe in startup so that when a user logs into the machine it gets started.
    since we want the exe to be running always we keep the machine logged on always.



    Ramdas

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    yes, i have read the same thing about not making vb apps a service. something about not supporting multithreading 100 percent or something like that. however, i need to have this simple exe running, even when the user is logged off.

    so my next question is this, if i make it module then how do i add components like winsock to the project?

    thnx, jk

  4. #4
    Member
    Join Date
    Sep 1999
    Location
    Gloucester, UK
    Posts
    33
    To add a DLL such as winsock.dll to a module you need to set a reference to it using the references item of the project menu.

    You then access it by

    DIM oXXX as NEW xxxxxx

    or

    DIM oXXX as XXXXX

    set oXXX = NEW XXXXX

    VB / GIS Consultant
    VB6 SP4, VC++6

  5. #5
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    I've tried creating a winsock control at runtime (when its included in references) and I just cant get it to newup the object. I've tried:

    Private Withevents Winsock1 As Winsock

    Set Winsock1 = new Winsock

    and also

    Private Withevents Winsock1 As Winsock

    Set Winsock1 = CreateObject("MSWinsockLib.winsock")



    I had to end up having a form with a winsock already on it which wasnt as nice as I had hoped. Any ideas?

  6. #6
    Guest
    To create a control from scratch.

    Code:
    Controls.Add "MSWinsockLib.Winsock.1", "Winsock"

  7. #7
    Lively Member
    Join Date
    Mar 2000
    Posts
    87
    That would work for if it was to be created within a form. But to encapsulate it within a class module which doesnt have a controls collection, how do you do that?

    (Sorry to divert off the main topic)

  8. #8

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    so megatron, if i this code,

    Controls.Add "MSWinsockLib.Winsock.1", "Winsock",

    to create a winsock control how would i fire a connection request event, or any event in general(close, data arrival, ect.) if you can help me i would greatly appreciate it.

    thanks
    jk


  9. #9
    New Member
    Join Date
    Jul 2000
    Posts
    1
    JJK,

    Did anybody get back to you with information how to do this? I would also like to be able to do what you're doing and capture the events in a class since I can't use a form.

  10. #10

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    62
    No not really. I got my app to run as a service but as far as making the controls and using the events that they support I never really figured that out. I found that I really didnt need to do any of that for the application I was creating so I figured I would wait until I needed to do it to do more research on the matter. Sorry I can't help you. If you do figure out how to do this, email me with the solution at [email protected]. Thanks.

    JJK

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