|
Hmmm.Okay. Thank you for that info.
Their addItem has one 'fixed' input variable, and unlimited optionals. I will have my subItem texts in an array and wanted to pass in an array but modifying their code is beyond my present capabiities. So I have to figure out how best to pass in my array the way they want it:
AddItem(pArray[0], pArray[1], pArray[2].......pArray[n])
which is how they want it. Its not at all obvious to me how I can loop on an index when passing in the array in this fashion.
My problem is that for one database where I get my subitem texts from, there is a particular 'n' value, and a different 'n' for a different database.So I cant hard code the AddItem parameter list. And I cant loop on an index in the argument list....
thanks,
ns
|
|
|
|
|
Their version of AddItem uses variable argument list and va_xxx stuff because they must provide convenient syntax for list controls containing different # of columns. Read the docs on va_start, va_end and va_arg and you'll get the idea what's going on. Passing array instead of array elements should be trivial.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Trying. I cant strip out their pid and arrpsz stuff safely, and its tied in with their variable optionals. Heres my attempt:
int CSortListCtrl::AddItem2( CString pArray[], int ArraySize)
{
const int iIndex = InsertItem( GetItemCount(), pArray1[0] );
LPTSTR* arrpsz = new LPTSTR[ ArraySize ];
arrpsz[ 0 ] = new TCHAR[ lstrlen( pArray1[0] ) + 1 ];
(void)lstrcpy( arrpsz[ 0 ], pArray1[0] );
for( int iColumn = 1; iColumn < ArraySize; iColumn++ )
{
CListCtrl::SetItemText( iIndex, iColumn, pArray1[iColumn] );
arrpsz[ iColumn ] = new TCHAR[ lstrlen( pArray1[iColumn] ) + 1 ];
(void)lstrcpy( arrpsz[ iColumn ], pArray1[iColumn] );
}
VERIFY( SetTextArray( iIndex, arrpsz ) );
return iIndex;
}
Appreciate your help,
ns
|
|
|
|
|
You don't need to strip anything; just change the way arguments are passed. Your code looks OK; I'd use CStringArray instead of CString[].
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
I cant thank you enough. This exchange was very instructive. I used CStringArray like you said and it works, plus no crashes!
This is a little sample I tried before I use this class in my main project, but I wanted to tailor it so I could use it -
my pArray is going to come from reading in the all values of one row of a database into a CStringArray.
Now the next thing I have to do is figure out how to get all the values of a particular column out of the listcontrol. - ah GetItemText()
I thank you very much for all the help you have been giving me , and the patience
Appreciate your help,
ns
|
|
|
|
|
Hurrah for CStringArray ! (And thanks to Tomasz! )
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Tomasz did a lot for my confidence. Never in a million years did I dream that I'd have the courage to modify extremely foreign looking stuff like va_arg etc, but its demystified. Tons of sections in this CP class where I am clueless, but its like a daily learning process, so theres hope! Thanks for CStringArray. Quite friendly to use.
Appreciate your help,
ns
|
|
|
|
|
Hi , I'm writing an activex to apply skins to dialogs ,etc..
but I don't Know how to get the hwnd of the container of the activex (i.e. the dialog box)
Any I dea would be helpful
thanks in advansed
|
|
|
|
|
Spy++
then ::FindWindow(), ::EnumWindow()
Normal hacking procedure.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Try:
AfxGetMainWnd()->GetSafeHwnd();
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
getparent()
etc...?
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" biz stuff about me
|
|
|
|
|
Hi all!
I'm trying to write an Mail server using VC6.
It's OK for mail with Text only, but bot with formatted text, mail with Images ....!
Can any one tell me how to display a formatted mail as Netscape mail or Outlook express does.
what ActivexControol Can I use for mail editor and and mail displayer.
NNH
|
|
|
|
|
Search for the browser control!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
The webbrowser control that was suggested to you is fine, but it could well mean you are open too viruses etc.
Consider using the thumbnail control as well.
Note it isn't near as powerful as the webbrowser control, but good for previews.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
|
Hi all!
I connect to Internet by personal Computer though PSTN via a modem.
Does anyone know How to get the actual IP Address of such a computer like mine?(not get by localhost 127.0.0.01)
Thanks in advance.
NNH
|
|
|
|
|
http://www.codeproject.com/internet/ipenum.asp
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
If you don't want to do it through code, you just want to know for your reference, then use winipcfg (win9x) or ipconfig (NT/2k/xp)
Signature space for rent. Apply by email to....
|
|
|
|
|
|
you can try gethostname and gethostbyname.
1) call gethostname to obtain host name
2) call gethostbyname take host name as parameter
|
|
|
|
|
I want to change panels dynamicaly. I used the ctrlbars sample from the mfc-sample collection. The panel gets created but doesn't show up. I've followed the example though...
Situation:
- CDialog derived CMyDialog with:
* button IDC_SHOW_BUTTON
* CDialogBar* m_pCmdBar
- DialogBar template IDD_MY_BAR
I want to show IDD_MY_BAR when the showbutton is pressed.
void CMyDialog::OnShowButton()
{
m_pCmdBar=new CDialogBar();
m_pCmdBar->Create(this,IDD_MY_BAR,CBRS_NOALIGN,IDD_MY_BAR);
m_pCmdBar->Invalidate();
AfxGetApp()->OnIdle(-1);
}
Did I forget something?
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
Is your app dialog-based?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
yes. don't say you can't use cdialogbar with dialog based apps
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
I don't know. Since CTRLBARS is doc/view sample, it probably uses CFrameWnd::ShowControlBar to display its bars. Check the DLGCBR32 sample which adds toolbar/status bar to dialog - maybe the solutions presented there will help you with CDialogBar as well.
OTOH, if all you need are panels within dialog, just use CDialog-derived class - dialogs can be embedded; this is how property pages are implemented. Don't forget to set 'Child' style in the dialog editor.
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
Tnx
I just didn't want to use the cdialog cause the create-function had to many params. A bit lazy, me...
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|