|
you will need to register the DLL using regsvr32, use oleview to get an idea about what interfaces are available, this tool come with visual studio
you should know how to create and use a com object
Yours Truly, The One and Only!
|
|
|
|
|
kcynic wrote: How could I find the other content so that I can use the dll(or COM component)?
OleView Application will Help
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
Thank you every one.
I will have a try,but if there is some other problems I hope I can gain some help here agin.
Thanks again
|
|
|
|
|
Hi all,
I've got the source code and compiled binary for a c++ class library, and I'd like to be able to instantiate & use the class in a c# application. What's the simplest way to do this? I've looked up resources, but they all appear to me more complicated than my basic level of understanding of MS C++ will allow to be helpful to me.
Can someone point me to a very simple recipe (and hopefully simple explanation too) on how to turn this unmanaged class into one which c# can use?
Also, will there be issues about "return data type matching" between c++ and c#?
Thanks,
cdj
|
|
|
|
|
You may want to post your question(s) on the C# board[^] as well!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
We'll see how it goes here; if necessary, I will.
Thanks!
|
|
|
|
|
Well the person I know would have an answer replied here so...cool!
Good luck!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
sherifffruitfly wrote: I've got the source code and compiled binary for a c++ class library, and I'd like to be able to instantiate & use the class in a c# application.
Then you need to compile it into a DLL, either COM or just standard. You can in both cases easily import your DLL into C# ( the plain dll via a p/invoke signature for each method you want to call ), but the COM way allows you to create class instances, p/invoke does not.
sherifffruitfly wrote: Also, will there be issues about "return data type matching" between c++ and c#?
If you use COM, then the IDE will fix that for you, if you use a dll, then you need to work it out for each method, for both return values, and values going in.
By far the most intelligent thing to do is to make your code managed, so you can create class instances and fully interact with them in C#.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want instances, so I guess the COM compilation is what would be helpful. I'll look up how to do that.
The way I did it, I believe it's "just standard":
#ifndef DllExport
#define DllExport __declspec( dllexport )
#endif
...
class DllExport {...}
Thanks for the suggestions!
|
|
|
|
|
Hey, I want to write some status variable to the registry HKLM\Software. This works fine with admin privileges but not with user privileges (and VISTA UAC). Where can I store values for all users in registry or should I use files (e.g. counter for a trial period)?
Please help me...
-- modified at 12:45 Saturday 21st July, 2007
|
|
|
|
|
You can use the All Users\AppData dir - call SHGetFolderPath(CSIDL_COMMON_APPDATA) to get the path.
|
|
|
|
|
|
Hi all. Suppose i were to have a long input from a socket.
<quote>
connected to server: something.host.com : etcetera
Instead of trying to compare the entire string of characters, how would i break it up so that i can only compare a certain string, for example the 'something.host.com' string? This is a std::string too.
|
|
|
|
|
I don't know about any specific APIs to do this, but you can always use the find/rfind/substr
methods to parse a std::string.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I wrote a string parser and posted the article here, and a STL version of the class is included.
http://www.codeproject.com/string/cstringparser.asp[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello everyone,
I have built MSDN OLE DB Sample Provider and successfully built/debug it using Microsoft Excel as client. I have found that in DllGetClassObject (classfac.cpp), the class SampProv is initialized as the 1st coclass, then DataSource object will be created in QueryInterface.
http://msdn2.microsoft.com/en-us/library/ms715011.aspx
The entry point of a COM server (like this Sample OLE DB Provider) is creating a coclass through DllGetClassObject. My question is, how did Microsoft Excel find the entry point coclass of the OLE DB Provider is SampProv coclass?
I have this question because Excel is a client with no knowledge about any specific application defined CLSID, like SampProv, how could it be aware of this ID (i.e. Excel knows nothing about 3rd party application's specific name of entry point coclass)? In Windows registry, I can not find any related information indicating that SampProv should be the entry point coclass either.
thanks in advance,
George
|
|
|
|
|
Hi, i am having much frustration with this one...
I have a dialog based app in which I want to register its window.
I have tried putting the AfxRegisterClass( ) code inside the InitDialog( ) function, but this has not been successful - at best it just doesn't do the registration, at worst (when I've parred down WINDOWCLASS items (.style, .icon, .cursor) i have got a run time warning about a resource is unavailable.
I am using Studio 6.0 and the utility Spy++ to see if my dialog's window is indeed given a class name - it's not.
I need to register my dialog app so that I can send it messages from another app via PostMessage(window-name, class-name)
Any help?
Thanks!
|
|
|
|
|
You are trying to register an already registered window... which is wrong. Also, the point that after registering a window you would be able to PostMessages to it, is also wrong. PostMessage does nothing with registeration. A window need to be registered in order to be used. If it is already in use, then you can do a PostMessage or SendMessage to it if, of course, you have the HWND of that window.
--
=====
Arman
|
|
|
|
|
Dialog's use a pre-defined window class that we don't have access to.
You can register a class but there's no way to create a dialog window of that class.
You could add a custom, private window property to the dialog's window that other apps can look
for.
You can also make the dialog modeless and a child of a frame window - for the parent frame window
you can register a class and create the window of that class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey thanks! I like this reply better than maybe those that have just posted the acerbic definition answer.
In Spy++, i see that my dialog based app has Class name of #32770 (or something like that). But then again there can/are numerous "#32770" classed-windows out there at anygiven time and thus makes my "FindWindow(classname,title)" pretty much useless.
On that note too, "title" can't be assumed in my case as the app is putting a dynamic string in "title" for differernt operational conditions. for me.
I guess I will have to study another way of Posting messages to this dialog based app (too much involved for re-write to frame window....)
Thanks again,
Johnny
|
|
|
|
|
I have a video chat project.I use DirecxShow to capture video frames and udp to translate the video data.In the project,I use WM_TIMER message(using SetTimer() of cource)to capture a video frame and send it each second.
But I find,my program exhaust almost all the CPU recouce up to 98 percent or more.
And in another hands,I had a look at other video chat products,they only using 1 to 3 persent of CPU.
Some body would tell me why,and how to resolve it?
GOOD LUCK
|
|
|
|
|
Are you spinning in a loop on a thread somewhere?
What is the timer interval?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes,I spinned in a loop on a thread to retrieve data packages from network.But I have no choice.(client).
In the timer,I capture a video frame and send it each second.
|
|
|
|
|
In that loop, are you using sockets? If so, are you using a blocking socket that blocks until
data is received? If not then that will use nearly all your CPU.
For the timer, that's one frame per second? Interval is 1000 milliseconds, right? If so, then
that takes about zero CPU
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In the loop, I think it uses none-blocking socket.In fact,I use a RTP socket to do such thing.(JRTPlib.lib,I think you do know it).
I am sorry,for timer,I capture a video fram and send it each 200 millisecond.
|
|
|
|