Results 1 to 13 of 13

Thread: registering ocx file automatically

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2003
    Location
    Noida
    Posts
    21

    registering ocx file automatically

    Hello,

    I am using Common Dialog box in my VB form. For that it use comdlg32.ocx file. If a Computer doesn't have this file, my exe generates an error .To solve the same, I have to copy comdlg32.exe file in the corrosping folder of that system.
    I want that as my exe runs, it automatically register the same or any ocx file, so I dont have to copy the ocx file again and again.

    Do anybody have any idea about this.

    Thanx in advance,
    Saurabh
    sjain

  2. #2
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    oh1mie/Vic


  3. #3
    Hyperactive Member aks_1610's Avatar
    Join Date
    Sep 2002
    Location
    Pune, India
    Posts
    280
    hi,

    i don't understand why u r coping the .OCX file in ur project folder.

    if u r making the project to be deployed on other computer which does not have (any) .OCX file, use Project and Deployment wizard to make the Setup file. This Setup file will include all the dependency information of ur proj. and install all the required components to the destination computer.
    A man with nothing to live for has everything to fight for...

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jun 2003
    Location
    Noida
    Posts
    21
    That's user's requirement. They dont want to run setup files.
    They need a small size exe in which they need everything.

    Everytime I have to look my user's computer, to check whether the corrosponding ocx exist or not.

    Thanx,
    Saurabh
    sjain

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2003
    Location
    Noida
    Posts
    21
    Hi oh1mie,

    I have used the code but didn't able to solve the problem.

    It gives me this error:

    Run time error '53':
    File Not Found: cdo32.dll

    whether I have to create the same file. I dont have any idea about this. Please, can anyone tell about this?
    sjain

  6. #6
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    On that example cdo32.dll is registered component. Change that name to your own component, what you want to register.
    oh1mie/Vic


  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jun 2003
    Location
    Noida
    Posts
    21
    Sorry, but I am unable to solve it. I didn't work on dll's therefore I am unable to detect which file we should use or what changes I should make in the said code.

    I am using Common Dialog box in my VB form. The name of this component in my application is cdgfileopen.
    I am using this component to browse the local files in the system.

    Can you help me?
    sjain

  8. #8
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    Here is example for you:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Const ERROR_SUCCESS = &H0
    4.  
    5. Private Declare Function Regcomdlg32 Lib "comdlg32.dll" Alias "DllRegisterServer" () As Long
    6. Private Declare Function UnRegcomdlg32 Lib "comdlg32.dll" Alias "DllUnregisterServer" () As Long
    7. Private Sub cmdUnRegister_Click()
    8.    
    9.     If UnRegcomdlg32 = ERROR_SUCCESS Then
    10.        MsgBox "comdlg32.dll UnRegistered"
    11.     Else
    12.        MsgBox "comdlg32.dll UnRegistered fail"
    13.     End If
    14.  
    15. End Sub
    16. Private Sub cmdRegister_Click()
    17.  
    18.     If Regcomdlg32 = ERROR_SUCCESS Then
    19.        MsgBox "comdlg32.dll Registered"
    20.     Else
    21.        MsgBox "comdlg32.dll Registered fail"
    22.     End If
    23.  
    24. End Sub
    oh1mie/Vic


  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2003
    Location
    Noida
    Posts
    21
    Hi,

    It gives me an error saying:

    Run-time error '453':

    Can't find DLL entry point DLLRegisterServer in comdlg32.dll

    while Debug the error it indicates on the line

    ---> If Regcomdlg32 = ERROR_SUCCESS Then


    Saurabh
    sjain

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    umm isn't the common dialog control component "COMDLG32.OCX"

  11. #11
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    Originally posted by kleinma
    umm isn't the common dialog control component "COMDLG32.OCX"
    Kleinma is right.
    Do your VB work right ?
    oh1mie/Vic


  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    it is also possible to not use a component at all.. but ALL API code to generate the box (I think that DOES use comdlg32.dll) which doesn't need to be distributed anyway.. it is a windows system file

    if you are a beginner... it will be pretty tough.. but I am sure it has already been coded and posted on here before...

    if you HAVE to make an setup free application.. i would use as much API and as little ocx/dll files as possible...

    of course you know that only newer windows OSes come with the VB runtime files included.. so if you try to run your app on an older version (not sure if 2k or me was the first) it will crash anyway

  13. #13
    Hyperactive Member aks_1610's Avatar
    Join Date
    Sep 2002
    Location
    Pune, India
    Posts
    280
    hi if u already OCX file in the project folder then use

    shell command to register the OCX file like:

    VB Code:
    1. Shell ("regsvr32 /s " & <filename>)

    filename can be comdlg32.OCX
    A man with nothing to live for has everything to fight for...

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