|
How to sort the rows of CListCtrl depanding upon Particular column. Or Please tell me how to use CListCtrl::SortItems function for sorting.
|
|
|
|
|
Hi Anil,
you need to create a callback function that will be called each time the two items in the list control need to be compared.
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lParamSort);
BOOL SortItems(
PFNLVCOMPARE pfnCompare,
DWORD_PTR dwData
);
Pass a pointer to the sort items function for the callback function.
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
_AnShUmAn_ wrote: BOOL SortItems(
PFNLVCOMPARE pfnCompare,
DWORD_PTR dwData
);
The above function internally sends the LVM_SORTITEMS message.. I found the LVM_SORTITEMSEX message is more easy to use than LVM_SORTITEMS .
U can use ListView_SortItemsEx Macro to send LVM_SORTITEMSEX message
nave
|
|
|
|
|
anilksingh wrote: How to sort the rows of CListCtrl depanding upon Particular column.
Provide a HDN_ITEMCLICK handler. In that handler function, the column that was clicked is:
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
m_nSortColumn = phdn->iItem; Now call SortItems() .
anilksingh wrote: Or Please tell me how to use CListCtrl::SortItems function for sorting.
Be sure to call SetItemData() when adding items to the list control.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi all,
I found out that when an application spools another application, the child application inherits some of the attributes of parent such as, security attributes, process attributes etc..
Is there any way to remove all this inherited attributes? So that it runs as if it was launched from the explorer.I want to do it from the child application
nave
|
|
|
|
|
Naveen R wrote: Is there any way to remove all this inherited attributes?
Are they inherited by the child process? Are you sure?
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Nibu thomas wrote: Are you sure?
yes..
In my case there is a service.. From that service it executes another application(Child application). Since services have several limitations, all that limitation gets applicable to the child application also. I want to get ride of it..
Any way?
nave
|
|
|
|
|
Naveen R wrote: Is there any way to remove all this inherited attributes?
Sure. Several of the arguments to CreateProcess() do just that.
Naveen R wrote: I want to do it from the child application
Do what?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Thanks David Crow,
I am in situation that I cannot modify the binary of the exe the calls CreateProcess(). But I can change the Child application( the application that is been created using Createprocess).
DavidCrow wrote: Do what?
I want to remove the parent property inheritance from the child application. I want to write that code in Child application.
nave
|
|
|
|
|
Naveen R wrote: I want to remove the parent property inheritance from the child application. I want to write that code in Child application.
To my knowledge, there is no parent/child relationship when creating processes. A "child" process is on its own as soon as its created, and the "parent" can immedialtely be shut down without any ramifications to the "child." Those arguments that are passed to CreateProcess() are just used to get the process started. Onced started, that process is free to change them to other values.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
In my case there is a service.. From that service it executes another application(Child application). Since services have several limitations, all that limitation gets applicable to the child application also. I cannot even interact with the desktop from the child process.
Plz tell me how to change this behaviour
nave
|
|
|
|
|
Hello,
I have a file representing the content of a chipcard. I want to integrate this data in my EXE, without referencing an external file. I try to create a user defined binary resource. But how can I paste the content of the file in the binary resource editor of Visual Studio 7.1?
Thanks in advance for your hint!
|
|
|
|
|
Nolyann wrote: But how can I paste the content of the file in the binary resource editor of Visual Studio 7.1?
Thanks in advance for your hint!
Just put the data in a file, add a RCDATA type into the .rc file like:
IDR_RC_DATA1 RC_DATA DISCARDABLE "c:\\folder\\file.dat"
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Thanks David for your answer.
But in this case the file file.dat has to be delivered with the EXE file of the application, and I would avoid that.
I use another method, until someone gives a better suggestion : since I can save the chipcard data in hex representation I declare a char array initialised with this data. But I hoped there is a quicker way using the resources...
|
|
|
|
|
Nolyann wrote: But in this case the file file.dat has to be delivered with the EXE file of the application, and I would avoid that.
Ok, see if this article helps.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi David,
I read your article with interest, but I decided to keep the solution of defining an array initialised with the binary data I want to embed, which I find simpler for my goal.
Thanks for your answers again.
|
|
|
|
|
1)When I add following statements in my code =>
IMpeg2Data *pMPEG = NULL;
hr = pMPEG2Demux->QueryInterface(IID_IMpeg2Data,(void**)&pMPEG);
it is giving me error as follows =>
Linking...
aDlg.obj : error LNK2001: unresolved external symbol _IID_IMpeg2Data
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...
What should i do? Is there any library missing. I have added libraries "Strmiids.lib Quartz.lib Dmoguids.lib" & also i have added "#include <mpeg2data.h>" header file.
2)When i tried to add following statement =>
IMpeg2PsiParser* pMpeg2Psi;
it is giving error as =>
error C2065: 'IMpeg2PsiParser' : undeclared identifier
|
|
|
|
|
My question is quite simple but I can't solve it. I have create a socket tcp, how can I know when the socket go down due to external cause?
For example when the network is down etc....
Use members like CAsynchSocket::OnClose, isn't correct because this member is called only when my application close the socket!
...however how can i do?
Thanks to all!!
|
|
|
|
|
CAsyncSocket::OnClose() is the function that should be overridden for this purpose.
One of the error codes that could be represented with the nErrorCode parameter is WSAENETDOWN.
I suspect that there would be some kind of a timeout before a net down state is detected.
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
I have tried to use it, and for test, I unplug the utp cable and OnClose() wasn't called...Have I to set some particular option when I create the socket??
When I start the socket I only do this:
if (!m_pSocket->Create())
throw 1;
// Connect to our destination.
if (!m_pSocket->Connect(strAddress, port)){
throw 2;
|
|
|
|
|
Sorry, I misunderstood you. :->
I thought you meant that you want to detect a net down state when you're are closing the socket.
I don't think it's possible to detect a net down state using sockets if you're not operating on socket. Each operation will fail if the net is down with WSAENETDOWN.
Of course it could be detected if you use some kind of keep-alive messages that are periodically sent on the socket. The Send operation will fail in such case.
Hope this helps
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
Ok I suppose that i have to set with setsockopt the keep alive message....and after i control the nErrocode in OnSend is it correct??
however thanks a lot for the answer!!!
-- modified at 5:59 Friday 5th May, 2006
|
|
|
|
|
I try to use setSocketOpt with options SO_KEEPALIVE in socket intialization phase. I stay in OnSend and Control the nErrorCode but OnSend is never called!!
|
|
|
|
|
TCP does not offer you quick detection of all kind of connection interruptions... it was designed to survive network interruption, what you are looking for is a application specific keep-alive mechanism, connection test or timeout.
It really depends on the application what you need. E.g. for a simple file server it could be enough to close the socket when no data has been sent/received for a while. For an interactive application you may want to test the connection in regular intervalls. Fo example have first an OnClose() to detect when a socket is reported down and secondly send periodically some bytes to the remote socket.
Hope it helps. A good book to read is 'Effective TCP/IP Programming'.
/M
|
|
|
|
|
I can't provide a complete solution but something you can perhaps look into.
You could separate your drawing in two parts (in your OnDraw function): first, draw everything on a DC (member variable of your class), then copy everything to the view DC (using StretchBlt function). The first part doesn't take in account the zoom (you just draw everything on the DC), but with the StretchBlt you can enlarge or compress the image (it's done automatically if the sizes are not the same). So it is up to you to calculate the new size of the image (depending of the zoom factor).
Then, you need also to update the scroll bars sizes (using SetScrollBar) according to your zoom factor (and of course update the scroll position).
You'll have to search a little bit but I think this can achieve what you are looking for.
|
|
|
|