Click here to Skip to main content
14,698,571 members
Home » Discussions » ATL / WTL / STL
   

ATL / WTL / STL

 
Questionhow to let menu auto show next item when mouse on the bottom arrow of menu Pin
fengforky9-Jul-14 23:53
Memberfengforky9-Jul-14 23:53 
AnswerRe: how to let menu auto show next item when mouse on the bottom arrow of menu Pin
Richard MacCutchan10-Jul-14 0:34
mveRichard MacCutchan10-Jul-14 0:34 
QuestionWCHAR, wstring, initializing and accessing them (RESOLVED) Pin
bkelly131-Jul-14 11:13
Memberbkelly131-Jul-14 11:13 
AnswerRe: WCHAR, wstring, initializing and accessing them Pin
Richard MacCutchan2-Jul-14 6:38
mveRichard MacCutchan2-Jul-14 6:38 
Generalnarrowing the focus a bit Pin
bkelly132-Jul-14 10:59
Memberbkelly132-Jul-14 10:59 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan2-Jul-14 14:32
mveRichard MacCutchan2-Jul-14 14:32 
GeneralRe: narrowing the focus a bit Pin
bkelly132-Jul-14 18:00
Memberbkelly132-Jul-14 18:00 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan3-Jul-14 5:17
mveRichard MacCutchan3-Jul-14 5:17 
The problem you have is that you cannot declare an array and then 'set it' to point to something else, it is not modifiable. The only way to do it (but I would not recommend it) is to use simple pointers, and let the code in your class figure out the length of each string in the array; in your case this is the fixed value SIZE_OF_STRING . So your code would need to be implemented like:
// declare the pointer in the class
WCHAR* names;

// the function to set it
void Set_Local_Pointer(WCHAR* new_pointer)
{
    mp_local_pointer = new_pointer;
}

// code to create the array and pass it to the class
WCHAR names[ STRING_COUNT ][ SIZE_OF_STRING ];
// copy the strings to each SIZE_OF_STRING element of the array
wcscpy_s(names[0], L"StringZero");
wcscpy_s(names[1], L"StringOne");
wcscpy_s(names[2], L"StringTwo");
// etc
Set_Local_Pointer(names[0])
// Note that you must not modify or otherwise change the content of names after this point or the data used by the class will be corrupt. 

A better way would be to let the class object manage all the data by sending it the strings as a list, or with an index telling it which element to modify. something like:
BlahBlah class
{
    WCHAR mpNames[STRING_COUNT][SIZE_OF_STRING];
//
void Set_Local_Pointer(WCHAR new_pointer)
{
    memcpy(mp_local_pointer, new_pointer, STRING_COUNT * SIZE_OF_STRING);
}
// or
void Set_Local_Pointer(WCHAR pLabel, int index)
{
    memcpy(mp_local_pointer[index], pLabel, SIZE_OF_STRING);
}

GeneralRe: narrowing the focus a bit Pin
bkelly133-Jul-14 18:24
Memberbkelly133-Jul-14 18:24 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 1:36
mveRichard MacCutchan4-Jul-14 1:36 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 2:13
Memberbkelly134-Jul-14 2:13 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 2:45
mveRichard MacCutchan4-Jul-14 2:45 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 4:08
mveRichard MacCutchan4-Jul-14 4:08 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 6:02
Memberbkelly134-Jul-14 6:02 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 6:40
mveRichard MacCutchan4-Jul-14 6:40 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 8:07
Memberbkelly134-Jul-14 8:07 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 8:21
mveRichard MacCutchan4-Jul-14 8:21 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 9:20
Memberbkelly134-Jul-14 9:20 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 21:10
mveRichard MacCutchan4-Jul-14 21:10 
Generalreasons Pin
bkelly135-Jul-14 8:22
Memberbkelly135-Jul-14 8:22 
GeneralRe: reasons Pin
Richard MacCutchan6-Jul-14 5:44
mveRichard MacCutchan6-Jul-14 5:44 
GeneralRe: reasons Pin
bkelly137-Jul-14 15:03
Memberbkelly137-Jul-14 15:03 
GeneralRe: reasons Pin
Richard MacCutchan7-Jul-14 23:04
mveRichard MacCutchan7-Jul-14 23:04 
Questionfriend declaration causes undeclared identifier Pin
bkelly1330-Jun-14 6:55
Memberbkelly1330-Jun-14 6:55 
AnswerRe: friend declaration causes undeclared identifier Pin
Subrat 470826612-Sep-14 16:20
MemberSubrat 470826612-Sep-14 16:20 

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.