|
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
|
|
|
|
|
I want to access database which is in MY SQL on Linux machine from my "C" prgram without creating DSN. For that i have used function SQLDriverConnect as follows.
#define MAXBUFLEN 255
SQLHENV hEnv = SQL_NULL_HENV;
SQLHDBC hDBC = SQL_NULL_HDBC;
SQLHSTMT hStmt = SQL_NULL_HSTMT;
SQLCHAR ConnStrIn[MAXBUFLEN] =
"DRIVER={MYSQL ODBC 3.51 driver};SERVER=192.168.1.60;"
"UID=m;PWD=m;DATABASE=ftp;";
SQLCHAR ConnStrOut[MAXBUFLEN];
SQLSMALLINT cbConnStrOut = 0;
RETCODE retcode; // Return code
retcode = SQLDriverConnect(hDBC,// Connection handle
NULL, // Window handle
ConnStrIn, // Input connect string
SQL_NTS, // Null-terminated string
ConnStrOut, // Address of output buffer
MAXBUFLEN, // Size of output buffer
&cbConnStrOut,// Address of output length
SQL_DRIVER_NOPROMPT);
It returns SQL_ERROR.
Can you please suggest me where i am going wrong. I think it is in the "ConnStrIn".
|
|
|
|
|
Hi there,
I am trying to cache an CF_HDROP of filename handles, (to be dropping into the xp cd burning wizard). This used to work, but lately it stopped working (perhaps because of a Platform Sdk upgrade exposed something I was doing wrong). It works fine dropping to other apps like Nero, or even normal explorer windows.
Has anyone every implemented a Ole Drop Target that can be successfully dropped onto the winxp cd writing wizard window?
Is there anything I'm doing wrong in the following code? I can't seem to see it. I tried replacing "CacheData" with "CacheGlobalData", but still have problems. CacheGlobalData fails in a call to ::GlobalSize(). If CacheData is used, CCmdTarget::~CCmdTarget() fails an assertion, ASSERT(m_dwRef <= 1), and the files don't get copied in.
<br />
void <br />
cPkpCollectFinishWizardPage::OnBeginDragDragList(NMHDR* Header, LRESULT* <br />
pResult) <br />
{<br />
const cPkpCollection* Collection = GrabCollection();<br />
<br />
if(Collection)<br />
{<br />
cFilenameChain FilenameChain;<br />
Collection->GetDropFiles(FilenameChain);<br />
<br />
if(!FilenameChain.IsVoid())<br />
{<br />
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)Header;<br />
<br />
int item = pNMListView->iItem;<br />
<br />
cSimpleListControl* List = &m_DragList;<br />
CString Label = List->GetItemText(item, 0);<br />
int labelLength = Label.GetLength() + 1;
<br />
DWORD bitmapId = BMP_PHOTO_IMAGE;<br />
<br />
HDROP dropHandle = FilenameChain.ConstructDropped();<br />
<br />
if(dropHandle)<br />
{<br />
COleDataSource* DataSource = new COleDataSource;<br />
<br />
STGMEDIUM StgMedium;<br />
StgMedium.tymed = TYMED_HGLOBAL;<br />
StgMedium.hGlobal = (HGLOBAL)dropHandle;<br />
StgMedium.pUnkForRelease = NULL;<br />
<br />
DataSource->CacheData(CF_HDROP, &StgMedium);<br />
<br />
PostMessage(UM_PKP_HANDLE_BEGIN_DRAG, (UINT)DataSource, <br />
item);<br />
}<br />
}<br />
}<br />
<br />
*pResult = 0;<br />
}<br />
<br />
LRESULT<br />
cPkpCollectFinishWizardPage::OnHandleBeginDrag(WPARAM wParam, LPARAM lParam) <br />
{<br />
COleDataSource* DataSource = (COleDataSource*)wParam;<br />
<br />
int item = lParam;<br />
<br />
if(!DataSource)<br />
{<br />
ASSERT(false);<br />
}<br />
else<br />
{<br />
cPoint Point;<br />
cPoint ClientPoint;<br />
GetCursorPos(&Point);<br />
<br />
ClientPoint = Point;<br />
<br />
cSimpleListControl* List = &m_DragList;<br />
ScreenToClient(&ClientPoint);<br />
<br />
DROPEFFECT result = DataSource->DoDragDrop(DROPEFFECT_MOVE|DROPEFFECT_COPY, <br />
NULL, m_DropSource);<br />
}<br />
<br />
delete DataSource;<br />
DataSource = NULL;<br />
}<br />
<br />
return NOTHING;<br />
}<br />
<br />
ConstructDropped() does a <br />
<br />
DWORD globalDataLength = sizeof(DROPFILES) + filesLength;<br />
globalHandle = ::GlobalAlloc(GPTR, globalDataLength); <br />
char* FilesData = (char*)::GlobalLock(globalHandle);<br />
<br />
DROPFILES* DropFiles = (DROPFILES*)FilesData;<br />
DropFiles->fNC = false;<br />
DropFiles->fWide = false;<br />
DropFiles->pFiles = sizeof(DROPFILES);<br />
DropFiles->pt.x = 0;<br />
DropFiles->pt.y = 0;<br />
<br />
... and puts the strings in...<br />
code><br />
<br />
?<br />
<br />
Thanks in advance! <br />
<br />
[b]yte your digital photos with [ae]phid [p]hotokeeper - <a href="http:\\www.aephid.com\photokeeper-default-frame-codeproject.shtml">www.aephid.com</a>.
|
|
|
|
|
I have created a wh_getmessage hook and filtered all the keyboard messages going to the system wide application.
NOw i have the msg structure with me
i have to change the wm_char obtained from the msg structure to extended ascii character
how to do this??????
Is there no experts in the world who like to give a try???
please
|
|
|
|
|
LRESULT CALLBACK MyGetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
if ( code < 0 ) {
return ::CallNextHookEx( hHook, code, wParam, lParam );
}
MSG* pMsg = reinterpret_cast<MSG*>( lParam );
if ( WM_CHAR == pMsg->message ) {
TCHAR ch = static_cast<TCHAR>( pMsg->wParam );
// Do something with it
}
return ::CallNextHookEx( hHook, code, wParam, lParam );
}
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thank you Mr. Dave for trying my question and i am confident that you may provide me the answer what i am looking for.
I am just a begginer in Vc++ and so could you give some comments on the line of codings you have put for me.
For i couldnt get the idea
Like in pmsg i will get the character say Wm_char = A.Then what i need is to replace this A with € .
Please give me some comments and illustrations.
Still Thank you very much.
|
|
|
|
|
The first three lines of the function, handle the case where the code is less than zero. According to MSDN for the get message hook, in that case we must immediately call CallNextHookEx() without doing anything else.
Then we retrieve the MSG structure (which defines a windows message). It is stored in the lParam passed to our callback function (again details from MSDN - look up SetWindowsHookEx() and follow the link for the get message hook).
Next we check that it is the WM_CHAR message - everything else we are ignoring. Once we have the WM_CHAR message, we know that the character is stored in the wParam of the message (check MSDN for WM_CHAR), and so can retrieve it from there.
If we wanted to modify the character, then we just set the value of pMsg->wParam at this point.
e.g.
...
if ( 'A' == ch ) {
// Modify the character
pMsg->wParam = 0x1234; // Some random unicode character
}
...
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thank you Mr.Dave.
f ( 'A' == ch ) {
// Modify the character
pMsg->wParam = 0x1234; // Some random unicode character
}
Here you have given a unicode character but i am not using a unicode based application and the font i am going to use is true type which wont support unicode and so could you give me how to send an extended ascii character.
in place of unicode.
Thank you very much
|
|
|
|
|
The ASCII character set, both standard and extended, can be found from the MSDN Reference. Just surf to http://www.microsoft.com/msdn and use it's search function with keyword 'ASCII characters, table of codes'. This keyword will retrieve the ASCII character code table, at least on my latest MSDN Library release (April 2003).
To replace the 'random Unicode character', you need to replace the hex value. For example, based on the ASCII code table, a hex value of 0x9B would result in the Euro sign, if my eyes didn't fail me
The difference between standard ASCII and extended ASCII is that standard ASCII ranges from decimal values 0 to 127, and extended chart goes beyong 128, up until 255. The roots of this are in the original ASCII set. It was a 7-bit structure. Seven bits can represent 128 different states, hence the 'standard ASCII'. After the introduction of the new standard, a new ASCII structure was taken to use, consisting of 8-bits, hence, 256 different choices.
As for the Unicode, it is just another expansion: it boasts more bits. I think the first 256 states of a Unicode system still offer the same characters as the extended ASCII does, but beyond that, they are completely set-dependant.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|