|
Have you tried SetFocus() ????
Best Wishes,
ez_way
|
|
|
|
|
I think I haven't explained myself correctly. What I need to know is where to catch the tab key and set the focus to the next control. Normally (e.g. with buttons etc.) the dialog seems to handle this.
|
|
|
|
|
Hi Brian
Please don't yell for a stupid idea but the tab order you set with CTRL+D shows the tabs,... yes?
Well with that in mind can you not set focus whereever you wish?
I know this is really not a great answer but it worked for me in a tabbed prj.
Best Wishes,
ez_way
|
|
|
|
|
Martin,
thanks for your reply, but that will not work for me as my controls are dynamically created.
|
|
|
|
|
Oh yes, one more thing
when you set the focus please make sure to note the overload function.
SetFocus(GetDlgItem(hDial, ID_VERT_RES));
Best Wishes,
ez_way
|
|
|
|
|
Yes sure but what about using TRY/CATCH to do the validation?
Best Wishes,
ez_way
|
|
|
|
|
|
Validating control contents when switching focus from one control to the next is done by handling the EN_KILLFOCUS notification sent by the edit control that is losing focus.
You could trap TRY/CATCH this and send it along the way in a altered state!
Best Wishes,
ez_way
|
|
|
|
|
So here is the deal! This app looks for virus infected files system wide. I don't understand MFC at all so please help me. I am sure it is a logic error but I don't know enogh MFC to fix.
The code hit the first listing of an infected file maked YES in the list and then does not delete all the entries that are not infected.
long nCnt = m_List.GetItemCount();
long lcounter = 0;
CString tmp;
for(long i = 0;i<=nCnt;i++)
{
if(m_List.GetItemText(0,1) != "YES"){
m_List.DeleteItem(lcounter);
}else{
lcounter++;
tmp.Format("%d",lcounter);
AfxMessageBox(tmp);
}
}
Best Wishes,
ez_way
|
|
|
|
|
When you delete an item, all the following items move up
I would code the algorithm something like this:
int nCnt = m_list.GetItemCount();
for (int i = 0 ; i < nCnt ; i++)
{
if (m_list.GetItemText(i, 1) != "YES")
{
m_list.DeleteItem(i);
i--; move back as we just deleted one
nCnt--;
}
}
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
I'm not entirely sure what you are trying to do, from your explanation.
However, you're
GetItemText(0,1)
and
DeleteItem(lcounter)
are working on different numbers?
If you want to delete items from a list control, bear in mind that removing items from the beginning of a list will then change the indices. I've always found it easier to iterate a list, build up a reverse ordered list then delete in reverse order from the end of the list: this doesn't affect the (lower) indices of the listctrl, so the manipulations are valid.
Debbie
|
|
|
|
|
Hi,
I'm still working on my calendar with scheduled events.
Now I know I can run a function for example every (1) second with a timer (1000ms), but what if i exactly want it to run with my PC... with my Windows-clock that's what I mean.
(And NOT a timer with an interval of 10 ms or something)
I know Windows isn't that accurate with timing, but I mean that when I double-click the time in the system-tray you can see the seconds tick away and when a minute passes, I want the timer to run exactly that way.
And then the question is... if it does runs exactly that way *in sync* ...does it stay or gets asynchronous..?
Roland.
|
|
|
|
|
hi:
I want to limite users' function who are not in the group of administrator by setting in registry.but now ,I just can set the parameter of current user in system since I can find its key in HKEY_CURRENT-USER.I should how to find other users's key in program,please give me suggestion or samples
thank you for reply!!!
Happy Gemini
|
|
|
|
|
w_yufeng wrote:
I want to limite users' function who are not in the group of administrator
To check whether a user is in a given local/network group, try NetUserGetLocalGroups() or NetUserGetGroups() .
I'm not sure I totally understand the latter part of your request.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Maybe my represantation is not clear.I just want to limit users' function in the same computer other than in network .
Happy Gemini
|
|
|
|
|
w_yufeng wrote:
I just want to limit users' function...
...based on whether they are part of the administrator group or not. Is that correct?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Say a list has 500 items in it.
int nCnt = m_List.GetItemCount();
for(int i = 0;i<=nCnt;i++)
m_List.DeleteItem(i);
Why does this not work! Should I increment by 2's?
Best Wishes,
ez_way
|
|
|
|
|
m_List.DeleteAllItems()
But to answer your question, you can't delete items 0-500 because 1) the items are really numbered 0-499 and 2) as soon as you delete item 0, the other 499 shift down so now you have 0-498, not 1-499. If you want to do it in a loop like that, call m_list.DeleteItem(0) instead.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Yes thank you, sorry but here is what I am up against.
If the column == YES then do not delete it. Otherwise kill it.
Problem is that the first YES it hits becomes row 0 and nothing more is done.
Thanks again,
Marty
long nCnt = m_List.GetItemCount();
CString tmp;
tmp.Format("%d",nCnt);
AfxMessageBox(tmp);
for(long i = 0;i<=nCnt;i++)
{
if(m_List.GetItemText(0,1) != "YES"){
m_List.DeleteItem(0);
}
}
}
Best Wishes,
ez_way
|
|
|
|
|
Bacause of m_List.DeleteItem(i) go out of range. When you have been deleted 251 items and want to delete 252th item what will happen? There isn't so much items in the list.
!!! m_List.DeleteItem(0)
|
|
|
|
|
Yes thank you, sorry but here is what I am up against.
If the column == YES then do not delete it. Otherwise kill it.
Problem is that the first YES it hits becomes row 0 and nothing more is done.
So I think what you are saying is set a counter++ to the number of HITS.
HITS could start off as 0 then increment until complete or out of bounds.
Thanks again,
Marty
long nCnt = m_List.GetItemCount();
CString tmp;
tmp.Format("%d",nCnt);
AfxMessageBox(tmp);
for(long i = 0;i<=nCnt;i++)
{
if(m_List.GetItemText(0,1) != "YES"){
m_List.DeleteItem(0);
}
}
}
Best Wishes,
ez_way
Best Wishes,
ez_way
|
|
|
|
|
Try this code:
CString tmp;
tmp.Format("%d",m_List.GetItemCount());
AfxMessageBox(tmp);
m_List.LockWindowUpdate();
for(long i = 0; i <= m_List.GetItemCount(); i++)
{
if(m_List.GetItemText(0,1) != "YES")
m_List.DeleteItem(i--);
}
m_List.UnlockWindowUpdate();
|
|
|
|
|
Yes ok I will try it. I have a Worker Thread running (Thanks to Papa) so that may not be the issue.
Best Wishes,
ez_way
|
|
|
|
|
Hi All,
I need to decrypt a file encrypted by a php script..it can be any algorithm which is good enough and cannot be cracked easily..if it cannot be cracked at all will be the best solution..but for now i am just looking for any of the MCrypt encryption algorithm that can encrypt the data good enough not to be cracked..easily...and that can be decrypted easily using VC++...can someone help me out in doing the same..I need it very urgently...any of the algorithm..Rijndael..or Blowfish or anyone..but it can also be decrypted easily..Any help or pointers are highly appreciated...
Thanks a lot..
Regards
Himanshu
|
|
|
|
|
Have you tried md5() ?
I know of at least 2 VC 6.0 classes that can work with the hash. But that is not the same as true encryption.
I wrote one called blackhorse a few years back. If you want to use please email direct.
Best Wishes,
ez_way
|
|
|
|