 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
|
 |
hai friends please helpme to complete my project...
i have only 25 hours time to complete that above project if any body have that source code please send to this mail id b.manmadkumarreddy@gmail,
manmadb32@gmail.comimmediately please help me.......
|
|
|
|
 |
|
 |
Nobody here is going to do your work for you.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
 |
|
 |
manmadkumarreddy wrote: i have only 25 hours time to complete that above project
Don't you think you left it a bit late?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
 |
|
 |
Hi,
If you know please tell me where i can find gSpan source code, it used in Data Mining to find out supgraph.
Thanks!
|
|
|
|
 |
|
 |
Google[^] is always the first place to look.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
 |
|
 |
I have search gSpan by google, but the code i find which need the environment with matlab. But i don't have matlab. What i want is a source code implemented only on C or C++ which i can run it by Microsoft Visual Studio and Dev-C++.
Thanks for your reply
|
|
|
|
 |
|
 |
linnumberone wrote: I have search gSpan by google, but the code i find which need the environment with matlab.
What about these links[^]?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
 |
|
 |
I have search this term in google, but all the resource i found cannot run in Microsoft Visual Studio 2010, i will try to find it, but if anyone know where i can find or how to implement, please tell me, thanks
|
|
|
|
 |
|
|
 |
|
 |
Looks like that's your only option... if you want something that C++ exclusively, find another suitable library or write your own.
|
|
|
|
 |
|
 |
Message Automatically Removed
|
|
|
|
 |
|
 |
Hello, I'm wondering how would you programmatically install your program in the Windows Action Center on the antivirus section, to where it says "COMODO antivirus is currently running and up to date." How would you do it to make your own program (e.g., "Windows Application-1 is currently running and up to date.")
Regards,
Brandon T. H.
|
|
|
|
 |
|
 |
I just want to get a check to see if my translation of the Mod Operator in VB to c++ is even close to right, or if there is a c++ equivalent to Mod, where I can just use Mod or something close to it.
edit:
I'm not sure if the null terminate char will produce a different result in the c++.
So I have these lines of code to translate.
strTextChar = Mid(strDomainName, (i Mod Len(strDomainName)) + 1, 1)
strKeyChar = Mid(ApplicationName, (i Mod Len(ApplicationName)) + 1, 1)
szTextChar = &szDomainName[ ( i - ( wcslen(szDomainName)) * (i / wcslen(szDomainName)) ) + 1 ];
szKeyChar = &pzApplicationName[ ( i - ( wcslen(szApplicationName)) * (i / wcslen(szApplicationName)) ) + 1 ];
I have this other line of code to translate, this one is more complex, just thought I would throw it out there. I took a peek at Xor, it's not quite sinking in yet.
strTextChar = Chr(Asc(strTextChar) Xor intTemp)
|
|
|
|
 |
|
 |
% is the modulo operator in C++ and C# and most similar languages.
Philippe Mori
|
|
|
|
 |
|
 |
Thanks Philippe!
I took off the +1 for the null terminator
szTextChar = szDomainName[ (i % wcslen(szDomainName)) ];
szKeyChar = pzApplicationName[ (i % wcslen(szDomainName)) ];
|
|
|
|
 |
|
 |
I'm trying to translate a program I use in vb to c++, to get the exact same results. The program is basically 8 lines of code. I have the first 2 lines working, but on line 3, I get back a int value of 10, and vb returns &h10, which is 16.
So this is the vb loop of the function. I decided to use char since the valid characters are
Private Const VALID_CHARACTERS = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ"
Private Const DEFAULT_FORMAT = "&&&&-&&&&-&&&&-&&&&"
This is the source code from vb I use.
For i = 1 To CountAmpersands(sFormat)
L1 strTextChar = Mid(strDomainName, (i Mod Len(strDomainName)) + 1, 1)
L2 strKeyChar = Mid(ApplicationName, (i Mod Len(ApplicationName)) + 1, 1)
L3 intTemp = (((Asc(strKeyChar) * i) * Len(ApplicationName) + 1) Mod Len(ValidCharacters) + 1) L4 strTextChar = Chr(Asc(strTextChar) Xor intTemp)
L5 intTemp = (((Asc(strKeyChar) * i) * Len(DomainName) + 1) Mod Len(ValidCharacters) + 1)
L6 strTextChar = Chr(Asc(strTextChar) Xor intTemp)
L7 intEncryptedChar = ((Asc(strTextChar) Xor Asc(strKeyChar)) Mod Len(ValidCharacters)) + 1
L8 strKey = strKey & Mid(ValidCharacters, intEncryptedChar, 1)
Select Case i
Case 4, 8, 12
strKey = strKey & "-"
End Select
Next i
And this is my feeble translation to c++, I didn't do very good on it, this is the 3rd run.
for (int i = 1; i <= iCount; ++i) {
L1 szTextCharA = szDomainNameA[ ( i % strlen( szDomainNameA )) ]; L2 szKeyCharA = szAppKeyA[ ( i % strlen( szAppKeyA )) ]; L3 iTemp = ((szKeyCharA * i) * strlen(szAppKeyA)) % strlen( LICENSEKEY_CHARACTERS );L4 szTextCharA = (char) ((int)szTextCharA ^ iTemp ); L5 iTemp = (int)(szKeyCharA * i) * strlen(szDomainNameA) % strlen( LICENSEKEY_CHARACTERS );
L6 szTextCharA = (char)((int)szTextCharA ^ iTemp);
L7 iEncryptedChar = (int)szTextCharA ^ (int)szKeyCharA % strlen(LICENSEKEY_CHARACTERS);
if ( i == 1) {
strncpy_s( szKeyA, iKeyA, &LICENSEKEY_CHARACTERS[ iEncryptedChar ], 1 );
}
else {
strncat_s( szKeyA, iKeyA, &LICENSEKEY_CHARACTERS[ iEncryptedChar ], 1 );
}
}
Question1:
On Line 3 in VB, I get back &H10, and Line 3 in c++, I get back 10. I'm not sure if I wrote the c++ L3 wrong, or if I'm not clear on the value of iTemp.
Question2:
Am I even close on my translation? From Line 3 to Line 7, and I think I need a better method of building the final key szKeyA.
Question3:
Should I have just lefted it as WCHAR, On version 2, I changed it to char.
This is the entire program so you can get a better idea of what I did
const char LICENSEKEY_CHARACTERS [] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char LICENSEKEY_FORMAT [] = "&&&&-&&&&-&&&&-&&&&";
WCHAR* CA_LicenseKey::_makeKey( WCHAR *pzAppKeyW, WCHAR *pzDomainNameW )
{
INT iTemp;
int iEncryptedChar;
char szTextCharA;
char szKeyCharA;
char *szKeyA = NULL;
if ( wcslen(pzDomainNameW ) == 0) {
DWORD dwKey = wcslen( L"Invalid Domain Name" );
WCHAR *szReturnW = new WCHAR[dwKey+1];
wcsncpy_s(szReturnW, dwKey+1, L"Invalid Domain Name", dwKey );
return szReturnW;
}
int iDomainNameA = (WideCharToMultiByte(CP_UTF8, 0, (pzDomainNameW), -1, NULL, 0, NULL, NULL) - 1) + 1;
char *szDomainNameA = new char[iDomainNameA];
WideCharToMultiByte(CP_UTF8, 0, pzDomainNameW, -1, szDomainNameA, iDomainNameA, NULL, NULL);
_strlwr_s( szDomainNameA, iDomainNameA );
int iAppKeyA = (WideCharToMultiByte(CP_UTF8, 0, pzAppKeyW, -1, NULL, 0, NULL, NULL) - 1) + 1;
char *szAppKeyA = new char[iDomainNameA];
WideCharToMultiByte(CP_UTF8, 0, pzAppKeyW, -1, szAppKeyA, iAppKeyA, NULL, NULL);
int iCount = _countAmpersands();
int iKeyA = strlen(LICENSEKEY_FORMAT)+1;
szKeyA = new char[ iKeyA+1 ];
for (int i = 1; i <= iCount; ++i) {
szTextCharA = szDomainNameA[ ( i % strlen( szDomainNameA )) ]; szKeyCharA = szAppKeyA[ ( i % strlen( szAppKeyA )) ];
iTemp = ((szKeyCharA * i) * strlen(szAppKeyA)) % strlen( LICENSEKEY_CHARACTERS ); szTextCharA = (char) ((int)szTextCharA ^ iTemp );
iTemp = (int)(szKeyCharA * i) * strlen(szDomainNameA) % strlen( LICENSEKEY_CHARACTERS );
szTextCharA = (char)((int)szTextCharA ^ iTemp);
iEncryptedChar = (int)szTextCharA ^ (int)szKeyCharA % strlen(LICENSEKEY_CHARACTERS);
if ( i == 1) {
strncpy_s( szKeyA, iKeyA, &LICENSEKEY_CHARACTERS[ iEncryptedChar ], 1 );
}
else {
strncat_s( szKeyA, iKeyA, &LICENSEKEY_CHARACTERS[ iEncryptedChar ], 1 );
}
}
delete [] szDomainNameA;
delete [] szAppKeyA;
WCHAR *szKeyW = NULL;
return szKeyW;
}
int CA_LicenseKey::_countAmpersands( void )
{
INT iCount = 0;
int iLength = 0;
char *szFormatA = NULL;
iLength = strlen(LICENSEKEY_FORMAT);
szFormatA = new char[iLength+1];
strncpy_s( szFormatA, iLength+1, LICENSEKEY_FORMAT, iLength );
for (int i = 0; i <= iLength; ++i) {
if ( strncmp( &szFormatA[i], "&", 1) == 0 ) {
++iCount;
}
}
delete szFormatA;
return iCount;
}
|
|
|
|
 |
|
 |
The second one will be something like:
strTextChar = static_cast<wchar_t>(static_cast<int>(strTextChar[0]) ^ intTemp);
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
 |
|
 |
Thanks Dave,
Your hint gave me insight into the proper and more consistent way to write the 8 lines of code.
Now I'm getting accurate results so far going through the loop. Looks like I will be able to complete this today and move on.
|
|
|
|
 |
|
 |
I'm missing the boat here on something. I have this constant, and I just want to count how many ampersands are in it. But I keep getting a character or type mismatch, I can't go though each character to check the value.
Overall, it's my idea of how to replace the mid function used in vb. mid(szFormat, 1,1)
const WCHAR LICENSEKEY_FORMAT [] = L"&&&&-&&&&-&&&&-&&&&";
for (int i = 0; i <= dwLength; ++i) {
if (wcsncmp(szFormat [i], L"&", 1) ==0) {
++dwCount;
}
}
The error I keep getting is
error C2664: 'wcsncmp' : cannot convert parameter 1 from 'WCHAR' to 'const wchar_t *'
If I szFormat[i] == L"&", I sort of get the same error.
Question:
Is it the const that I made is not stated correctly?, If not, what correction do I need?
|
|
|
|
 |
|
 |
try:
wcsncmp( &szFormat[i], L"&", 1 ) == 0
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
 |
|
 |
That did the trick,
Thanks Richard
|
|
|
|
 |
|
 |
Use this (note the single quotation marks):
if (szFormat [i] == L'&')
You may also have a look on the CString class which provides the Left(), Mid(), and Right() functions.
|
|
|
|
 |
|
 |
I changed it to char, so the single quotes don't work right now. I might change it back to WCHAR today, because I'm not getting the desired results. I do get an accurate count, but I'm trying to translate a vb function, so it needs to be the same.
I'm going to post an extension to the post above in about 10 minutes.
|
|
|
|
 |