473,385 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Think I need a COM/VB expert

Is what I have below anywhere near correct?

Will DirectCast do a QueryInterface?

Would you do it differently?

Thanks for any help

'Applications can retrieve an ITextDocument pointer from a rich edit
control.

'To do this, send an EM_GETOLEINTERFACE message to retrieve an IRichEditOle
object from a rich edit control.

'Then, call the object's QueryInterface method to retrieve an ITextDocument
pointer.

'Dim mITextDocument As tom.ITextDocument

Dim mREOleInterface As Object

WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE, IntPtr.Zero,
mREOleInterface)

mITextDocument = DirectCast(mREOleInterface, tom.ITextDocument)


Nov 20 '05 #1
5 2095
Direct cast should be able to cast an object to any known type. Have you
tried this ?

Regards - OHM

" SamSpade" <st**************@REMOVEaol.com> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...
Is what I have below anywhere near correct?

Will DirectCast do a QueryInterface?

Would you do it differently?

Thanks for any help

'Applications can retrieve an ITextDocument pointer from a rich edit
control.

'To do this, send an EM_GETOLEINTERFACE message to retrieve an IRichEditOle object from a rich edit control.

'Then, call the object's QueryInterface method to retrieve an ITextDocument pointer.

'Dim mITextDocument As tom.ITextDocument

Dim mREOleInterface As Object

WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE, IntPtr.Zero, mREOleInterface)

mITextDocument = DirectCast(mREOleInterface, tom.ITextDocument)

Nov 20 '05 #2
Direct cast should be able to cast an object to any known type. Have you
tried this ?

Regards - OHM

" SamSpade" <st**************@REMOVEaol.com> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...
Is what I have below anywhere near correct?

Will DirectCast do a QueryInterface?

Would you do it differently?

Thanks for any help

'Applications can retrieve an ITextDocument pointer from a rich edit
control.

'To do this, send an EM_GETOLEINTERFACE message to retrieve an IRichEditOle object from a rich edit control.

'Then, call the object's QueryInterface method to retrieve an ITextDocument pointer.

'Dim mITextDocument As tom.ITextDocument

Dim mREOleInterface As Object

WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE, IntPtr.Zero, mREOleInterface)

mITextDocument = DirectCast(mREOleInterface, tom.ITextDocument)

Nov 20 '05 #3

"One Handed Man ( OHM#)" <news.microsoft.com> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
Direct cast should be able to cast an object to any known type.
Is an interface an Object? I mean, SendMessaage probably simply returns
a reference to the interface in mREOleInterface. I don't think, for example,
mREOleInterface.ToString would work ( as it should for all Dotnet objects.)

Or is a Dotnet object variable simply a reference to an interface?

Have you tried this ?

I believe it works. But I also think putting mITextDocument
in the sendmesasage also seems to work.

Dim mITextDocument As tom.ITextDocument
WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE,
IntPtr.Zero, mITextDocument )

What does DirectCast do? Can it cast an integer into a single,
and actually changes the contents of memory. Or does it not change
the contents but causes the variable type to change (like from a
Char to an Byte.)

How would it know when it needs to call QueryInterface?
Maybe that is how it casts an interface?
Thanks

Regards - OHM

" SamSpade" <st**************@REMOVEaol.com> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...
Is what I have below anywhere near correct?

Will DirectCast do a QueryInterface?

Would you do it differently?

Thanks for any help

'Applications can retrieve an ITextDocument pointer from a rich edit
control.

'To do this, send an EM_GETOLEINTERFACE message to retrieve an

IRichEditOle
object from a rich edit control.

'Then, call the object's QueryInterface method to retrieve an

ITextDocument
pointer.

'Dim mITextDocument As tom.ITextDocument

Dim mREOleInterface As Object

WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE,

IntPtr.Zero,
mREOleInterface)

mITextDocument = DirectCast(mREOleInterface, tom.ITextDocument)


Nov 20 '05 #4

"One Handed Man ( OHM#)" <news.microsoft.com> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
Direct cast should be able to cast an object to any known type.
Is an interface an Object? I mean, SendMessaage probably simply returns
a reference to the interface in mREOleInterface. I don't think, for example,
mREOleInterface.ToString would work ( as it should for all Dotnet objects.)

Or is a Dotnet object variable simply a reference to an interface?

Have you tried this ?

I believe it works. But I also think putting mITextDocument
in the sendmesasage also seems to work.

Dim mITextDocument As tom.ITextDocument
WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE,
IntPtr.Zero, mITextDocument )

What does DirectCast do? Can it cast an integer into a single,
and actually changes the contents of memory. Or does it not change
the contents but causes the variable type to change (like from a
Char to an Byte.)

How would it know when it needs to call QueryInterface?
Maybe that is how it casts an interface?
Thanks

Regards - OHM

" SamSpade" <st**************@REMOVEaol.com> wrote in message
news:Os****************@TK2MSFTNGP12.phx.gbl...
Is what I have below anywhere near correct?

Will DirectCast do a QueryInterface?

Would you do it differently?

Thanks for any help

'Applications can retrieve an ITextDocument pointer from a rich edit
control.

'To do this, send an EM_GETOLEINTERFACE message to retrieve an

IRichEditOle
object from a rich edit control.

'Then, call the object's QueryInterface method to retrieve an

ITextDocument
pointer.

'Dim mITextDocument As tom.ITextDocument

Dim mREOleInterface As Object

WinApi.SendMessage(RichTextBox1.Handle, Rtf.EM_GETOLEINTERFACE,

IntPtr.Zero,
mREOleInterface)

mITextDocument = DirectCast(mREOleInterface, tom.ITextDocument)


Nov 20 '05 #5
Is what I have below anywhere near correct?
Looks like it, yes.

Will DirectCast do a QueryInterface?


Yes.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nikolay Bogolioubov | last post by:
Anybody knows where can I get a good "intermediate to expert" level C++ questions list. Need about 500 questions. Appreciate any ideas.
3
by: SamSpade | last post by:
Is what I have below anywhere near correct? Will DirectCast do a QueryInterface? Would you do it differently? Thanks for any help
10
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
9
by: SA SA | last post by:
Hello i am not PHP expert - i need help big time. i am having issue with PHP session i think. I have two page login.php and admn.php As name implied login to log in to admin page manage...
0
by: onegative | last post by:
G'day Y'all, I was hoping to get some expert feedback on a proposal I am considering regarding a new internal application to help fill some gaps in our IT department. I have some configuration...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.