|
bkelly13 wrote: I looked up _countof and discovered the return type is not declared anywhere. If you look closely you will see that it is a macro which invokes the sizeof() operator, so it returns the same type as that.
bkelly13 wrote: The various versions of ...printf. The functions with the _s suffix and the buffer length parameter will avoid the crash by giving you an error return or ASSERT if you attempt to overwrite the buffer, so these functions should always be used for safety. The old "unsafe" versions are part of the base C libraries and remain for backwards compatibility. As you so rightly say, they should not be used any more.
You can trap any ASSERT s that may be raised by adding your own handler as described here[^].
It always pays to read the documentation (including any linked pages) thoroughly. Not that I do so very often.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
dose any one know how to mirror system image list , iam developing RTL application on LTR windows xp , so i want to mirror image before setting listctrl so it will not look upside down ,
her what i did so far and i failed :
CMFCToolBarImages toolBarImage;
SHFILEINFO sfi;
UINT nFlags = SHGFI_SYSICONINDEX | SHGFI_ICON ;
HIMAGELIST hIL = (HIMAGELIST)SHGetFileInfo(szWindows, 0, &sfi, sizeof(sfi), nFlags);
CImageList* list = CImageList::FromHandle(hIL);
HBITMAP bitmap = list->GetImageWell();
toolBarImage.MirrorBitmap(bitmap,32);
any idea or small hint will be appreciated ?
asdasda
|
|
|
|
|
Environment: Windows 7, Visual Studio 2008, MFC, CPP
Two questions:
1. How does the asynchronous notification get back into the program?
2. What is the purpose of the class MyEchoSocket?
Details
I am working my way through the tutorial socket Programming with MFC (Part 1), written by Jobin Wilson and found on this website here:
Socket Programming with MFC (Part 1)
I am good through the point where the server calls the Listen() method. There is no client at this time and the code paused for a second or so then continues. My server class has the base class: CAsyncSocket so I presume the OS will eventually send a notification as to when a client connects. What part of the code says to the OS, when the client connects, call function X?
The next operation is to call the Accept( <argument uncertain=""> ) method. Under topic Accepting Connections Wilson suddenly uses m_sConnected as the argument to Accept without explanation. Looking at the downloaded code I think this is an instance of his class MyEchoSocket. But all he does with that class is call methods from the base class CAsyncSocket. Why not just call the CAsyncSocket methods directly?
Edit: The link did not work for me. Try again. I think it is Ok now.
Edit 14 Sep 2012
I think I am beginning to understand.
For question 1:
The programmer must override a set of methods from the base class. These include OnAccept(), OnConnect(), OnReceive(), etc. Windows calls these methods when the event has happened.
For question 2:
When the server code runs, it initiates a listen activity, Windows is listening for a client to connect. When one does, skipping some stuff, an instance of the class written to handle the traffic is created and put into action. That would be an instance of the MyEchoSocket. That class then performs all the sends and receives with the client. Meanwhile, the original server object is fee to go back to listening for another client connect.
No one has posted a reply and this is what I think is supposed to happen. I am still working my code. Please jump in if you have any corrections or comments.
Thanks for your time
modified 14-Sep-12 22:00pm.
|
|
|
|
|
The call to Listen is opening a socket for your server and it basically says "I'm interested in new requests..."
All that is happening at this point is some state has been setup.
The call to accept is actually where the connection is made. The variable m_sConnected is the variable that will receive the new connected socket. Notice how the rest of the calls made if Accept() succeeds are performed on m_sConnected .
In the meantime, m_sListener is still there ready to accept more connections. So if you start another client and then call Accept() with another socket variable, you would have two active client sessions in your application.
All of my software is powered by a single Watt.
|
|
|
|
|
I used AfxGetThread()->m_nThreadID to get the thread ID in my code I get a thread ID, and if I use GetCurrentThreadId() at the same line of code and I get different thread ID. Which one is correct?
Thanks,
Kishore
|
|
|
|
|
I think, AfxGetThread() gets threadId after start of main thread after getting duplicate of handle of thread, because own handle is pseudohandle.
I thing real threadId is from API version of GetCurrentThreadID.
But... same thread would has to have same threadId. It's weirdness
|
|
|
|
|
In VC6 when I use
std::abort(); I am geting an error "error C2039: 'abort' : is not a member of 'std'". But it compiles well in VS2010. I am seeing the definition of abort in both version of stdlib.h. What is the problem?
|
|
|
|
|
The problem is that stdlib.h does not define the std namespace, it is the standard C library header. You should include cstdlib for use of the std namespace features.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Even after including cstdlib, I am seeing the same error.
|
|
|
|
|
Difficult to guess without more information; take a look at the header file to see how it is declared.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Throw VC6 in the bin, it's long past its useby date.
Steve
|
|
|
|
|
Thanks. Yes, That's right! we are slowly moving to VS2010. But at this point of time we are in a situation to use
std::abort(); in both VC6 and VS2010. This compiles well in VS2010 but my concern is why its not in VC6. Any idea would be helpful.
|
|
|
|
|
Why not just use abort() ? Adding the namespace prefix buys you nothing.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Ok. Sorry for not explaining that the code piece 'std::abort()' is part of third party and we cannot modify it.
|
|
|
|
|
Then contact the third party and tell them to fix it. I assume that you have paid for this code in which case it is their responsibility to provide a fully working solution.
With the amount of information you have provided about this code it is difficult to make any better suggestions.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thanks for your help.
I found a soultion to this problem.
#if _MSC_VER <=1200
namespace std
{
using ::abort;
}
#endif
This way we can make 'std' namespace to refer global abort(). It doesn't require to modify 3rd party.
|
|
|
|
|
Hi, Is there a way to print file inclusion stack/order in VC++6.0.
In VC10, we can print file inclusion stack in debug window using /showIncludes compiler switch. But same switch is not recognized in VC6.
|
|
|
|
|
hi every one this is my first post here in fact i'm confused little bit cause i got to finish a project that i haven't started yet i need to capture image with directshow
in fact i haven't understand directshow very well it's questions and pin ... difficult to grasp for the first time .
the second point if i need a window in which i have to put my components should i create it by hand (from scratch by code ) IVideoWindow ?? and what about list & button ??
let me know
|
|
|
|
|
mexmerou wrote: i haven't understand directshow very well There is nothing much we can offer except to study the documentation[^] and to use Google to search for samples and tutorials.
mexmerou wrote: the second point ... is not very clear, perhaps you could give some more detail about how your application will be built.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
DShow isn't as intimidating as it looks
You create an IFilterGraph, add the filters you want, then create a ICaptureGraphBuilder2, point it at the IFilterGraph, and ask it to RenderStream
You don't really have to worry about pins unless you intend to write your own source or transforms
As regards IVideoWindow, yes, create your own child window and point IVideoWindow at it
There are numerous examples kicking around
|
|
|
|
|
|
|
This is noit a valid question for the ATL forum, please try Collaboration & Beta Testing[^], or one of the "rentacoder" forums.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Sorry Richard,
It seems the mentioned forum is a better place for my question.
I tried to edit my post and move it to the other forum but I couldn't.
Isn't this possible?
Should I repost my question and delete this one?
Thanks,
Paul
|
|
|
|
|
I think only the administrators can move it. Just repost the entire message to the other forum, then edit the one here and replace the content with a note that you have moved it.
One of these days I'm going to think of a really clever signature.
|
|
|
|