|
Hello,
I'm not sure where the proper place to post this question, so I'll ask it here. I want to set up a class that has properties and sub-properties in VB.net 2008 Express.
Class | 1st Prop | 2nd Prop
Example: iClass.RFWN.OD and iClass.WF.Width
My goal is to make a class library(.dll file) that can be added to a project, which I know how to do. What I'm unsure of is how to link one public property to another. Can all the properties and sub-properties be in one class object or do they need to be in their own? Any help at all would be greatly appreciated, whether it be a small code snippet or just a point in the right direction via an online article or tutorial. I'm fairly new at this, so please, talk down.
Thank you,
Eric.
|
|
|
|
|
i had read this help content in msdn:[^]
IDiscMaster2* pDiscMaster = NULL;
hr = CoCreateInstance(__uuidof(MsftDiscMaster2), NULL, CLSCTX_INPROC_SERVER,
__uuidof(IDiscMaster2), (void**)&pDiscMaster);
but the calling would fail because class has not registered. i googled found the others use this com object like me but no problem. so, how to resolve the problem?
|
|
|
|
|
installing a windows update package with impapiv2, all problems will disappear.
|
|
|
|
|
Is it posssible to create function pointer in IDL file
|
|
|
|
|
You should consider how this function pointer is going to be marshaled. Function Call Attributes[^] might suggest a possibility.
What are you going to do with this function pointer?
|
|
|
|
|
I working on com dll in vc++(not clr)
1st Dll consist of various methods having same signature
2nd dll need to pass the funtion pointer of 1st dll method which is going to execute in 1st dll.
|
|
|
|
|
Sorry, it took so long to get back to you, I don't visit the site every day.
The reason I suggested that you consider how you want the 'function pointer' to be marshaled is that the COM Library is designed to use the RPC mechanism and a proxy/stub architecture to interact with other COM components, whether in the same process, in another thread in the same process, or even another process on a remote machine. I have no way of knowing how aware you are of COM internals,...so, I don't make any assumptions.
The COM Library performs many operations that are invisible to the programmer when you make an activation request (for instance, CoCreateInstance or DllGetClassObject), depending on the server registration and how you configure your apartments. If it's an In-Process Server, you could, hypothetically, pass a 'function pointer' to another DLL in the same process, and the address would be accessible. In practice, this is a really dumb idea. The obvious question is: why not call the method directly? If the Com DLL is in another process address space, any virtual function pointer will be invalid (this will be true even if it's NOT a COM Dll). I'm assuming that you konw all this.
Your question provides the very minimum of information, making it difficult to answer accurately.
...So, what's your point? If you want to define a 'function pointer', go ahead.
|
|
|
|
|
Hi,
I'm using Interop.SHDocVw.dll to print html files on the fly without user interaction. I managed to print if I use administrator privilege, but it will not print if I use power user privilege. There is no print job sent to printer if I user power user groups.
Do I miss some security permission settings? Or is there any COM settings that I missed out?
Thanks.
|
|
|
|
|
Im a newbie for com programming. If i create my com object by ATL wizards, the target com dll can be easily added by C# project using Add Reference operation. But, if i build my com dll by handle, writting all classes and idl file by hands, i will find it can't be added by C#. the error message says:"*** couldn't be added. Please make sure that the file is accessible,and that is a valid assembly or COM component".
Of course the target dll is a COM component! I can use it in any C++ projects successfully. Why?
Regards.
|
|
|
|
|
Its probably because the type library information is not available inside the COM DLL.
You will have to include the library information as a resource for this.
Please read the document on how this is done.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
oh, thanks for your reply. im reading the book named Inside COM. i hope i will resolve this problem when i learn further.
regards.
|
|
|
|
|
Hi,
I have problems registering an assembly for COM Interop.
There is an option in Visual studio which registers the dll after the build. If i use this option i dont have any probs accessing the managed code thru c++ code. But if i build the assembly and register it thru regasm utility it gives me error "class not registered" in my c++ client. I checked the registry values and they seem to be same in both the cases.
Any idea why this is happening?? anyone know what special VS does??
Thanks in advance.
|
|
|
|
|
'Class not registered' sounds pretty specific. Perhaps you can use one of the regasm options such as /tlb or /tlb /verbose to see exactly what it is generating without having to search around the registry.
Apparently there is a third method, though I've never used it: class InteropServices.RegistrationServices and method RegisterAssembly which might shed some light.
|
|
|
|
|
i want to Do Final(software Engineering) Project involving Com Programming plz Suggest Some Proposals...
Thanks
|
|
|
|
|
I don't want to put you off, but I can see at your first interview a prospective employer asking (rightly or wrongly) "COM is old technology, why didn't you do a project using something more modern?". I saw your post to C++/MFC. Compare the number of queries being put regarding COM and there to get an idea of the demand.
Regarding Stuarts answer there, PortMon was (is) great for Serial Comms so a USB alternative has potential. You'll benifit in your grading if you can show a demand for what you've coded.
|
|
|
|
|
hi...
i am new to serial port programmming...my problem is as folloes...
i have to write a command to a plc connected to my serial port of windows os and then read the data from the same serial port.both read and writre take place continously for every one minute..how do i go about doing this...i am programing using c..
is there any code available for this??
|
|
|
|
|
This is the wrong forum for this.
The COM here means Component Object Model and not COM1, COM2 etc.
Anyway, you can use
HANDLE hComm = CreateFile(L"COM1", GENERIC_READ|GENERIC_WRITE, ...
Then you can use ReadFile(hComm, ... to read from the port.
And WriteFile(hComm, ... to write to the port.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi
I want to find DispIds of procedures of Excel 2007. I am able to find out for following
**************************
MSExcel::AppEvents
--------------------------
WorkbookOpen
WorkbookBeforePrint
SheetChange
WorkbookActivate
SheetSelectionChange
--------------------------
but for
MSExcel::DocEvents)
SelectionChange
I am not able to find out.
Please let me know how to find out these DispIds for this.
Thanks
SNI
|
|
|
|
|
Hello all
I am getting the form objects from internet explorer and want to get all the elements from each form. To do this, I get the form collection from the html document object, get an interface to each form element in the collection then try to get an IID_IHTMLElement interface from the IID_IHTMLFormElement interface in order to get all the elements in the form, as recommended by MS. It all works on my machine and all others I've tried, except that on my friend's pc, the QueryInterface call fails with E_NOINTERFACE. I'm not that proficient in COM, so I wonder if there is something I'm doing wrong here so that it only works on some systems. He assures me that he has IE7 installed so not an old cranky version. Code as follows:
bool ret = true;
CComPtr<IHTMLElementCollection> spForms;
long numForms = 0L;
CComPtr<IDispatch> spDisp;
HRESULT hr = spDoc->get_forms(&spForms.p);
if (FAILED(hr) || !spForms)
{
ret = false;
}
if (ret)
{
HRESULT hr = spForms->get_length(&numForms);
if (FAILED(hr))
{
ret = false;
}
}
if (ret)
{
for (int formNumber = 0; ret && (formNumber < numForms); formNumber++)
{
BSTR bstr;
CString formName;
CComPtr<IHTMLElementCollection> spElements;
CComPtr<IHTMLFormElement> spFormElement;
CComPtr<IHTMLElement> spElement;
long numElements = 0L;
CComVariant vIdx(0, VT_I4);
HRESULT hr = spForms->item(CComVariant(formNumber), vIdx, &spDisp.p);
if (FAILED(hr) || !spDisp)
{
ret = false;
}
if (ret)
{
HRESULT hr = spDisp->QueryInterface(
IID_IHTMLFormElement, (void**) &spFormElement.p);
if (FAILED(hr) || !spFormElement)
{
ret = false;
}
}
if (ret)
{
hr = spFormElement->get_name(&bstr);
if (FAILED(hr))
{
ret = false;
}
}
if (ret)
{
HRESULT hr = spFormElement->QueryInterface(!!!
IID_IHTMLElement, (void**) &spElement.p);
if (FAILED(hr) || !spElement)
{
ret = false;
}
...... etc
}
}
}
|
|
|
|
|
It doesn't sound as if there's anything wrong with your code. E_NO_INTERFACE is technically not a failure, it's a legal response in the COM world. I've had users 'assure me' that nothing out of the ordinary is installed or used when it proves not to be the case. Can you put in some checks in your code to test for the right version of IE or perhaps a version number or similar for the FormElement that you get the E_NOINTERFACE from? Does it support some alternate interface, say IHTMLElementEx? I'm not saying there is such a thing as an IHTMLElementEx interface, it's just a possibility.
|
|
|
|
|
Hi
I called him tonight and got him to check the IE version. It is version 7, same as mine. I also asked him to disable all add-ons temporarily but got the same problem. If we both have IE7 and add-ons are not the problem, what other difference could there be on his system that means he gets the E_NOINTERFACE and I don't?
|
|
|
|
|
I suppose it depends on what he has loaded up in IE at the time.
For any COM error such as E_NOINTERFACE you can look for extended error information that may have been set when the error was generated:
IErrorInfo* pErrInfo = NULL;
HRESULT hr = GetErrorInfo(0, &pErrInfo);
Then use the IErrorInfo methods to obtain details, though there may be no info set to retreive its worth a try.
You may have the same IE7, but presumably you may not have the same forms or elements etc. All I can suggest is have the program get details of the object that returns E_NOINTERFACE to see if you can find anything out based on that information or establish a pattern.
It may be that in an ideal world all objects would implement this interface but in reality it means that you have to accept that there are objects out there that don't for some reason. As a result you have to handle the ones that don't somehow. Currently your loop exits when 'ret' becomes false for any reason, maybe you need to skip that element and move on to the next (or something similar), storing its details etc.
|
|
|
|
|
Thanks for that. I'll try the extended error info to see what it shows me. You're right - it should skip onto the next one if it fails instead of aborting completely.
Both of us are using the same web page to test the program, specifically mailzone.onetel.net.uk which is a simple page containing a single form with a text input element and a password input element. It doesn't seem to matter what the page is though as mine always works and his always fails whatever web page I've chosen. It should be possible to get an interface to an IHTMLElement from the IHTMLFormElement according to the MS documentation, but it won't work on his pc.
|
|
|
|
|
when you delete a file in explorer, you can later undo the delete (restore) the file.
even when you start a second instance of the explorer, the menu with the undo command is updated
correctly in both instances.
i think internaly the shell uses ONE IOleUndoManager.
when you make changes to directories and files (copy, delete, rename...) and use IFileOperation, then your changes are automaticly registered in the undoManager.
My question is, how can i access this IOleUndoManager?
Vista32:
i create a instance of CLSID_ExplorerBrowser.
then i get a IServiceProvider from that browser.
then i do a QueryService(services, SID_SOleUndoManager, IID_IOleUndoManager);
but i get only a E_FAIL from that..(Service not found).
Note: i also programmed a shell namespace extension and i see that the shell
uses internaly the IOleUndoManager.
in msdn i only find the interface documentation.
|
|
|
|
|
I have COM exe server and a dialog based MFC client..The code works well on the same machine..But ,when I copiede exe of the server to the remote machine and registered it and tried to call the server I'm getting Library not found error...This is my import statement..
#import "\\Remoteservername\FileServer.exe"
using namespace FILESERVERLib;
|
|
|
|