Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C++ Function Alias Pin
Chuck O'Toole14-Nov-11 6:39
Chuck O'Toole14-Nov-11 6:39 
AnswerRe: C++ Function Alias Pin
Erudite_Eric14-Nov-11 5:18
Erudite_Eric14-Nov-11 5:18 
AnswerRe: C++ Function Alias Pin
Maximilien14-Nov-11 6:25
Maximilien14-Nov-11 6:25 
GeneralRe: C++ Function Alias Pin
Chuck O'Toole14-Nov-11 6:46
Chuck O'Toole14-Nov-11 6:46 
GeneralRe: C++ Function Alias Pin
Albert Holguin14-Nov-11 7:36
professionalAlbert Holguin14-Nov-11 7:36 
GeneralRe: C++ Function Alias Pin
jschell14-Nov-11 8:12
jschell14-Nov-11 8:12 
AnswerRe: C++ Function Alias Pin
Stefan_Lang15-Nov-11 1:22
Stefan_Lang15-Nov-11 1:22 
QuestionPartition Manager Pin
A_Fa13-Nov-11 23:01
A_Fa13-Nov-11 23:01 
AnswerRe: Partition Manager Pin
Rajesh R Subramanian13-Nov-11 23:06
professionalRajesh R Subramanian13-Nov-11 23:06 
QuestionHow to get all column name in database using CDatabase? Pin
Le@rner13-Nov-11 22:27
Le@rner13-Nov-11 22:27 
AnswerRe: How to get all column name in database using CDatabase? Pin
Richard MacCutchan13-Nov-11 22:40
mveRichard MacCutchan13-Nov-11 22:40 
AnswerRe: How to get all column name in database using CDatabase? Pin
Mark Salsbery14-Nov-11 5:02
Mark Salsbery14-Nov-11 5:02 
QuestionWhat is the COM Interface GUID/UUID for IVSSBackupComponents on Windows XP? Pin
Kerem Guemruekcue13-Nov-11 20:15
Kerem Guemruekcue13-Nov-11 20:15 
QuestionThe problem with Serial library for C++ Pin
LongDuyTran13-Nov-11 18:50
LongDuyTran13-Nov-11 18:50 
AnswerRe: The problem with Serial library for C++ Pin
«_Superman_»13-Nov-11 19:47
professional«_Superman_»13-Nov-11 19:47 
AnswerRe: The problem with Serial library for C++ Pin
LongDuyTran13-Nov-11 20:05
LongDuyTran13-Nov-11 20:05 
AnswerRe: The problem with Serial library for C++ Pin
Richard MacCutchan13-Nov-11 22:37
mveRichard MacCutchan13-Nov-11 22:37 
AnswerRe: The problem with Serial library for C++ Pin
Erudite_Eric13-Nov-11 22:50
Erudite_Eric13-Nov-11 22:50 
AnswerRe: The problem with Serial library for C++ Pin
OneKey2Press17-Dec-11 2:49
OneKey2Press17-Dec-11 2:49 
QuestionBuilding a WCHAR Array, Not sure if it right Pin
jkirkerx11-Nov-11 7:05
professionaljkirkerx11-Nov-11 7:05 
AnswerRe: Building a WCHAR Array, Not sure if it right Pin
Mark Salsbery11-Nov-11 7:51
Mark Salsbery11-Nov-11 7:51 
GeneralRe: Building a WCHAR Array, Not sure if it right Pin
jkirkerx11-Nov-11 8:12
professionaljkirkerx11-Nov-11 8:12 
AnswerRe: Building a WCHAR Array, Not sure if it right Pin
Richard MacCutchan11-Nov-11 22:48
mveRichard MacCutchan11-Nov-11 22:48 
GeneralRe: Building a WCHAR Array, Not sure if it right Pin
jkirkerx12-Nov-11 7:01
professionaljkirkerx12-Nov-11 7:01 
Yeah, I thought I was going to have to do a per-calculation. I changed the format of the program, and opted for adding the server name 1 at a time. So when I add the name to the collection, I add the name to the registry key, which is multi-size. Sort of like the MimeMap Program, in which I read the key, look for a duplicate, if no duplicate, add the name, write the key back.

I will take your wisdom, and mix the 2 together. I wrote this yesterday, which is better than the the one I had in question. I know it has issues, in which I will straighten out today, on this rainy day.

I'm going to dump the wcsncmp for a straight value = value.

C#
TCHAR   szAddServerName[120];
    WCHAR   *pzServerNames = NULL;

    // Format ServerName Value
    int idx = wcslen(pzServerName);
    for (int i = 0; i < idx; i++) {
        szAddServerName[i] = pzServerName[i];
    }
    szAddServerName[idx] = L';';
    szAddServerName[idx+1] = L'\0';

    // Get existing ServerNames
    pzServerNames = CA_Registry::_get_Enumerated_SQLServers();

    // Extract the ServerNames
    int iCompare;
    wchar_t *token1, *nextToken;
    wchar_t seps[] = L";";
    token1 = wcstok_s(pzServerNames, seps, &nextToken);
    do {
        iCompare = wcsncmp(szAddServerName, token1, wcslen(szAddServerName)-1 );
        if (iCompare != 0)  {
            wcsncat(pzServerNames, L";", wcslen(L";") );
            wcsncat(pzServerNames, szAddServerName, wcslen(szAddServerName)+1 );
        }
        token1 = wcstok_s(NULL, seps, &nextToken);
        if (token1 == NULL)
            break;
    } while (TRUE);

    int iLength = wcslen(pzServerNames)+1;
    pzServerNames[iLength+1] = L'\0';

    WCHAR *szServerNames = new WCHAR[iLength+1];
    wcsncpy_s(szServerNames,  pzServerNames, wcslen(szServerNames) );
    szServerNames[iLength] = L'\0\0';

GeneralRe: Building a WCHAR Array, Not sure if it right Pin
jkirkerx12-Nov-11 9:17
professionaljkirkerx12-Nov-11 9:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.