Menu

 

Saturday, March 14, 2009

Hello World ActiveX

Hi ,

Again Came with Some Problem Regarding ActiveX in Csharp .. If Finding and Doing Some Google I Came Across Some Good Changelling Secnerio..
I have Create ActiveX Control.. Know I will Show U Step By Step How To Create ActiveX Control in Csharp ...

Requirement

1} Vs2005,Vs2008
2}IIS
3}Bit of Interest for Doing Some New Things..

Lets Start...

1} First Select The .Dll Project From Visual Studio Project..















2} Now Delete The Default CS File Createad By Visual Studio.















3} Know Adding User Control On Project















4} Know Creating User Interface On User Contol















5} Know Making It COM Visible














6} Register COM to Interop

Project--->Proprites->Build















Done and Complie The project

Know How To Acess In Html,Asp,Aspx etc Page

1} When Page Is Acesssed on IE (It will or may not work in Non-IE Browser)














2} Know Pasing Data From Html and Passing Back the ActiveX Control














Note: U have Create Virtual Direcorty to Run The Sample
and U can download the Source Code Mention Below
http://www.mediafire.com/?sharekey=5082eaf05dd192a9c79b87b207592a1cc88d80740a24ef7c5be6ba49b5870170

Hope It Helps Some Body..

10 comments:

  1. Hi,

    U may Create the Activex and Do the work on Client as desktop..

    Take a scenario in Which u have Add the List of File preset in Client and Take Sanpstod and send back to server..

    using webapplication then activeX come HANDY..

    http://msdn.microsoft.com/en-us/library/1b8fd8ss.aspx

    U have all This Register using CAB project for installtion chk the above link for info

    ReplyDelete
  2. Hello. I got your code working perfect. But I would really need your help to find a way to deploy my activex to clients.

    Here is what I tried:
    1: Remove the com component from the registry on my test pc, to mimic the results of a "new" client computer. I did this with RegAsm /Unregister.

    2. Create a MSI setup project, and add the dll to the msi. Make sure to set the "Register" property on the dll/primary output to "vsdrpCOM".

    3. Run the .msi or setup.exe, and it works just great with the activex on the webpage, as it is using the CLSID to find the activex.

    4. run the .msi again and choose uninstall (to mimic a "new" client).

    5. Verify that you can't run the activeX on your page (as the com component has been unregistered)

    6. Build a new CAB setup project, and include either the dll or the .msi+setup.exe
    Set the codebase to the new .CAB file in your html file.
    It asks me to install the activex, but it doesn't do anything.
    I have set the address of the website i have my html file and cab file on to trusted sites, and reduced the security to none. However it will not install on my client.

    Can you please help? I have googled, and your page is much better than all the sites I have found.

    please contact me at: jonas.lewin@gmail.com.

    ReplyDelete
  3. Before any Thing U ar using IIS Virtual Dir to View the Page??

    ReplyDelete
  4. Hi Tiwari,

    Could you please let me know, whether i require .net to be installed as pre-requisite on client side.

    This infoemation was really useful to me. :)
    Keep on posting such things.

    ReplyDelete
  5. Hi dindin,
    when I have used it Yes. I required Framework.

    ReplyDelete
  6. Hi Tiwari,
    Your example is very useful to me, but have a query below
    I'm able to view the control in HTML webpage after putting the HTML page and dll in the new virtual directory of IIS.When I tried to open the HTML page from the local path (C:\Testdir\test.html, dll also exists in the same path), it's asking for do you want to install Activex, when I give ok, and after that control is not displayed in webpage, control was shown as blank image with 'X' mark in red colour.Is it possible to view the HTML page without IIS support. My understanding is dll will be downloaded to client machine and get executed like Activex.My client machine has .NET framework and IE version is 8

    Thanks,
    Mani

    ReplyDelete
  7. Hi,

    Try to find guid id of your activeX and The use in object tag if u want use abosulte path.

    http://msdn.microsoft.com/en-us/library/ms537508%28VS.85%29.aspx

    chk the above link it has given good explaination about activeX

    ReplyDelete
  8. Hi,

    I have to build a popup for taking a screenshot. This popup functionality is called by a button from webserver. So is ActiveX the only choice?

    ReplyDelete
    Replies
    1. No You may use Ajax.. if u want communicate with web server it is far my easier to Implement.. Juts google Ajax or Jquery ajax etc

      Delete