|
You can do this.
you just need to add a reference to the dll in the Proect\Property window under the COmmon Property\Refernece link.
Click to the add new reference button and browse to the you .net dll.
You can now use your dll in MFC. You should use gcnew insteasd of new for creating an object to a managed class.
Javed A Ansari
Software Developer
Hyderabad, India
|
|
|
|
|
I am using MS Visual Studio 6.0. There is no such options?
Reagards
Shiva
|
|
|
|
|
Shivarudrayya H wrote: So i want to know whether is it possible to call .Net dll in MFC App??
If yes,let me know in detail.
Yes, it is.
See here[^]
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
|
I am using Visual Studio VC++ 6.0.
But that artical is specific to Visual Studio 2005..!!
Reagards
Shiva
|
|
|
|
|
I recently got offered a job by this entrepreneur. He basically knew that I was a programmer and wanted to hire me but he had one condition: By tomorrow I am suppose to create a Visual C++ program in Visual Studio 2008 that is able to play movies and through the code chose what position (what time) of the movie to start. He doesn't care how I do it or who I ask, he just want it done.
Since I have no Visual Studio experience, (I program in Java and a little C) I tried looking around at the different options I have. I came up with 4.
1. I can use a command line through C to call window media player but then I would not be able to chose what position of the movie to start playing
2. I can use MCI but when I tried dragging the code in http://msdn2.microsoft.com/en-us/library/ms712870(VS.85).aspx on to my program I got compiling errors.
3. I can try using the Window Media Player 10 SDK but that seems really compilcated and I don't have the time to learn all that in a day.
4. I can try using some other open source programs or thir-party program like VLC and hope it would run.
I basically tried each of those options and I always run into compiling problems, I think I am the closest with MCI but I am not sure. I am jsut very stump right now as I realize if only I have time to learn VIsual Stuido 2008, how easy and fun it would be to make Windows program. Can anyone give me any hints or advice on how to solve this problem? I would be very grateful.
Thanks
PS: I use Windows XP
|
|
|
|
|
|
use DirectShow it is very easy to learn and in couple of hours
you will be able to play the movies on window platform
Rajesh
|
|
|
|
|
You can use of MCI function,they can show video files.
|
|
|
|
|
how to get the import library from the .dll file
actually I dnot have the source code of the .dll file
Trioum
|
|
|
|
|
Where was this dll,it doesnt have any Readme?
|
|
|
|
|
actually it is third party dll . they send me the sample application
that use run time loading of .dll i.e. using getprocaddress ()etc.
that is very hard I donot want to use this. thats why I am asking for
import libary .
Trioum
|
|
|
|
|
Ask the third party instead. It will save everybody involved a lot of pain.
Steve
|
|
|
|
|
It's not really that hard loading a dll at run time.
Just make sure your function-pointers are correct, and since they provided a sample application you can basically copy-paste the loading of the dll and functions you require. This will save you headaches if they ever send an improved dll, you will not need to rebuild your own application then.
Regards,
Davy
|
|
|
|
|
There is a wnd with a list ctrl.
And I create a thread (referenced by h ) to fill the list ctrl.
And I wrote this:
CMyWnd::OnDestroy()
{
CWnd::OnDestroy();
WaitForSingleObject(h,INFINITE);
}
I think CListCtrl uses its owner message loop to do InsertItem , so there should be no problem to block the main wnd's msg loop. Why does it block here?
modified on Wednesday, April 16, 2008 1:56 AM
|
|
|
|
|
Short answer: Because h never becomes signaled.
Longer anwser: You haven't mentioned what h is! Give us a chance!
Steve
|
|
|
|
|
followait wrote: WaitForSingleObject(h,INFINITE);
Assuming h is the handle to the thread that is filling the List items.
followait wrote: I think CListCtrl uses its owner message loop to do InsertItem
The message loop is in the same thread where the OnDestroy Message is queue as the list control is created in that thread.
followait wrote: Why does it block here?
It is actually a deadlock as InsertItem sends the message to the List View control and waiting for the message to be processed while the message loop which processes the WM_DESTROY message from the same message queue waiting for the thread that send the message.
|
|
|
|
|
Thanks, it's helpful.
Could you tell me how to solve the problem?
|
|
|
|
|
I used the code below instead of WaitForSingleObject , but block when calling WaitForSingleObject
while(TRUE) {
DWORD result;
MSG msg;
result = MsgWaitForMultipleObjects(cnt,h,
TRUE,INFINITE,QS_ALLINPUT);
if (result==(WAIT_OBJECT_0)) {
break;
} else if (result=WAIT_OBJECT_0+cnt) {
PeekMessage(&msg, NULL,0,0,PM_REMOVE);
DispatchMessage(&msg);
}
}
How to sovle it?
|
|
|
|
|
followait wrote: result = MsgWaitForMultipleObjects(cnt,h, TRUE,INFINITE,QS_ALLINPUT); if (result==(WAIT_OBJECT_0)) { //never get here
try FALSE in the third parameter, bWaitAll
|
|
|
|
|
It's ok.
But I have several threads to be waited, how to do?
Thanks.
|
|
|
|
|
MsgWaitForMultipleObjects takes array of handles
|
|
|
|
|
But when fWaitAll is FALSE , how to ensure all the threads complete?
manually?
|
|
|
|
|
May be by adjusting the array and count of thread handles when a thread is signalled.
|
|
|
|
|
Have it done, thanks very much.
|
|
|
|