|
Thanks,
I tried this and also CreateProcess(), but my problem is i dont want the console window of the parent application. I am creating a win 32 project in visual studio 2005.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
The code I supplied (same for Rajesh's suggestion) doesn't create any window, neither console nor GUI.
|
|
|
|
|
I don't see how can you see a window when the code creates none... You have probably created a Win32 console application. You need to create a Win32 application instead.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
I want to get the "Enter" Key down notification from a ClistCtrl. I have handled the LVN_KEYDOWN but the parent window is not notified when "Enter" Key is pressed and the Parent window is notifies when all other keys are down. How can i get notified when "Enter" key is pressed.
I tried using NM_ENTER but nothing happened.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
why don't you use spy++ tool to get the notification
|
|
|
|
|
Hi ,
I want to handle the "Enter" key event on the parent window.
Do u have an idea.
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
If your list is on a dialog box you can use this trick:
In the OnOK handler of the dialog check if the focus is on your list control or not, if it is, then the user pressed the ENTER key in your list. Don't know if this aproach has any drawbacks or glitches in it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi,
thanks for your reply. Unfortunately my Listview is in CFormView. So this trick is not going to work for me. Any other method other than subclassing the ClistCtrl?.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
I'm having a problem using this function of the MFC List Control class
I've read the article : Example of CListCtrl::SortItems(...) in MSDN By Ivor S. Sargoytchev
Example of CListCtrl::SortItems(...) in MSDN[^]
And am trying out his example Callback funtion this way:
static int CALLBACK CompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
CString strItem1 = pListCtrl->GetItemText(lParam1, 0);
CString strItem2 = pListCtrl->GetItemText(lParam2, 0);
return _tcscmp(strItem1, strItem2);
}
Relevant Code:
LVCOLUMN lvColumn;
int nCol =0;
lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvColumn.fmt = LVCFMT_LEFT;
lvColumn.cx = 120;
lvColumn.pszText = ColumnHeading[0];
nCol = m_MainList.InsertColumn(0, &lvColumn);
int NextIndex = nCol;
.
.
.
TCHAR Output[50]={0};
while (<Not EOF>)
{
<Read from file a string and copy into Output>
LVITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = NextIndex;
lvItem.iSubItem = 0;
lvItem.pszText = Output;
NextIndex = m_MainList.InsertItem(&lvItem);
}
m_MainList.SortItems(CompareProc, (LPARAM)&m_MainList);
m_MainList is the Control variable for a List Control box I placed on a dialog
I put a breakpoint inside the Sort Function CompareProc and found that lParam1 and lParam2 are always 0 constantly and never increasing.
I have been told it could be a pointer issue, but I don't get it. Can anyone help?
Thanks
|
|
|
|
|
JJeffrey wrote: I put a breakpoint inside the Sort Function CompareProc and found that lParam1 and lParam2 are always 0 constantly and never increasing.
When you use the SortItems() function, the lParam1 and lParam2 passed to the CompareProc are not item indexes, but Item data corrsponding to each item in the list control. I must says its bit difficult to sort if you use the SortItems() function. Sortitems() wrapper the message LVM_SORTITEMS . But there is another message called LVM_SORTITEMSEX , which will work as you expected.
So instead of m_MainList.SortItems(CompareProc, (LPARAM)&m_MainList); , call
ListView_SortItemsEx( m_MainList.m_hWnd, CompareProc, (LPARAM)&m_MainList );
|
|
|
|
|
Thank you. That solved it.
So it's mostly Microsoft's fault then? For coming up with that stupid function?
Really. Thanks. Was working on trying to make it work for a day now.
|
|
|
|
|
You are welcome.
JJeffrey wrote: So it's mostly Microsoft's fault then? For coming up with that stupid function?
During te sorting process, the list-view contents are unstable. So in the intial versions of common control, I guess they might have felt some difficulty is passing the item indexes to the compare function.
Later from the comctl32.dll version 5.80, they added the support for the LVM_SORTITEMSEX message. They might have found some work around later..
|
|
|
|
|
For future reference, when adding items to the control, you'll also need to call SetItemData() . This is because SortItems() internally calls GetItemData() (or an equivalent) before calling your comparison routine.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I need some help here from anyone on creating a program that simulates the call traffic distributed between call center workers. I don't have a clue on how to start this one. I also need it to estimate the hold and call time for callers based on specific conditions. So is there anyone who has any clue on doing one such as this program or done something like it. I'm all ears here and clueless
|
|
|
|
|
Start reading here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
There are too many parameters to consider before you could put this on the C++ forum.
1. What technology is being used? Actual telephone lines or VOIP lines? In either case, do you already have control over them? (A TAPI library module which tracks the calls and routings in case of the former and a VOIP library module operating/controlling the call flow in case of later, what kind of hardware is used in case of later, etc.,)
2. Are client modules written and running on the nodes to track the call status (idle/ringing/on hold/busy, etc.,)
3. Are the statistics being calculated already / halfway through / yet to begin.
4. Oh wait, you just want simulation? I can go on, but what the heck!
Seriously, come back only after you have specific questions, with relevance to C/C++/MFC. Nobody is going to write an entire application for you. If you are looking for ideas, find and go off to the general discussions/project discussions forum or something similar, where it would make sense.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
My 5 for taking so much of effort and typing in 
|
|
|
|
|
I usually try and ignore such pointless questions, but sometimes I just have to vent it out.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Don't worry, he has monkeys for that.
[added]
Sorry, I wasn't aware his monkeys were scheduled on another task [^]...
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Friday, May 15, 2009 7:56 AM
|
|
|
|
|
On the other hand, he may not know what you're talking about.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Well monkeys are monkeys, after all. Moreover I suppose every developer should study Rajesh R Subramanian history...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well I may have a superb reason why you're completely wrong.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
OT: I suppose Iain being in Scandinavia now, it's a relatively long time since I have seen his last post here.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Sorry, I wasn't aware his monkeys were scheduled on another task [^]... Roll eyes
You're crazy.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
From your description, the way I'd do it would be to model each call as a period of time, chosen randomly using (probably) a normal distribution, where the mean and standard deviation are parameters to the simulation. A 5 minute mean and 3 or 4 minute standard deviation sound reasonable?
class Call
{
Call(double currentTime) {
double CallMadeAt() const;
double GetCallDuration() const;
};
std::stack<Call> callQueue;
You then have a fixed number of operators, each of which can handle one call at a time.
class Operator
{
HandleCall(Call const& call, double currentTime) {
bool Busy() const;
double NextFreeTime() { return (pCall_)(pCall->GetCallDuration() + callStartTime_):(0.0); }
private:
Call* pCall_;
double callStartTime_;
};
Operator operators[OPERATOR_COUNT];
You can then model the passing of time, generating calls at random intervals (again using a normal distribution, but with different parameters) and passing them to free operators. If there's no free operator, you need to work out when the next operator's free and give them the call then.
Obviously, the hold time for a call is the time between the call being made and the call being handed off to an operator. You can measure the average hold time by summing them all and remembering how many there were.
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|