Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing A control in VC++ for VB...

Status
Not open for further replies.

rjr9999

Programmer
Apr 7, 2001
183
US
Hey, I posted this in the Microsoft: C++ forum to no avail...I havn't seen activity there all day, I was hopeing someone here could help, or at least comment ;)

-----------------------------------------------------------

Hi, I'm a VB programmer, and I need to write a Rich Text Box control in Visual C++ (For speed isues, text manipulation in basic is bad :p). I'm not haveing any luck with it though, I used the MFC ActiveX control wizard and all I can get it to do is display an oval...I used add new dialog box, but I can't get the dialog box to display...What am I doing wrong? Can someone give me an example of how to make a Rich Text Box to display instead of that stupid oval? Any help is appriciated. Oh, one more tidbit, I'm also somewhat fluent in C...not C++, so I know how to do the actual text manipulation, I just don't know how to call the text object from the RTB...like in basic it would be RTB.text...how is this done in VC++?


Rob
"Programming is like art...It makes me feel like chopping my ear off."

 
In your ActiveX MFC Control you should add a property named "Text" like this (in VC++):

1. Open ClassWizzard (with ctrl+W)
2. On Automation Tab Select Add Property:
3. Select Get/Set Method
4. In the external Name box write "Text"
5. Ok

Now you will have to write the two Methods GetText and SetText. From VB You will see only a property named Text, not those two methods.

Take care when you write the visual part of the SetText. I think you will have to Write with TextOut or DrawText

Ah, one more thing, as far as I know an ActiveX's DC takes the Mapping Mode of the client program so make a call to SetMapMode before write something. (I am not sure on this issue).

Hope this helps you,
s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top