|
Can any body tell me how can i inerface with any COM object? I know GUID/CLSID of he object.
I am new with COM Object.
|
|
|
|
|
The easiest way is to #import the COM object and use __uuidof to generate instances. If you google __uuidof, you're bound to find heaps of examples. Remember, the objects need to be registered on your machine, if you just have been given them as files, you can't just dump them in a folder. regsvr32 is the command line command to register a COM object. If it's installed with something ( like Office ), then this has been done for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
There are various libraries that provide classes (and such) to make dealing with COM easier like ATL and the compiler provided COM support classes. Given that you haven't provided much info on this I'll point to at some APIs/interfaces:
CoInitialize - To initialize COM on the current thread.
CoCreateInstance - Create a registered COM object given a CLSID.
IUnknown::QueryInterface - Get an interface on a COM object given its IID.
IDispatch - For dispatch interfaces.
If you're not driving IDispatch interface you will need to have a header file so you can call the methods on the interfaces. There are many ways to do this:
- Use one that comes with the component or SDK
- Use #import
- If you've got an IDL file, use MIDL to make one.
- Use a tool like OleView to make one.
Steve
|
|
|
|
|
But i have no idea of working with IUnknown. I read so much about this interface in MSDN.
|
|
|
|
|
IUnknown has only three methods:
QueryInterface : Get an interface on an object.
AddRef : Call when you copy an interface pointer.
Release : Call when you destroy an interface pointer.
I think you should read a good COM tutorial.
Steve
|
|
|
|
|
Hi,
To start COM application, you have to know some thing about COM and Interfaces.
In VC++, we can do it two ways 1. Using MFC and 2) Using ATL libraries.
ATL is simple and wizard faced. All interfaces creation and registration take care by ATL wizards.
But in case if MFC, you have to inherit a class from CCmdTarget and create a interface also from IUnknown and IDispatch based upon your need.
If you are going to work with on languages like VC++, VB etc then IUnkonwn is enough. But if your COM should support with script languages like VB script, Jscript then You shound use IDispatch.
To create simple MFC COM, please go through the below MSDN link..
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncomg/html/msdn_house2.asp
best of luck
regards
Vallikumar A
|
|
|
|
|
We're making an add-in .dll to inventor.
After a user select some features, for example a circle or some lines, in the whole 2D sketch,we want to show only the selected ones in a dialog at once.
For the selected features may overlap with others ,what we can do to the selected features?
Appreciate for any info
|
|
|
|
|
I foegot to mention that all we do is the development of inventor-a 3D drawing software similar to AutoCAD.
We just use its API to achieve the select function.But don't know about the display thing.
|
|
|
|
|
I have no idea what inventor is. Either way, I'd suggest finding a forum dedicated to coding for it, so you're talking to people who are on the same page as you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a class A, which is a dialog having a CEdit box with CString
variable "m_Edit".
I have another class B having a CString variable "str" declared in it.
Now i want to make a call like this,
CString str = m_Edit;
This is to be done inside class B. How can i get the Edit box value in
class A to class B CString "str".
I tried a few things but couldn't make it work properly.
Can anyone got any suggestions.
Thanks in advance
|
|
|
|
|
easiest way is to define a function in ClassB which accepts a pointer to a CEdit
i.e
<br />
void CClassB::FixEdit(CEdit* pEdit)<br />
Then in that function you can set the text to the string
i.e.
<br />
<br />
void CClassB::FixEdit(CEdit* pEdit)<br />
{<br />
pEdit->SetWindowText(m_str);<br />
}<br />
How you call this up to you - but for example in the contructor of ClassA you could do the following
<br />
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1); <br />
<br />
CClassB* cb = new CClassB();<br />
cb->FixEdit(pEdit);<br />
You could make the function static then you would not need to instantiate the CClassB but that's up to you - likewise you could create a function which would take a CEdit pointer and you could then read the contents of the Edit Box instead
|
|
|
|
|
I think your m_Edit variable declared as public. otherwise make it public.
then you should create an object for class A, inside class B.
Like this
A objA;
then do the assignment statement...
CString str = objA.m_Edit;
regards
Vallikumar A
|
|
|
|
|
I making a program that should print a file (.html) when the user presses a button.Which functions or controls do I use,and how do I implement them?
Tnanx
|
|
|
|
|
I think the easiest way would be to load it up in MSHTML and get it to print it.
Steve
-- modified at 18:26 Monday 16th January, 2006
ADDED:
Look up the IDM_PRINT command and IOleCommandTarget .
|
|
|
|
|
Have you considered ShellExecute() with the "print" verb?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I stand corrected - Your way is much easier.
Steve
|
|
|
|
|
nice one .
0x0400:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
Need a help to finish this programme
It needs and IF and Do/while Loop
The program will simulate the calculation of an employee’s net wage
The calculation is based on wage amount and tax code
Request the following:
Employee Name
ID Number
Wage
Tax Code
The Valid tax code are S and C. S for self-employed and C for company employed. If incorrect code is entered, the program should ask again.
Tax is calculated is following. Self-employed >27,000=25%
between 27, 000 & 20,000 = 23%
<20,000, = 20%
Company Employed
>29,000>24%
between 29,000 & 18,000 = 22%
<18, 000, =10%
finally, the programme should print a report detailing the employee's name ID and net wage.
Any help would be gratefully accepted
|
|
|
|
|
If you need help to finish it you should have STARTED.
What have you done so far?
What specific problems have you encountered?
Why didn't you pay attention in class?
Why do you expect busy developers to do your homework for you?
;P;P
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I have the first bit written. it was stupid of me to write all of that. Just lost on the tax bit at the end.
Never, under any circumstances, take a sleeping pill and a laxative on the same night.
|
|
|
|
|
Hi,
Assuming I want to read the data that goes into a file w/o actually accessing the file on the disk. Could that be done if I know the name if the process which is writing the files and the file name ?
Basically, I want to look for some keywords in the file but I want to catch them while they are written w/o the need to access the file the regular way and search it.
Sounds strange , I know
Shay
|
|
|
|
|
Seems like it should be possible, but it is obviously not a trivial task. At a minimum, a device driver would need to be created.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Thx,
I figured out is would be something that "sniffed" the hardware buffers.
Shay
|
|
|
|
|
I seem to be hitting an OS limitation on the number of threads I can create yet I'm only at 1G of 4G RAM usage according to task manager's performance tab.
I'm writting a small app for stress testing which spawns a bunch of job threads. Each job uses up two threads to do its dirty work. Is there a soft limit on the number of threads I can create? A registry setting perhaps?
Todd Smith
|
|
|
|