|
jkirkerx wrote: uaPtr[i]->szFirstName = pzFirstName;
uaPtr[i]->szLastName = pzLastName;
uaPtr[i]->szAccountName = pzUserName;
You store pointers to the same buffers N times.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Your database layer should be distinct from your display layer.
Your display layer uses the database layer. There is no display information/design in the database layer (noting of course that the application design of a simple app might seem to drive directly through the two layers.)
jkirkerx wrote: I thought it would be written like this ...
What exactly is the question?
You need a pointer. You need to new an array. Then you initialize each member in the array.
If you are asking how to access a member of the array then you do it as
uaList[0].iUserID
uaList[1].iUserID
etc.
(Presumably you are also providing code to clear up every single allocation.)
Also given that you are using C++ why are not just using a straight forward class with string members?
Formatting suggestions.
- Don't put underscores in the middle of names.
- Don't put underscores at the beginning of method names.
- If a method belongs to a class then don't prefix the class name to the method.
|
|
|
|
|
I probably should of just asked what the preferred method of packaging data is.
I'm still in c++ 100 here, I started in vb.
in vb, I would of just typed
Dim UserInfo(6, TheCount) As String
UserInfo = Users.Get_ListBoxInfo()
I'll try the post above and see how it works.
|
|
|
|
|
Minor suggestion
It is either struct - structure or an array of ... whatever.
Or an array of struct.
It appears that you are after single struct of strings.
Anyway, just a suggestion since you asked what is prefered.
And a really small suggestion - if the function finds a count of items, the return value should be the count and not just true / false. Unless of course you really do not need the count.
Vaclav
|
|
|
|
|
I thought I had to dimension the array first, guess that's not needed if I write better code.
Well here goes, finished my dialog form, so I'm back to the array now.
|
|
|
|
|
jkirkerx wrote: I thought I had to dimension the array first
You might want to experiment with some simpler arrays first. I would suggest an array of ints then an array of strings (the string class, not a char*).
Allocate the arrays, assign values to members of the array, then sequence through the array to verify, then deallocate the array.
After that your implementation is just a variation on the above (especially since string is a class so you will have already created an array of classes.)
|
|
|
|
|
That's a good idea. I will start with some small simple arrays first and get the hang of it in c++, then take it from there.
Thanks jschell
|
|
|
|
|
In MFC, UNIT how to convert an int,can you help me? Master
|
|
|
|
|
Just like that :
int i = 0;
UINT u = 9;
i = (int)u;
TRACE("%d\n",i);
or
int i = 0;
UINT u = 9;
u = (UINT)i;
TRACE("%d\n",u);
|
|
|
|
|
Assuming that you mean UINT rather than UNIT you just need to cast it thus:
UINT uIntValue = 100;
int intValue = uIntValue;
Be aware that any values greater than 2147483647 (0x7FFFFFFF) will be negative in the resulting integer.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thank you, I understand. But the source is so written.
for (UINT uiLineStyleCmd = ID_LINE_STYLE_1;
uiLineStyleCmd <= ID_LINE_STYLE_10;
uiLineStyleCmd++)
{
int iIndex = pMenuPopup->GetMenuBar ()->CommandToIndex (uiLineStyleCmd);
if (iIndex >= 0)
{
pMenuPopup->GetMenuBar ()->m_bDisableSideBarInXPMode = TRUE;
//----------------------------
// Obtain item text and style:
//----------------------------
CString strText = pMenuPopup->GetMenuBar ()->GetButtonText (iIndex);
UINT uiStyle = pMenuPopup->GetMenuBar ()->GetButtonStyle (iIndex);
//------------------
// Calc. line width:
//------------------
int nWidth = uiLineStyleCmd - ID_LINE_STYLE_1 + 1;
//-------------------
// Replace menu item:
//-------------------
pMenuPopup->GetMenuBar ()->ReplaceButton (uiLineStyleCmd,
CLineStyleMenuItem (nWidth,
uiLineStyleCmd,
strText,
uiStyle & TBBS_CHECKED));
}
|
|
|
|
|
Firstly, please use <pre> tags around your code and ensure that it is formatted properly. Secondly, what is your problem?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Please do not use direct eamil to update details of open issues.
You responded to my question:
Message from dlsyaim:
Source is defined so
#define ID_LINE_STYLE_1 32833
But UINT 0 - 4294967295
Source code is no problem
What exactly does this mean, and what is your problem?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
In MFC. I added BCGControlBar control, I do not know how to load line type, source of these. Our manager let me look at this change.
// Replace ID_VIEW_TOOLBARS menu item to the toolbars list:
//---------------------------------------------------------
if (pMenuPopup->GetMenuBar ()->CommandToIndex (ID_VIEW_TOOLBARS) >= 0)
{
if (CBCGPToolBar::IsCustomizeMode ())
{
//----------------------------------------------------
// Don't show toolbars list in the cuztomization mode!
//----------------------------------------------------
return FALSE;
}
pMenuPopup->RemoveAllItems ();
CMenu menu;
VERIFY(menu.LoadMenu (IDR_POPUP_TOOLBAR));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
pMenuPopup->GetMenuBar ()->ImportFromMenu (*pPopup, TRUE);
}
//-------------------------------------------------------------------
// Replace all "line style" menu items by CLineStyleMenuItem objects:
//-------------------------------------------------------------------
for (UINT uiLineStyleCmd = ID_LINE_STYLE_1;
uiLineStyleCmd <= ID_LINE_STYLE_10;
uiLineStyleCmd++)
{
int iIndex = pMenuPopup->GetMenuBar ()->CommandToIndex (uiLineStyleCmd);
if (iIndex >= 0)
{
pMenuPopup->GetMenuBar ()->m_bDisableSideBarInXPMode = TRUE;
//----------------------------
// Obtain item text and style:
//----------------------------
CString strText = pMenuPopup->GetMenuBar ()->GetButtonText (iIndex);
UINT uiStyle = pMenuPopup->GetMenuBar ()->GetButtonStyle (iIndex);
//------------------
// Calc. line width:
//------------------
int nWidth = uiLineStyleCmd - ID_LINE_STYLE_1 + 1;
//-------------------
// Replace menu item:
//-------------------
pMenuPopup->GetMenuBar ()->ReplaceButton (uiLineStyleCmd,
CLineStyleMenuItem (nWidth,
uiLineStyleCmd,
strText,
uiStyle & TBBS_CHECKED));
}
}
|
|
|
|
|
Please edit this post and put <pre> tags around your code as I asked. Please also explain exactly what problem you are having.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
dlsyaim wrote: int nWidth = uiLineStyleCmd - ID_LINE_STYLE_1 + 1;
Is this the statement in question? If so, what is the compiler error or warning that you are receiving?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi. I have a SDI app, with CView based on CListView. In edit menu, I enable / disable some items dependes some conditions with :
ON_UPDATE_COMMAND_UI(ID_EDIT_REFRESH, OnUpdateEditRefresh)
the same edit menu I load in right-click :
void CMyView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
CMenu menu;
menu.LoadMenu(IDR_TERMTYPE2);
CMenu* pContextMenu = menu.GetSubMenu(1);
POINT point;
CPoint pt(pNMListView->ptAction);
point.x = pt.x;
point.y = pt.y;
::ClientToScreen(pNMHDR->hwndFrom,&point);
int nID = pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD,point.x,point.y,this);
*pResult = 0;
}
but all items from edit menu are enable ... and I must enable/disable depndes by the same conditions like main edit menu ... my question is, how can enable/disable edit menu items in OnRclick handler but some how using ON_UPDATE_COMMAND_UI ?
|
|
|
|
|
See this[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I solve my problem ! Thank you very much !
|
|
|
|
|
Congrats and yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
It's always a pleasure to be on this forum ! Happy new year !
|
|
|
|
|
Thanks, a happy new year to you too!
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I made a window that holds a listbox of users, you click on one, and you can edit the values. I was going to make a new window, and tried a dialog box, but there was no textboxes, I didn't find one.
So now I'm thinking, just create 2 panels or groups, and toggle them show and hide.
Question:
Is there such a thing in c++ win32, and what would it be called>
|
|
|
|
|
Jim,
I have absolutely no idea what you are describing. Maybe it has something to do with the post below yours... I can't get this Tic-Tac-Toe song by Kyper[^] out of my head now.
Maybe you could give a better description of what you are attempting to do. Keep in mind that most of the window classes are very basic in what functionalities they provide.
Best Wishes,
-David Delaune
|
|
|
|
|
I want to group a collection of textboxes, labels and buttons, and store it as a single object that I can make visible or invisible.
I was just thinking maybe a plain CreateWindow could do the job, but for now, I'm not sure if it's possible to do, and the name it would be refereed to as - nomenclature.
|
|
|
|