yusuf

yusuf

  • NA
  • 9
  • 0

usercontrol(.dll) in a html page..

Nov 30 2005 6:50 AM
hey..

i have problem with the usercontrol not able to display in a html page...am not able to view in client machine..
i even user COMregisterfunction and COMUnregisterFunction.....can someone help me out with wat i need to change rom thic code...i got this code from internet.
ALso i want to know..whether do we need to register the dll on every machine in which the html page is ben viewed. if YES? then tell me how?

[ ComRegisterFunction() ]

public static void RegisterClass (string key_ )

{

// Strip off HKEY_CLASSES_ROOT\ from the passed key as we don't need it

StringBuilder sb = new StringBuilder ( key_ ) ;

sb.Replace(@"HKEY_CLASSES_ROOT\","B7E2C913-06D1-41e2-9A65-733995131C89") ;

// Open the CLSID\{guid} key for write access

RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(sb.ToString(),true);

// And create the 'Control' key - this allows it to show up in

// the ActiveX control container

RegistryKey ctrl = regKey.CreateSubKey ( "Control" ) ;

ctrl.Close ( ) ;

// Next create the CodeBase entry - needed if not string named and GACced.

RegistryKey inprocServer32 = regKey.OpenSubKey ( "InprocServer32" , true ) ;

inprocServer32.SetValue ( "CodeBase" , Assembly.GetExecutingAssembly().CodeBase ) ;

//MessageBox.Show( Assembly.GetExecutingAssembly().CodeBase );

inprocServer32.Close ( ) ;

// Finally close the main key

regKey.Close ( ) ;

}

/// <summary>

/// Called to unregister the control

/// </summary>

/// <param name="key">Tke registry key</param>

[ComUnregisterFunction()]

public static void UnregisterClass ( string key_ )

{

StringBuilder sb = new StringBuilder ( key_ ) ;

sb.Replace(@"HKEY_CLASSES_ROOT\","B7E2C913-06D1-41e2-9A65-733995131C89") ;

// Open HKCR\CLSID\{guid} for write access

RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(sb.ToString(),true);

// Delete the 'Control' key, but don't throw an exception if it does not exist

regKey.DeleteSubKey ( "Control" , false ) ;

// Next open up InprocServer32

RegistryKey inprocServer32 = regKey.OpenSubKey ( "InprocServer32" , true ) ;

// And delete the CodeBase key, again not throwing if missing

regKey.DeleteSubKey ( "CodeBase" , false ) ;

// Finally close the main key

regKey.Close ( ) ;

}


My html looks like this...
<html>
  <body> 
    <center><br><br><br><br><br>
      <object id="DllInDll"
 Classid="http://10.1.30.58:9090/newbreak/DLLInDll.dll#NBUserControl_DllInDll.UserControl1"
  CODEBASE ="CLSID:B7E2C913-06D1-41e2-9A65-733995131C89" width="700" height="600">
 </object>
   </center>
   </body>
</html>


pls give me a solution..

Thanks,
yusuf