Jump to content
Xtreme .Net Talk

Shamil

Avatar/Signature
  • Posts

    28
  • Joined

  • Last visited

About Shamil

  • Birthday 02/05/1959

Personal Information

  • Occupation
    freelance consultant/programmer
  • Visual Studio .NET Version
    Visual Studio .NET Professional
  • .NET Preferred Language
    VB.NET, C#

Shamil's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Have a look at ASP.NET Calendar Control from Infragistics http://www.infragistics.com/products/schedule.asp Shamil
  2. Hi All, Has anybody seen the info how to implement the subj? TIA, Shamil
  3. Here is even more tricky solution with two implemeneted Interfaces and full control on Interface methods DispIds: Imports System.Runtime.InteropServices <Guid("D9870F22-4CA5-4567-96DA-6A6CAA541F6D")> _ Public Interface ICAllMeFromCOM1 <DispId(1)> Sub MessageBox(ByVal vstrMsg As String) <DispId(2)> Function GiveMeYourName() As String <DispId(3)> Function GetMyRef() As Object End Interface <Guid("780B6E92-AF98-48b6-8C0B-2832C86F2DB7")> _ Public Interface ICallMeFromCOM2 <DispId(503)> Sub testMessage(ByVal vstrMsg As String) End Interface <Guid("AE2F4135-D660-453a-B638-373691194EB6")> _ Public Class TestClass Implements ICAllMeFromCOM1 Implements ICallMeFromCOM2 Public Sub New() MyBase.New() End Sub <DispId(1)> Public Sub MessageBox(ByVal vstrMsg As String) _ Implements ICAllMeFromCOM1.MessageBox MsgBox("Test Message = " + vstrMsg) End Sub <DispId(2)> Public Function GiveMeYourName() As String _ Implements ICAllMeFromCOM1.GiveMeYourName GiveMeYourName = MyName() End Function <DispId(3)> Public Function GetMyref() As Object _ Implements ICAllMeFromCOM1.GetMyRef GetMyref = Me End Function <DispId(503)> Public Sub myMessage(ByVal vstrMsg As String) _ Implements ICallMeFromCOM2.testMessage MsgBox("ICallMeFromCOM2.testMessage: " + vstrMsg) End Sub <ComVisible(False)> Public Function MyName() As String MyName = Me.GetType().FullName End Function <ComRegisterFunction()> Public Shared Sub OnRegistration(ByVal T As Type) MsgBox(T.FullName & " is being registered in COM!") End Sub End Class In Vb6 (or any other COM application) this class above can be used e.g. like this: Dim obj As New TestClass Dim I2 As ICallMeFromCOM2 obj.MessageBox "Test" Set I2 = obj I2.testMessage "Test" Shamil
  4. Here is a solution based on info from MSDN and other sources: Test class: ======== Imports System.Runtime.InteropServices <ComClass(TestClass1.ClassId, TestClass1.InterfaceId, TestClass1.EventsId)> _ Public Class TestClass1 #Region "COM GUIDs" Public Const ClassId As String = "FA16F4E8-69AC-4fd1-84BA-770674DFFFAE" Public Const InterfaceId As String = "A041238E-7C8A-437d-A18B-3A18D09E7B60" Public Const EventsId As String = "691E110D-C2FD-4eda-8801-A5246169A4F3" #End Region Public Sub New() MyBase.New() End Sub <DispId(1)> Public Sub MessageBox(ByVal vstrMsg As String) MsgBox("Message from VB.Net component - " & vstrMsg) End Sub <DispId(2)> Public Function GiveMeYourName() As String GiveMeYourName = MyName() End Function <ComVisible(False), DispId(3)> Public Function MyName() As String MyName = Me.GetType().FullName End Function <ComRegisterFunction()> Public Shared Sub OnRegistration(ByVal T As Type) MsgBox(T.FullName & " is being registered in COM!") End Sub End Class AssemblyInfo.VB ============ Imports System.Reflection Imports System.Runtime.InteropServices <Assembly: AssemblyTitle("CCW Test")> <Assembly: AssemblyDescription("Call VB.NET Component from COM")> <Assembly: AssemblyCompany("Test")> <Assembly: AssemblyProduct("CCW Test DLL")> <Assembly: AssemblyCopyright("Public Domain")> <Assembly: AssemblyTrademark("")> <Assembly: CLSCompliant(True)> <Assembly: Guid("DB955828-2239-4747-A08C-5C1F9F574AFA")> <Assembly: AssemblyVersion("1.0.*")> <Assembly: ComVisible(True)> '<Assembly: ClassInterface(ClassInterfaceType.AutoDual)> <Assembly: AssemblyKeyFileAttribute("<type you full path to snk file here>.snk")> Create Assembly Strong Name .snk file =========================== sn -k myKey.snk Create class library and build solution from VS.NET IDE ====================================== (use of VS.NET IDE is obvious) Register assembly and export type library ============================== regasm MyCCWDll.dll /tlb:MyCCWDll.tlb Install Assembly in the global Assembly cashe ================================ gacutil /if MyCCWDll.dll Now you can set reference from COM applications to MyCCWDll.tlb and use its exposed objects via early binding or you can use CreateObject(...) to create instances of the objects exposed from MyCCWDll.dll and use them with late binding... Maybe this above isn't an optimal way to make CCW Dll but it worked for me... HTH, Shamil P.S. The procedure to make CCW components visible to COM should work automagically in theory fro VS.NET IDE if you set "Register for COM interop" checkbox in project's configuration settings but it failed for me...
  5. VB.NET: Yes, VB.NET managed classes can be called from COM (like MS Word 2000) applications - COM Callable Wrappers (CCW) are used for that - here is an article describing this technology: http://www.codeproject.com/dotnet/COM_DOTNET_INTEROP.asp Here is a sample code: http://www.dotnetextreme.com/articles/ccwrcw.asp Here is a discussion of the CCW subject with some more information how to build visible to COM apps .NET components... HTH, Shamil
  6. VB6: You have to put your class into ActiveX Dll and set its Instancing property to MultiUse or GlobalMultiuse. Then you compile your ActiveX Dll and set a reference to it or just use CreateObject(...) to create instances of your class... HTH, Shamil
  7. Here it's: http://www.informit.com/isapi/product_id~%7BA1CE8908-9877-4B24-9B2C-BD7B836490D6%7D/element_id~%7B8B2060F0-4E20-489D-8B39-2890BAC99CA0%7D/st~%7BEA7C8D03-4995-402D-B085-06E000F897B8%7D/content/articlex.asp HTH, Shamil
  8. Shamil

    Method name

    Phylum, You can use this code to solve first part of your task: Dim strProcName As String Dim strClassName As String Dim strAssName As String strAssName = System.IO.Path.GetFileName( _ System.Reflection.Assembly.GetExecutingAssembly().Location()) strProcName = System.Reflection.MethodBase.GetCurrentMethod().Name strClassName = Me.GetType().ToString HTH, Shamil
  9. Robby, This is free WebHosting where anybody can install and test ready to use (Shopping Cart, Portal, Community etc.) and their own ASP.NET applications. I've used it today and I've found it very good. Shamil
  10. Mark, Here is code sample, which may help to solve your task: Public Sub CopyFormat( _ ByRef rwbkDst As Excel.Workbook, _ ByVal vlngDstColNum As Int32, _ ByRef rwbkSrc As Excel.Workbook, _ ByVal vlngSrcRowNum As Int32, _ ByVal vlngSrcColNum As Int32) ' Copy format of rwbkSrc.Worksheets(1).Cell(vlngSrcRowNum,vlngSrcColNum) to ' entire column rwbkDst.Column(vlngDstColNum) rwbkSrc.Worksheets(1).Cells(vlngSrcRowNum, vlngSrcColNum).Copy() rwbkDst.Worksheets(1).Columns.Item(vlngDstColNum).PasteSpecial( _ Paste:=Excel.Constants.xlFormats, _ Operation:=Excel.Constants.xlNone, _ SkipBlanks:=False, _ Transpose:=False) End Sub HTH, Shamil
  11. Have a look at: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20655227.html and http://msdn.microsoft.com/msdnmag/issues/01/07/vbnet/default.aspx HTH, Shamil
  12. <<< I was talking about making applications, write code ...what is your suggestions on this ? >>> You may try this: http://europe.webmatrixhosting.net/ HTH, Shamil
  13. This doesn't work for you? Dim strFullPath As String = "c:\temp\testDir" ' hide dir System.IO.File.SetAttributes(strFullPath, FileAttributes.Hidden) ' unhide dir System.IO.File.SetAttributes(strFullPath, FileAttributes.Normal) It works well here. Shamil
  14. Ben, Here is the function, which should help you (tested with MS Office 2000 only): Public Function MsWordFullPath(ByVal vlngVersion As Long) As String ' Given MS Word version number returns its FullPath if it's installed, empty string ("") otherwise ' Note: MS Office versions supported: 8 and above Dim objRegKey As Microsoft.Win32.RegistryKey Dim strKeyName As String Dim strValueName As String Dim strValue As String strKeyName = "SOFTWARE\\Microsoft\\Office\\" & vlngVersion.ToString & ".0\\Common\\InstallRoot" Select Case vlngVersion Case Is < 8 strValueName = "" strValue = "" Case 8 strValueName = "OfficeBin" Case Is > 8 strValueName = "Path" End Select If Microsoft.VisualBasic.Len(strValueName) > 0 Then objRegKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strKeyName, False) If (objRegKey Is Nothing) Then strValue = "" Else strValue = objRegKey.GetValue(strValueName) If Microsoft.VisualBasic.Len(strValue) > 0 Then If Microsoft.VisualBasic.Right(strValue, 1) <> "\" Then strValue = strValue & "\" strValue = strValue & "winword.exe" If Not System.IO.File.Exists(strValue) Then strValue = "" End If objRegKey.Close() End If End If Return (strValue) End Function HTH, Shamil
  15. Ben, Sorry, I did post wrong registry keys (form MS Access instead of MW Word) - here how they should have been posted: For MS Word versions starting 9.0 (2000) you can check the existence of the registry key: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\<MS Office version>\Word\InstallRoot] e.g. for MS Word 2000 this will be the key: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Word\InstallRoot] For MS Office 97 I think you've to check the existence of the system registry value BinDirPath under [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\8.0] read this value - e.g. I've it here as "BinDirPath"="D:\\Program Files\\MSOffice\\97\\Office" and then concatenate it with winword.exe - it will be: D:\Program Files\MSOffice\97\Office\winword.exe for the sample value above and see if this file exists of not. HTH, Shamil
×
×
  • Create New...