?
Solved

Object-Oriented Question, and "Methods", and Installable modules.

Posted on 2003-11-26
10
Medium Priority
?
301 Views
Last Modified: 2012-05-04
To: Object-Oriented Wizards:

RE: module ->  loadable/intallable module(s)

I have a question relating to Object-Oriented programming.  I am versed in "C", but not in  Object-Oriented programming.  In surfing the web, I have noticed that you can installed modules into "C..." or in "VB" environments and so forth for ease of work.  These modules contain many callable routines that the user can call upon instead of using a DLL file.  Using these modules, you get away of declaring each DLL routine(s) you use.   I was told by a Computer consultant that these "loadable/installable" modules are the way to go, and that they are written in an Object-Oriented language, I suspect/could be written in "C"....

I would like to ask/request some workable examples(hopefully) in "C" that would show me how this is done.  Examples meaning:     .
          1)  how is this module is setup, to do the following:
              a) construct and syntax and etc.    
              b) is there an initialization section.
              c) how can I use existing "C" routines.
              d) I am trying to get away from using  DLL(s).
              e) I would like to load/install this module into my VB6 environment for ease of  
                   programming.
          2) what programming environment is needed.
          3) de-install this module.
          4) and etc...
 So with all of this and other things and thing that I do not know that required, I would ask for working examples of a working module with examples of simple examples of routines being called from, say from a VB app.   I know I am asking a lot, but how many points do you request to complete this task?   I would like to learn so that I could learn from and build my own module.   I have plenty of points to work with, thanks in advance.
Are these modules that I speak of, are they OCX's???  If not what?

  Thanks,

  midnightexpress
    November 26, 2003
0
Comment
Question by:midnightexpress
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 3

Expert Comment

by:monkesdb
ID: 9829297
erm.

firstly, i'm not sure but i think this should be in the Visual Basic section

secondly, in VB you can create a module by clicking on File > New... > Module
every function, sub and variable you declare inside the module will be visible in any program which contains it. so to use it again just add it to your project.

you can, of course, create ActiveX DLLs which are pretty much the same but you need to reference it in the project references.
but you don't want to use dlls, so never mind that.

if i'm on the wrong tracks then please clarify the question
0
 

Author Comment

by:midnightexpress
ID: 9840635
To: monkesdb

You are on the right track somewhat.  I would like to create this installable/loadable module in "C".  Because "C" is a general platform.  From what I have researched, is that it is a ActiveX DLL.  This ActiveX DLL has public functions within and then becomes "Class modules" and I guess these are called "Methods".  But have then have a graphic pull down menu with a list of routines to choose from. And then after you type 'anobjectorientedname.';  and so after you type that period - that is where this graphic pull down menu pops down and you can choose which function you want.  Then after choose the function; the parameter(with characterisitcs) help kicks in for the user to fill( syntax help) in the right variable data type.   Also, have within it, a function that sees' if it has the correct passvalue which in turns lets the functions be used - if not prompt for it and have it registered in the registry.   Can you build it genericly where it will fit any MS platform environment.   A lot of these ideas that I have mentioned, comes from MSVB and MSVC - they have these installable/loadable modules in them. I have used these modules in MSVB.    How can this module be loaded in MS programming environments, genericly.   I learned how to build a generic MS DLL File, and call it from MSVB.   I would like to have this project built, but I don't want to sound rude or demanding.

 Does this make any more sense??  I think it might.    But also have this installable/loadable module have the option of deinstalling itself.    Please refer to my initial question for details.
As for points, if you feel that this project is work more points - please let me know much more.  I use these points for learning and have learned some new ideas and tools.
Thanks(TIA),

 MidnightExpress
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9879408
What VB call Modules, C++ calls ActiveX/COM DLLs.
In VB, using this modules is as easy as using Win32 APIs in in VC++  BUT (alas!) in VC, using COM modules is a right pain in the behind.  Judging from your question, you will have a steep learning curve.

The VC++ AppWizard and ClassWizard simplify the task somewhat.  See this for the world's shortest tutorial on creating an ActiveX and calling it from JavaScript.  Calling it from C++ is much more complicated, but the journey of a thousand miles starts with a a single step (onto an airplane:)

      http:/Cplusplus/Q_20777689.html#9631159

-- Dan
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:midnightexpress
ID: 9892900
Thanks,  DanRollins:

 Okay,  I have a bunch of routines written in std ansi "C".  I know I can write a OCX/ACTIVEX in MSVB, BUT...,  How can I marry/merge the routines that I have written in "C" with VB and make a VB ACTIVEX/OCX and it will work! and be functional with all other windows programming environments???  Because I do not want to re-write the "C" routines in VB.  Because VB does not have some nice features the "C" does.   I look forward in hearing from you.  Thanks(TIA).

Midnightexpress
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9893449
I think you can make a .LIB file of the C functions and then use the VB "Declare" function to access them from VB.

    Public Declare Function MyFn Lib "Mylib" ( Long n ) As Long

I've done this with a DLL, but not with a .OBJ file or a code in a .LIB file.   Someone in the VB section will know for certain.

Anyway, most people who ask this do so because they think there will be some tremendous s-speedup by using C code.  That turns out to not be the case most of the time.  VB is slow in some things, but those things are the same ones that C is slow in doing.  The next most common reason is that the asker thinks that C will be able to do things such as low-level disk access or calling BIOS functions.  But those kinds of operations are prevented by the Operating System -- not the langiuage itself.

So, what are you trying to accomplish?  What kinds of functions are in the C library that you want to access from VB?

-- Dan
0
 

Author Comment

by:midnightexpress
ID: 9900853
Declare: an ACTIVEX/OCX module as ACTIVEX

 I have some "C" already written, and are with a (non MFC) DLL File (which works).  Currently
     I have a VB program that drives the all of the functions contained within the DLL file that I
     have made.  The DLL "C" routines are simple "C" functions.

 I am trying to build a ACTIVEX, in which - within this ACTIVEX module,   ?Methods?
   1) it is registered within the registry
   2) there is no need to declare any functions used.
   3) you type in the function and then type in the left parenthesis, you get parameter
          information help, meaning parameter syntaxial help- for each parameter till finished.
   4) a registration feature, which the user must enter a keycode for the activex module to
         work.
        also put in a back door feature for debugging and testing.
   5) check the above messages for additional items.
   6) make activex module useable in all MS programming environments.
   7) Put in an about box and help areas call via a menu - if possible?.

  If I can make a VB activex module/file, and use my "C" DLL routines;  how do I do it?
    If so, what is the function call module(that the user calls) set up and within that module,
       show me how I can call one of the DLL functions contained there in.

  Thanks for the fast reply, I hope to hear from you soon.  Thanks for your help and hope you
      can help me out.   Thanks(TIA).

   If you need more points to do the project, please let me know how much more.

   midnightexpress
0
 

Author Comment

by:midnightexpress
ID: 9900856
The last message from Midnightexpress is for DanRollins.  Thanks.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 1000 total points
ID: 9900991
VC++ does provide a way -- using the AppWizard and ClassWizard -- to generate an ActiveX module that does what you desire, including self-registration... as I described here:    http:#9879408

However, doing *all* of that, including the ability for the VB IDE to "intellisense" (fill-in parameters, etc.) is probably difficult... and there would be other parts of the system that are just much harder to program in C/C++.

The best technique would be to make your ActiveX object in VB... use the VB IDE to create the complete do-nothing 'stub' of all functions that you want other programmers to be able to access -- but none (or only some) of the real funtionality.

Then you can edit the VB procs and make direct calls into your C code, using the

        Declare Function MyFn Lib "Mylib" ( Long n ) As Long

style declarations.  This is akin to what a VB programmer needs to do when calling Win32 API functions.  Only in this case, you are calling the function in your own C module.

-- Dan
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10286178
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: DanRollins {http:#9900991}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question