|
Hi:
Regular DLL: Allows you to use any MFC classes and functions, but you can only exports "C" functions.
MFC extension DLL: Allows you to export Classes that you can derive from in your client app.
hope it helps
regards
Daniel Cespedes
"There are 10 types of people, those who understand binary and those who do not"
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Thanks, that's the answer i was lookig for.
~dzenan~
|
|
|
|
|
I have a COm framework where I have two classes A and B that service requests based on their respective queues .
for e.g life Sequence for Class A is as follows :
1.Class A object created
2.AddedToQueue_A event created as nonSignalled .
3.Worker thread within Class A created .
4.CLass A QUEUE is empty hence Worker thread is blocked with the call:
ResetEvent(AddedToQueue_A)<br />
WaitForSingleObject(AddedToQueue_A,INFINITE);
5. When a request is added to Queue(Enqueue) a call is made to awaken the thread like :
SetEvent(AddedtoQueue_A);
6. Thread A is awakened and the request is serviced .
Similar is the case of Class B object
Observations :
1. With Class A object present and when there is no Class B object the thread is awakened properly and the queue is serviced .
2. With Class A and CLass B objects present , the observation is that though an entry is added to the Queue of class A , Class A thread is not getting awakened everytime for some reason .the thread gets awakened every alternated time when the Queue size =2;
My question is that is the blocking statement
WaitForsingleObject() associated with the thread priority . Why isnt Class A's thread being called everytime I Set the event while enqueuing ?
|
|
|
|
|
I don't entirely get your design, but I guess it doesn't matter, because:
ResetEvent(AddedToQueue_A)
WaitForSingleObject(AddedToQueue_A,INFINITE); is fundamentally flawed. Let me explain. Suppose a request is enqueued into A when worker thread A is servicing a prior request and before it has completed to do so. When the worker thread fininshes, it resumes waiting, but before that it calls ResetEvent(AddedToQueue_A) : the signal is lost and the thread sits here waiting for ever (or until another request with more lucky timing gets in).
Instead, create AddedtoQueue_A as automatic (see the docs for CreateEvent ) and do not use ResetEvent . Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you for your insight .
I made the modification but still find that my thread (Class A)gets awakened every alternate request (i.e Queuesize=2) . This behaviour is absent when the other thread of class B is absent .
here is a snippet of my thread operation
while(threadNeedstorun){<br />
if(queueSize>0){<br />
}<br />
WaitForSingleObject(AddedtoQueue_A,INFINITE)<br />
}<br />
<br />
here is the snippet of my Enqueue operation <br />
<br />
if(queueSize<MAX_QUE_SIZE){<br />
<br />
array[(head+queueSize)%MAX_QUE_SIZE]=newVal;<br />
queueSize++;<br />
<br />
SetEvent(AddedtoQueue_A) <br />
}<br />
|
|
|
|
|
OK, this kind of stuff is always somewhat messy. Try this. Define a CRITICAL_SECTION , say CS_A (don't forget to initialize it with InitializeCriticalSection ), create AddedtoQueue_A as manual and use the following for incrementing and decrementing the number of elements in the queue:
void DecrementElementsInA()
{
EnterCriticalSection(CS_A);
--queueSize;
if(queueSize==0){
ResetEvent(AddedtoQueue_A);
}
LeaveCriticalSection(CS_A);
}
IncrementElementsInA()
{
EnterCriticalSection(CS_A);
++queueSize;
if(queueSize>0){
SetEvent(AddedtoQueue_A);
}
LeaveCriticalSection(CS_A);
} Think this sould do. Please report back, regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I may be making a rash statement here, but this looks like a job for a semaphore, rather than an event.
Create a semaphore with an initial count of 0 and a huge max count (LONG_MAX or something like that). Each time a writer puts something in the queue, it calls ReleaseSemaphore. The reader(s) wait on the semaphore and remove one item from the queue each time they wake up.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
Hi,
I was told to run these lines of code in order to instantiate a class I have that is derived from CFrameWnd (CLogViewFrame):
<br />
CRuntimeClass* pRuntimeClass = RUNTIME_CLASS( CLogViewFrame );<br />
CObject* pObject = pRuntimeClass->CreateObject();<br />
ASSERT( pObject->IsKindOf( RUNTIME_CLASS( CLogViewFrame ) ) );<br />
It compiles nice, but now, how do I access my class, how do I reach it's methods ? Non of the pointer created, can lead me to my class.
Shay
|
|
|
|
|
pObject points to your class, you just have to type cast it.
CLogViewFrame *pLogViewFrame = dynamic_cast<CLogViewFrame *>(pObject);
ASSERT (pLogViewFrame); Untested code.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Cooooooolllllllll !!!
thanks !
|
|
|
|
|
Hi,
I have a VB ActiveX DLL, how can I add it to my VC++ project?
Its very easy in the 6.0 version, but I have trouble with .NET !!
Ehsan Behboudi
|
|
|
|
|
Hi,
Whe I used my CListBox on a dialog and wanted to scroll it programatically, I used:
<br />
list_box.SetAnchorIndex (pivot+18);
list_box.SetSel (pivot-1);<br />
<br />
<br />
But when I used CListBox as a view inside a CFrameWnd it does not work anymore, it always shows the selected line at the top.
???????????/
Shay
|
|
|
|
|
OK OK
I found it alone,
Apperantly the SetSel, scroll the view back to the top.
So what I did was to swap between the commands and now it all works
Good for me
|
|
|
|
|
God, I'm hoping some of you can help me here. I need DIRECTION.
I want to create a .NET application. I want to use C# language since it seems good for rapid application development.
I want to create the user interface (GUI) using the Visual Studio IDE form design.
Tell me if the following is possible:
I want to use DirectShow AND the Microsoft Speech .NET SDK in the SAME application. How can I do this? All the DirectShow examples are written in C++. All the .NET speech examples are written in C#.
Can I write the bulk of my application in C# and use C++ only for the DirectShow portion of it? Is this possible too?
Also, I'd like to "skin" my application, or in the very least give it some "personality" with rounded buttons and some custom controls that I create myself. Can I still use the Win32 API and "layered" windows to skin a GUI created with the "forms" wizard in Visual Studio? Is there any other way of creating that "custom" look?
I'm new to this stuff and I'm really confused. What's worse, is that I read all kinds of stuff about "managed code" and how DirectShow does not use managed code... DirectShow is built upon COM objects.... .NET allows one to mix managed and unmanaged code in the same application.... blah blah blah.... HELP!!!
All I want is some direction and advice on what to do 1st, 2nd, 3rd... I just don't know where to start... I don't want to read a 400 page book on ATL and COM if I'll be using C# which hides the COM internals... you know what I mean? HELP!!!
|
|
|
|
|
Brian JR wrote:
I just don't know where to start
A possible alternative to using DirectShow may be to use the Windows MediaPlayer ActiveX control, which may simplify the development process, but assumes all you want is fairly standard playback. If you do need to use DirectShow, start with the SDK samples, try playwnd for playback of a file. From personal experience, DirectX programming and DirectShow in particular takes a while to get used to - if you've got the time to spend learning it or after testing you know you need better performance, it's brilliant, otherwise look for a quicker solution.
Brian JR wrote:
I'd like to "skin" my application
Keep in mind that the "custom look" and "skinning" are quite different areas to DirectShow - many articles on CP can help you in this area.
Brian JR wrote:
I read all kinds of stuff about "managed code"
I haven't played much with managed extensions, but that board may be a more appropriate place to ask that question. MSDN mentions the Microsoft.DirectX.AudioVideoPlayback namespace, and there seems to be stuff for C# available.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_m/directx/ref/ns/microsoft.directx.audiovideoplayback.asp[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thanks for the advice. I appreciate it.
Still doesn't seem that I'm further ahead than before. All the examples I've seen so far use the Win32 API to generate a GUI for DirectShow - this is not what I want. Since I'm starting out, I'd like to pick the "right" GUI platform, or perhaps something a bit easier to use. I like the "forms wizard" in C# in Visual Studio 2003. I want to stay away from MFC and WTL, if I can.
What does "CP" stand for?
Do you think it's possible to write the application in C#, use the C# forms wizard for the GUI, and wrap all the DirectShow stuff into managed code?
Seems like this is going to be a bigger challenge than I originally thought.
|
|
|
|
|
Brian JR wrote:
What does "CP" stand for?
CodeProject.
BTW, you can use unmanaged API's from C# just as easily as from C++.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
thanks.... think I'm getting closer to my answers... thank God for the internet... and these forums...
|
|
|
|
|
OK. I found this type library for DirectShow: Seems like no one else has taken this approach in all the articles I've read so far. Do you know why?
http://www.kohsuke.org/dotnet/directshowTypelib/
Does this type library solve my problem of working with DirectShow in .NET? So I can use this type library to do MC++ and C# programming?
Brian
|
|
|
|
|
Anyone know how to detect whether the user has large fonts in Windows XP? I use the following code in 2000, but it doesn't work at all in XP:
float ItemTemplate::getFontProportion()
{
static int normalSize = 96;
int size = 96;
HWND window = ::GetDesktopWindow();
if(window)
{
HDC dc = ::GetWindowDC(window);
if(dc)
size = ::GetDeviceCaps(dc, LOGPIXELSX);
::ReleaseDC(window, dc);
}
return size / (float)normalSize;
}
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Hello, I am new to C# and ASP.NET, I have previously used ASP.
Inside my C# codebehind file, I open a database and get out
information. Now depending on that information I would either go to
the start page or show a text box and button for more information.
How do I move to another page without the action="page.aspx"
attribute? How do I pass information from C# like the user name to
C++ inwhich is using a HtmlView?
|
|
|
|
|
Hi,
I have an app that has a few modeless windows....I have a menu that allows the user to bring up a couple of these windows individually. My problem is that one window has an options that when selected brings up one of the previous windows. I want it to set the focus to the opened window instead of creating a duplicate. I thought i had a solution but it doesn't work.
Can someone help me please? THANKS in advance.
Here is my code. I thought this code would work but it doesn't.
if (m_pStats== NULL)
{
m_pStats= new CStats;
if (m_pStats->Create(IDD_STATS) == TRUE)
m_pStats->ShowWindow(SW_SHOW);
}
else
m_pStats->SetActiveWindow();
|
|
|
|
|
If your modeless dialogs are bell behaved, then they auto-delete in PostNcDestroy . The problem is that m_pStats will be non-NULL even after the window it formerly pointed to has gone into oblivion. You can try the following approach. Define a CStats ** member into CStats just like this:
class CStats
{
...
CStats ** m_myself;
}; After calling new CStats and before Create use m_myself to let the window know about the variable pointing to it:
if (m_pStats== NULL){
m_pStats= new CStats;
m_pStats->m_myself=&m_pStats;
... Now, in PostNcDestroy you can take advantage of this variable to set m_pStats to NULL :
Void CStats::PostNcDestroy()
{
*m_myself=NULL;
delete this;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
While Joaquin brings I up a very good point I have a different suggestion. Instead of m_pStats->SetActiveWindow() try m_pStats->BringWindowToTop() and then m_pStats->SetFocus().
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Toni,
This does not do anything different from what I had. Do you have any other ideas....it is beginning to drive me crazy to have all these duplicate screens.
Thanks again for your help
|
|
|
|