|
You can catch the OnSelChangeListCtrl(...) and always keep the index of the previously selected item. Once you get that there is no selected item (when clicking under the last item) just call
ListCtrl.SetItemState(PrevSelItem, LVIS_SELECTED, LVIS_SELECTED);
|
|
|
|
|
Sorry, but I didnt find any message like OnSelChangeListCtrl() for CListCtrl.
I have captured
1) OnItemchangedList1() and
2) OnItemchangingList1()
And the scenario was like the problem I posted....
I just can get the item selected or not
Sequence of message is like
1) Previous item de-selected and
2) Current Item Selected ==> in case item is selected...
Otherwise
only 1st message.... if item is not selected (Clicked on empty area)
Any Commments on this...
Thanks for previous reply
Thanks in Advance
AmolM
|
|
|
|
|
Aamol M wrote: 1) OnItemchangedList1() and
Which is what GuyM was referring to as OnSelChangeListCtrl() . Whatever you are calling it, when the LVN_ITEMCHANGED notification is received, look at the uNewState member to see if it is LVNI_SELECTED . If so, save the item's value.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all.
I have problem new create process.
I must set paramets in command line wen I create process.
and I dont know, how to do this.
can help?
|
|
|
|
|
david bagaturia wrote: I must set paramets in command line wen I create process.
and I dont know, how to do this.
That's what the second argument is for.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all.
I have problem new create process.
I must set paramets in command line wen I create process.
and I dont know, how to do this.
can help?
|
|
|
|
|
Try the following:
CString strExeAndParams = _T("\"C:\\MyExe.exe\" Param1 Param2");
BOOL bOK = CreateProcess(NULL, (TCHAR*)(LPCTSTR)strExeAndParams, ...);
Note that the path to the executable is wrapped with \" - because if the path has as space in it (like in "Program Files"), Windows will interpret the first half as the EXE name and the second half as the first command-line parameter.
Hope this helps ...
|
|
|
|
|
|
How can I make title bar disappear from MDI Frame?
Thanx In Advance
Z.A
|
|
|
|
|
Take a look in the topic: "CreateWindow" in speciall to the flag dwStyle and dwExStyle of the VC++ Help or in MSDN.
You can combine the flags there. The default one is WS_OVERLAPPEDWINDOW (that has caption, borders and so on) you can modify it in CMainFrame (for app window) or CChildFrame (for document/view window) in PreCreateWindow. Set windows sizes, caption, remove/add style flags...
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi, I have 2 variants of usage of WaitForSingleObject. Pls tell me which one is the proper usage?
Version1:
<pre>
#include <windows.h>
#include <iostream.h>
HANDLE hEvent;
DWORD WINAPI SampleThread(LPVOID iValue)
{
int iFinish = 120;
for(int i=100;i<=iFinish;i++)
cout<<i<<endl;
SetEvent(hEvent);
return 0;
}
void main()
{
HANDLE hThread;
DWORD dwGenericThread;
hThread = CreateThread(NULL,0,SampleThread,NULL,0,&dwGenericThread);
if(hThread == NULL)
{
DWORD dwError = GetLastError();
cout<<"SCM:Error in Creating thread"<<dwError<<endl ;
return;
}
hEvent = CreateEvent(NULL,FALSE,FALSE,"Test");
cout<<"Started waiting for the thread to complete.."<<endl ;
WaitForSingleObject(hEvent,INFINITE);
cout<<"Thread Completed."<<endl ;
CloseHandle(hEvent);
}
</pre>
Version2:
<code>
// WaitForSingleObj.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
// WaitForSingleObject Sample.cpp
#include <windows.h>
#include <iostream.h>
DWORD WINAPI SampleThread(LPVOID iValue)
{
int iFinish = 120;
for(int i=100;i<=iFinish;i++)
cout<<i<<endl;
return 0;
}
void main()
{
HANDLE hThread;
DWORD dwGenericThread;
hThread = CreateThread(NULL,0,SampleThread,NULL,0,&dwGenericThread);
if(hThread == NULL)
{
DWORD dwError = GetLastError();
cout<<"SCM:Error in Creating thread"<<dwError<<endl ;
return;
}
cout<<"Started waiting for the thread to complete.."<<endl ;
WaitForSingleObject(hThread,INFINITE);
cout<<"Thread Completed."<<endl ;
}
</code>
|
|
|
|
|
In the first version the call to CreateEvent(...) should come before CreateThread(...), because the new thread might start and end before the original thread reaches CreateThread() ...
Otherwise, both are OK.
Hope this helps ...
|
|
|
|
|
It looks as if you want to know when the worker thread has finished, right?
Your first alternative waits on an event to be signalled from within the worker thread.
Note that as already advised you have to create the event before it is used or you'll be facing a runtime error eventually.
By using this technique you will be informed when the thread is about to finish. My point is that by the time the event gets signalled and your waiting function is released, the worker thread may or may not have finished completely.
You should wait on the thread handle instead, like you do in your second alternative. The thread handle will enter "signalled" state when the thread has finished completely and has been unloaded from the system.
Read more about worker threads here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks guys.. your answers really helped me. I had a doubt if I could pass the handle of thread instead of the handle of an event.
Vikas
|
|
|
|
|
Hi all:
I've heard a lot terms which talks about "mapping", but my question is in the case of dll mapping what the heck “mapping” means here? My guess in general in this scenario is that, OS first load the dll from disk to memory, and this way makes the dll has addresses, and when an executable wants to use this dll, the OS simply make a address translation mechanism in which by using the specific address contained inside executable address space itself this dll can be accessed or called, it is just a process of address translation from address in executable to dll address. If this assumption is true, how about dynamic loading, what happened to GetProcAddress()? Just get a address inside executable? And I believe this assumption applies to all the situations that I can think of in which "mapping" is involved.
|
|
|
|
|
What exactly is your question ... ??
|
|
|
|
|
Sorry, if the question is unclear, Just to reiterate, in short what "address mapping" means and does my previous assumption about it right.
|
|
|
|
|
Your assumption is correct. This is what happens when an executable calls a function from a DLL directly.
With "GetProcAddress()", the DLL is loaded to memory (and mapped to addresses) when you call "LoadLibrary()". After the DLL is mapped, the call to "GetProcAddress()" will return the address that is mapped to that specific function.
Hope this answers your question ...
|
|
|
|
|
Thanks for the reply, So, there's a address translation involved. From exe address space to the dll address space. I wonder is there any "official" reference?
|
|
|
|
|
Hi
Can anyone answer
What are the steps/procedure to convert and SDI application to MDI
Thanks
|
|
|
|
|
Personaly, I would create a new (MDI) project and copy in the relevant parts from the old project.
This is because it is not so straight-forward to convert a project from SDI to MDI.
You need to:
1. Change your CMainFrame class so that is derives from CMDIFrameWnd and not CFrameWnd.
2. Create a CChildFrame class that derives from CMDIChildWnd.
3. Assuming you're using Document/View architecture, you'll need to modify your CSingleDocTemplate to CMultiDocTemplate.
4. A few more little stuff that I can't really think of right now ...
Hope this helps ...
|
|
|
|
|
Hello,
If I have my base class files in one directory say e:\base where I have a .cpp file of the name tableframe.cpp
In the tableframe.cpp I want to include a .h file of the name MainFrm.h from the project directory say e:\planning then how do I include it. because when I try to include MainFrm.h in TableFrame.cpp I get complie error file not found.
I think the compiler is searching in the base directory.
How do I divert it to the project directory planning.
Prithaa
|
|
|
|
|
Did you insert path to Additional Include Directories on the Property of your project.
Right click on the project and select Property and on the C/C++ enter path to Additional Include Directories
|
|
|
|
|
Or, you could enter
#include "..\planning\MainFrm.h"
instead, which would tell the compiler that the include file is in e:\planning rather than e:\base
This would be more efficient if it was just this include file that is located in e:\planning. If you have lots of include files in e:\planning, it would be more efficient to use the method described by "WhiteSky".
hope this helps!
--PerspX
|
|
|
|
|
Hello,
Thanks for your replies
Prithaa
|
|
|
|