My .exe uses mswinsck.ocx and i need the program to install mswinsck.ocx if it's..

My .exe uses mswinsck.ocx and i need the program to install mswinsck.ocx if it's not in the system folder allready.
I dont know much about this but i have a similar project i downloaded which uses a .res file and when the .exe is started for the 1st time it makes a .ocx and puts it in the system folder.
It's just i dont want to use the p&d w as i just want to be able to easily distibute this .exe to my friends.
I know its possible.
Thanks for your time,
I would really appreciate an example.
LVL 12
Ian GoughAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can use microsofts package and deployment wizard to create an install file for your application, you can find it in the Micorsoft Visual Studio X Tools folder in your start menu, X being the version number to you studio.  If this doesnt work out for you, you can try setupfactory.
Ian GoughAuthor Commented:
Thanks, but i have allready stated i dont want to use a wizzard.
I want the .exe to do it.
oops sorry, im thinking that you could possibly do this.

Unload the winsock from your program, then make a copy of it and put it in the same folder as your program, add the component back in but browse for it and enter the one in your folder.  Then when deploying add the winsock.ocx into a zip with your .exe.  I think that it should work.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Ian GoughAuthor Commented:
Thanks but its all got to be contained in 1 .exe!
No zip of nothing.  The example i have does this but i cant work out how to change it to use winsock.
It basically has a .res file contained in the .exe and it changes to .ocx and puts in it in the system folder the 1st time it's loaded.
ok, another thing to look into would be user documents, you can put the .ocx into your app as a user doc by clicking the Add File, then checking the add as related doc checkbox in the dialog.  but after that i dont know.  Never really done this before but i am interested to see if you get it to work.
aha, here we go.

    b = LoadResData(101, "CUSTOM")
    F = FreeFile
    Open TPath$ For Binary As F
    Put #F, 1, b
    Close F

i looked into it and this is what i got, set TPath$ = to the windows system directory should look like "C:\Windows\System32\MSWinsck.ocx".  In loadresdata where it says 101, change that to the ID to the file you want to copy, that can be found in the properties of the .res file.  If the machines still have problems just shellexecute the Then just shell execute the  regsvr with the right command line proc to register the .ocx.  You should be set with that
Ian GoughAuthor Commented:
Thanks, i think were getting there.
Below is the example i was on about.
When u run it as a vbp it will say missing .ocx but you need to exit vb then re run it and do that a couple of time.  When you compile it you dont get that problem.  But need run it a couple of times as vbp 1st without saving.  (all in the readme)  Then complie.
Anyhow is it possible you can take the example below and change the vbdice.res to winsock (So it installs winsock instead)
Just change the frmmain to a blank form but keep the name as it is.

If it all works after testing i'd be more than happy to reward extra points.
Thanks Again
im on it, gimme a sec and ill get the code to you
ok i switched it over to do mswinsck.ocx but how do you want me to give you the code for it?
Ian GoughAuthor Commented:
Um?  Do you have a website you can upload it too?
Or can you send it to me via email?
ok its sent, like the email says, i tested it and it works perfectly.  if you wanna test it you can just change this:

In the module BasMAIN there is a routine called Main, in that routine there are 3 lines:
        If FileExists(sysDIR & "\MSWinsck.ocx") = True Then 'Yes it is

        GenFileFromRes 101, "CUSTOM", "OCX", , , sysDIR & "\MSWINSCK.ocx"
        ExecuteLink "REGSVR32.EXE", sysDIR & "\MSWINSCK.ocx /s"

just change those two 3 to this:
        If FileExists(sysDIR & "\MSWinsck.ocx") = True Then 'Yes it is

        GenFileFromRes 101, "CUSTOM", "OCX", , , sysDIR & "\MSWINSCKTEST.ocx"
        ExecuteLink "REGSVR32.EXE", sysDIR & "\MSWINSCKTEST.ocx /s"

and then run the program, youll see that it installs a MSWINSCKTEST.ocx into the system directory, and it is registered.  After that just switch it back and your good to go

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ian GoughAuthor Commented:
Thanks very much!
Works perfectly.
Thanks Again,
glad i can help, and thanks a million for all those extra points.  if you ever need anything again just let me know.
Ian GoughAuthor Commented:
Oh, I am sorry, i forgot about the extra points.
As promised.
How about i open up a new question and put 225 points in there?
Sorry Again,
you allready gave me 2000 expert points!
if you really want to, we can, but its up to you completely
Ian GoughAuthor Commented:
Ok, Thanks then.
I'll let you know if i ever need anything again,

I was wondering if Nathan could make available the code heemailed to iangough7?

I am writing a similar APP and i'm happy to open a new question with specifics, but thought as Nathan had worked his way thru the problem already ...
Ian GoughAuthor Commented:
Hi bewildered!!!
I have the code if you want it.  Just email me at
hi guys, i'm interesting in something similar, i want to have one .exe too, but with vb runtime already compiled with the .exe (dll+ocx), i trayed the resurce file but it's not fiable as a solucion (the client machine where the .exe is executed could not have admin privilege to copy to sys dir or access the reg), so the only way is to have one .exe, i was looking for an app (fusionV2) that do the job, but i didn't found it since the website is moved, i tryed another app called (alloy), with two forms, with two winsock controls in each one, and the first open the 2nd, setting listening mode .... and conect the first winsock to the 2nd, compiling normaly (vb6) the .exe, and using alloy to identify the dependency files, so i can add them, but it's didn't works, anyone can help with another solucion please !!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.