creating an activex control

This is a discussion on creating an activex control within the Windows Programming forums, part of the Platform Specific Boards category; How may I create an activex control without using the Wizard. I don't want to use the wizard because it ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    161

    creating an activex control

    How may I create an activex control without using the Wizard. I don't want to use the wizard because it creates files that I don't need. The control I want to create all it requires is some api's like CreateWindow and other window api's. This control I want to create is like a syntax highlighting control. I've tryed in vb. I did it. But I couldn't make fast algorythms because I cant use string pointers. Thus if I use pointers to array's of string and use the polytextout api I can do what I wan't at a very highspeed.

    How may I get started on making an activex control in C++ without using the wizard?

    Thanx in advance!

  2. #2

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I just scanned the page you posted and I thought I should note a couple of things:

    1. Code does not include a type library or IDispatch support. It also uses non-automation compatible types such as char *. This means, as is, it will not work in VB, script or any language that is not C or C++.

    2. The code is for a COM object and not an ActiveX control. That is, it can not be embedded in a form.

    EDIT: Chapters 10 and 11 refer to creating an ActiveX control.
    Last edited by anonytmouse; 12-01-2003 at 09:50 PM.

  4. #4
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    I've done it quite a while ago to me...
    If you want maybe can I find the sources of my Ax component, it was a true embedded component (which did nothing though...) but it is written in pure assembly using MASM's Intel x86 syntax *without* the high level stuffs. Besides it is commented in French.

    anonytmouse >
    Well, for the non-automation types, I don't remember what types could be used...
    But for the COM stuff, OLE is just a COM component that implements some specific interfaces and for someone who starts from nothing, he should learn how to do COM programming before trying to do OLE programming...

    benzakhar >
    Well, anyway, if you don't already know about it, read The Journals of Captain COM by Sean Baxter.
    http://spec.winprog.org/

  5. #5
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    Thanx lix.

    I have read the first part of COM. When I read the whole first part it explained almost everything. I have a question, in this part of the code;

    DLL_HW.IDL
    [
    uuid(49FFDAE0-E465-11d2-A0FA-00E0291D8B19),
    helpstring("Sean's Test Automation Library"),
    version(1.0)
    ]

    What is uuid()? And how do I know what characters to put inside the bracket of uuid?

    Thanx in advance!

  6. #6
    Semi n00b Mithoric's Avatar
    Join Date
    Jun 2003
    Posts
    293
    UUID stands for Universal Unique Idetifier.

    http://www.dsps.net/uuid.html

  7. #7
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    You must acquire a tool called guidgen, uuidgen or something...
    It is provided by MS as part of the VS. If you don't have them, I can send it to you.
    Actually, this utility is supposed (I can't certifiate it is true) to create really unique ID for each component, at least, they won't mess with the system ones.
    And also, don't always use the GUID generator, often, only a digit is incremented by one for each class of a same component.

    Oh, and if you don't see what is GUID really, it is the thing you use when creating a component with the API. CLSID and things like that...

  8. #8
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    Thanx everyone!

    C++ is amazing. I just made an DLL in c++ witch then I registered (compiler does that outomaticly). I opened VB and I saw my DLL in the Reference. I loaded and tested and it worked. I say C++ is amazing because when in VB a person has this part in the code;

    I = mydllmodule.Property

    I have the reference of "I". And I can set "I" to be equal to where it is located in memory or anything I want.

    Before I go make ActiveX controls. May someone please answer these questions;

    1. How can I make a method return something.
    2. How do I transfer a string from VB to my function and vice versa I get errors when I try to do this.

    Thanx in advance!
    Last edited by Benzakhar; 12-05-2003 at 07:05 PM.

  9. #9
    Registered User
    Join Date
    Jul 2003
    Posts
    32
    Hey.

    1)Just declare the method as returning something else than void.
    2)Well, there's a discussion here. But I'd probably just confuse you, so you better check the MSDN reference.

    There are at least two types of string handling, one of them is specific to Automation and that's the one you need (in the VC++ part). As for VB, read the page titled "Passing Strings to a DLL Procedure". It's located in Component Tools Guide \ Accessing DLLs and the Windows API.

  10. #10
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    >1)Just declare the method as returning something else than void.

    Thats not true. The function should return if there is an error or not. If error then it should return an error code. See Visual basics error codes. To return something else other then nothing(sub) then the declaration must be as follows
    Code:
    HRESULT myClass::MyFunction(parameters, [out, retval] returndatatype *var)
    {
    *var = what to return;
    return error? errorcode : S_OK;
    }
    Last edited by Benzakhar; 12-29-2003 at 06:34 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 10:38 AM
  2. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  3. using the ActiveX control
    By jverkoey in forum Windows Programming
    Replies: 3
    Last Post: 04-10-2004, 07:44 PM
  4. Can't I reduce the default size of Activex Control (rcBounds)
    By samudrala_99 in forum Windows Programming
    Replies: 1
    Last Post: 10-23-2002, 10:24 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21