Re: Free Beer!!
From: Jim Carlock (anonymous_at_10.10.com)
Date: 02/29/04
- Next message: Alec S.: "Re: ? submenus in systemmenu"
- Previous message: Alec S.: "? submenus in systemmenu"
- In reply to: John: "Re: Free Beer!!"
- Next in thread: Frank Hickman: "Re: Free Beer!!"
- Reply: Frank Hickman: "Re: Free Beer!!"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 29 Feb 2004 00:07:22 -0500
Perhaps you can help me here, then. Is it easy to implement an .OCX
file into C++?
I'm a bit behind in my C++ studies, and I just read that to use a DLL
inside C++, one needs to include a header file and a library file (.h and
.lib). I was thinking well, that might be similar to VB but in VB, to use
any of the windows DLLs, you just need to set up the appropriate
Declare statement to get a function to work.
I don't have a clue on how to connect to an .ocx through C++. I don't
think I've ever seen a header file for an .OCX or a .LIB for it. All I know
is Microsoft used to have a term called OLE Automation that is now
called ActiveX.
The .LoadFile method uses a FQ pathname to open the file, and the second
parameter is 0 for rtfRTF or 1 for rtfText.
I imagine the control when drawn needs several properties set:
.Name 'a string to uniquely identify it "rtb"
.Left 'twips, typically set to 30, 60 or 90 on a form
.Top 'twips, typically set to 30, 60 or 90 on a form
.Height 'twips, 1440 per inch
.Width 'twips, 1440 per inch
.Visible 'this normally defaults to true when drawn in VB
The units of measurement for those is typically twips, 1440 twips per inch.
I would think Visible would default to true, but I don't know how that
applies when being called through C. True is always non-zero in VB. If
you're comparing True to a number, though, True is -1 in VB (16-bit). I
think that means the highest order bit is set. I've never really had to
focus
on the bit mappings. <g>
The .SelLength, .SelStart are both numeric positions of the selected text.
.SelText returns the selected (highlighted) string in VB. Note, VB tends
to encode everything as ASCII or ANSI rather than Unicode. So when
writing to files, the text is encoded as 8-bit characters rather than 16-bit
Unicode characters.
I'm clueless right now on how to reference an ocx file through C.
-- Jim Carlock http://www.microcosmotalk.com/ Post replies to the newsgroup. "John" <John@john.net> wrote in message news:en00c.423657$xy6.2449773@attbi_s02... Thanks for the info. I got it working in vb pretty good but I wanted to implement in c++ and am got stuck on the find function. It doesn't want to work no matter what I set for the supposedly option start, end and option arguments. CComVariant vStart, vEnd, vOptions; //vStart.cVal = 0; //vStart.vt = VT_INT; //vEnd.vt = VT_INT; //vEnd.cVal = 100; // vOptions.vt = VT_INT; // vOptions.cVal = 4; m_RTF.SetHideSelection(FALSE); m_RTF.SetFocus(); long lReturn = 0; lReturn = m_RTF.Find("(2)Landlord first name",vStart, vEnd, vOptions); if(lReturn == -1) AfxMessageBox("Not Found"); "Jim Carlock" <anonymous@10.10.com> wrote in message news:uOg$lFc$DHA.3500@tk2msftngp13.phx.gbl... > The richtx32.ocx has 5 classes built into it: > > DataObject > DataObjectFiles > OLEObject > OLEObjects > RichTextBox > > 8 Interfaces: > > DRichTextEvents > IOLEObject > IOLEObjects > IRichText > IRichText10 <-- based on rich text control 1.0 > IRichText11 <-- based on rich text control 1.1 > IVBDataObject > IVBDataObjectFiles > > and 14 Enums. > > It's backwards compatible all the way back to Win95. Maybe earlier. > > If you need any help configuring or using it let me know by replying > to the newsgroup here. Basically through BASIC, you'd mark it as > being referenced, VB puts a little tool icon in the Toolbox to draw > the object on forms. It has all the standard stuff... Left, Top, Height, > Width. There's a RightMargin that is used to set the wrapping if you > are going to use it to print. The files it creates are 100% readable > through Word, and it can create and read regular text as well rtf. > > -- > Jim Carlock > http://www.microcosmotalk.com/ > Post replies to the newsgroup. > > > "Jim Carlock" <anonymous@10.10.com> wrote in message > news:O4UWYRX$DHA.3536@tk2msftngp13.phx.gbl... > richtx32.ocx it the control. > > -- > Jim Carlock > http://www.microcosmotalk.com/ > Post replies to the newsgroup. > > > "John" <John@john.net> wrote in message > news:kyK%b.417207$xy6.2355026@attbi_s02... > I got this to work > > Set Obj = CreateObject("Word.basic") > Obj.FileOpen "c:\leasedatabase\lease.rtf" > > 'Obj.EditSelectAll > > Obj.SetSelection "(2)Landlord first name" <--doesn't work > > Where can I get a list of commands I can use, I'd like to replace with > '(2)Landlord first name' with a text value I'll obtain later. > > Thanks > > > "John" <John@john.net> wrote in message > news:V8K%b.407505$I06.4419065@attbi_s01... > > Hey Thanks. > > I was thinking vb may be the way to go simply because the rich edit > control > > I loaded in my c++ project seemed to be geared toward it. > > > > Vb isn't my forte but I'll give it a try. > > > > Where can I get rtb?? > > > > None of my guesses for what rtb is have the loadfile function > > > > Private Sub Command1_Click() > > OLE1.LoadFile "c:\leasedatabase\lease.rtf", rtfRTF > > Text1.LoadFile "c:\leasedatabase\lease.rtf", rtfRTF > > End Sub > > > > I tried to create an object on the form using the rtf file and it appeared > > to work however I don't see any selection based functions nor replace text > > functions. The object showed up on the form as OLE2 > > > > Thanks > > > > > > "Jim Carlock" <anonymous@10.10.com> wrote in message > > news:OCjezeS$DHA.2308@tk2msftngp13.phx.gbl... > > > rtb.LoadFile "filename.rtf", rtfRTF > > > rtb.SelStart = iPosStart > > > rtb.SelLength = iLengthSelected > > > rtb.SelText = strNewText > > > > > > If the file to be loaded is a RichText File, set rtfRTF to rtfRTF, > > > otherwise set it to rtfText for text files. > > > > > > Where iPosStart is the starting position in characters. > > > > > > iLengthSelected is the number of characters to select starting from > > > iPosStart. > > > > > > Setting .SelText is the way to set the property that replaces the > existing > > > text. > > > > > > Done. HTH > > > > > > -- > > > Jim Carlock > > > http://www.microcosmotalk.com/ > > > Post replies to the newsgroup. > > > > > > > > > "Jim Carlock" <anonymous@10.10.com> wrote in message > > > news:uuTyVRS$DHA.2800@tk2msftngp13.phx.gbl... > > > It is very easily accomplished in VB6. > > > > > > -- > > > Jim Carlock > > > http://www.microcosmotalk.com/ > > > Post replies to the newsgroup. > > > > > > > > > "John" <John@john.net> wrote in message > > > news:1Nr%b.402652$I06.4379868@attbi_s01... > > > Now that I've got your attention... (well it was funny on the simpsons) > > > > > > I'm looking to open a text file and replace parts of it with my text. I > > have > > > looked at the find and replace methods but they all seem to be tied to > > > dialogs which I don't need nor want to code the back end functions. > > > > > > If anyone could provide me with some working code that'll do a non > dialog > > > based (or at least don't show the dialog) search and replace based on > > > parameters I pass on a rich text file I would definately buy them some > > beer > > > or soda if they're under 21. > > > > > > Btw this is not a student project but a project I'm doing for friend. > > > A project I figured would be easy but has turned out more challenging > than > > I > > > thought. > > > > > > Thanks alot > > > > > > > > > > > > > > > > > > > > > > >
- Next message: Alec S.: "Re: ? submenus in systemmenu"
- Previous message: Alec S.: "? submenus in systemmenu"
- In reply to: John: "Re: Free Beer!!"
- Next in thread: Frank Hickman: "Re: Free Beer!!"
- Reply: Frank Hickman: "Re: Free Beer!!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|