|
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
|
|
|
|
|
Just for clarifying, not to be offensive - if you 'encrypt it' with md5 you'll not able to get the plaintext back from the 'ciphertext'. That's why md5 is called one-way. There's no way back.
|
|
|
|
|
you have plenty of algorithms - you named few of them Blowfish, RC4, 3DES... choice is up to you - most of these algos are proven and verified by time. If you have enough CPU time you can consider using asymetric cryptography.
None of the mentioned algos was cracked if it was used with reasonable key size.
Only problem you'll probably have is the key management 
|
|
|
|
|
I'm working with MFC. I defined OnSysChar, and tested it via SendMessage(WM_SYSCHAR,...) and it is working. However, it never receives control after I press any key with ALT; in fact it NEVER receives control (except for the self-generated message), no matter what I press anyway.
What can the problem be? I don't have PreTranslateMessage, OnKeyDown, OnKeyUp.
Testwise I defined OnChar; the same is (not) happening: it never receives control.
|
|
|
|
|
hi all, sorry this is a re-post but i can't believe the lack of info on USB
communications! surely the new USB technology is taking over COM ports.
my new you-beaut program is ready to roll except for one thing, the program on the USB drive must autorun once it is connected..
I've been doing a bit of research on making my USB drive to autorun. Based on what i've gathered, "the device must not be marked as a removable media device" - microsoft
would anybody know how to achieve this??
(i've considered writing a hook application to handle the autorun side of things. but i would consider this as the very very last option)
cheers,
mike
|
|
|
|
|
Hi, Mike,
I know that it has been over three years since you posted this request for help in getting an application to autorun from a USB drive, but did you ever find a solution to the problem. I am trying to do the same thing. You mentioned writing a hook application to do this. Did you do that? What did you hook? Some kind of volume mounted event? I haven't written a hook application, so if you could share any information that you have, I would appreciate an email to rfickling@iac-onlime.com.
Thanks,
Royce
|
|
|
|