|
Is there anyway to set the text color for inidividual ListView subitem? You can change the text color of the whole listview using SetTextColor method of listview, but it seems that it sets the whole list...is there anyway to set the color for individual items?
thanks
|
|
|
|
|
|
I'm writing an MFC VS 6.0 program that passes text variables to BRIO a reporting tool.
I know how to return a variable with a C++ program but how do you call an external program in MFC??
MSDN is as much help as it usually is.
Thanks
|
|
|
|
|
CreateProcess is the best way
-c
Cheap oil. It's worth it!
|
|
|
|
|
I am working on a C++ app to populate acrobat fields. I have figured it out in VB and that code could be posted if needed. What I need is how to use the AForm32.api plug-in in C++. Are there headers? Is there a way to #import. I have played with #import but don't seem to have exposure to the objects. Thanks for any guidance.
Bill
|
|
|
|
|
Hi:
I have written the following code for sorting the column on a lift mouse click:
void CMyListCtrl::OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// Get the current mouse location and convert it to client coordinates
DWORD dwPos = GetMessagePos();
CPoint cPt(LOWORD(dwPos), HIWORD(dwPos));
ScreenToClient(&cPt);
// Get the number of columns
int nColCount = ((CHeaderCtrl *)GetDlgItem(0))->GetItemCount();
// Determine what column was clicked
int nLeftBound = 0;
for (int nColIndex = 0; nColIndex < nColCount; nColIndex++) {
int nColWidth = GetColumnWidth(nColIndex);
if ( cPt.x >= nLeftBound && cPt.x <= (nLeftBound + nColWidth) ) {
// Call the sorting function
m_bColSortOrder[nColIndex] = !m_bColSortOrder[nColIndex];
if (m_nColDataType[nColIndex] == 1) {
SortNumericItems(nColIndex, m_bColSortOrder[nColIndex], 0, GetItemCount() - 1);
} else {
SortTextItems(nColIndex, m_bColSortOrder[nColIndex], 0, GetItemCount() - 1);
}
}
nLeftBound += nColWidth;
}
*pResult = 0;
}
That works great until I scroll horizontally within the list control. As columns get shifted, the click doesn't point to the right column anymore..
Any thoughts?
Thank you
|
|
|
|
|
Hi,
All the code you have written to get the column is
not required. You get the column fromt he NM_LISTVIEW struct itself.
Look at the foll. code snippet.
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
*pResult = 0;
int nColumn = pNMListView->iSubItem ;
|
|
|
|
|
I am getting a debug assertion that I havn't ever seen before, and I cant figure it out.
If anybody has any ideas pls let me know.
Thanks
Here is the constructor dec:
CModemInterface(CStringArray* out, CWnd* pParent = NULL);
And here is where I call the dialog:
CStringArray* testFiles = new CStringArray();
for(int i = 0; i < 5; i++)
{
CString strTemp;
strTemp.Format("Test%i.txt", (i + 1));
testFiles->Add(strTemp);
}
CModemInterface dlg(testFiles, this);
if(dlg.DoModal() == IDOK) //crash here, traced into CDialog::DoModal
delete testFiles;
return;
|
|
|
|
|
What kind of assertion do you get? Does it crash in OnInitDialog?
Best regards,
Alexandru Savescu
|
|
|
|
|
In dlgcore.cpp, function CDialog::DoModal():
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL); //Fails here
this is the first line of the function.
any thoughts??
thanks
|
|
|
|
|
When you wrote the CModemInterface class constructor, did you remember to call the default CDialog constructor, passing along the dialog template Id?
CModemInterface::CModemInterface (CStringArray *s, CWnd *pWnd)
: CDialog (CModemInterface::IDD, pWnd)
{
}
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
Does anyone know of a printf() replacement that will print numbers with commas? For example:
printf("Number is %D\n", num);
Number is 198,456
I need all the normal functionality of printf, but with the comma'd decimal numbers. I realize there are a lot of international concerns with commas, but those aren't an issue for my needs.
RZ
|
|
|
|
|
i don't think there is such an option - you'll have to do this one by-hand
-c
Cheap oil. It's worth it!
|
|
|
|
|
Yes, I know there is no option, that's why I'm looking for a printf replacement that does have it. Several years back I remember seeing some printf() like functions that did this and other fancy formating, but can not find them anywhere.
Doing a Google search for printf is not a pretty sight
|
|
|
|
|
For example:
#include <stdio.h>
#include <locale.h>
int main(void)
{
setlocale(LC_NUMERIC,"Spanish");
printf("%f\n",198.456);
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This isn't what I'm looking for. I want to print an integer number like:
100000
as
100,000
or
10000000
as
10,000,000
using a printf() like function that also works with the other printf formatting fields.
|
|
|
|
|
Oh, misunderstood your question, sorry.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Use the GetNumberFormat API, which returns a new string with commas/decmial points inserted. You can then use that string in your printf call.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
That is the function that I have been using, but it lakes the convenience of a good-ol simple printf. I have to allocate a return buffer, plus fill out a format structure. Nothing beats the single line of code that printf offers.
My task today is going to write a replacement for printf (sprintf actually) that does this formatting.
Thanks.
|
|
|
|
|
you can use the following function; it's not mine and I havent tried it to be honest but it looks persuasive "
// Function inputs a num with commas every 3 places
// e.g. for 1000, add_commas prints 1,000
//
// Program uses recursion (non tail end)z
#include <iostream.h>
void add_commas(int num,int count)
{
if(num < 10)
{
cout << num << endl; // num by now only 1 digit
return;
}
else
{
count++; // count=count+1
if(count%3==0)
{
add_commas(num/10,count); // recursive call
cout << ',' << num%10; // cout comma then remainder of
// num / 10
}
else
{
add_commas(num/10,count); // recursive call
cout << num%10; // no comma just remainder of num/10
}
}
}
void main(void)
{
add_commas(123456789,0); // call add_commas (second param must be 0!)
}
try it you will lose nothing
|
|
|
|
|
I am an extreme newbie to C++!
I am using CreateWindow() to create a window, and it is successful, but I can not find a way to set the window's font size, style, etc...
Is there a simple way to do this or am I missing something completely?
All help is extremely appreciated!!!
Sample:
m_hWnd = ::CreateWindow(TEXT("EDIT"),
TEXT("My Text"),
WS_CHILD | ES_LEFT | WS_VISIBLE | SS_LEFT,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
m_hWndParent,
NULL,
NULL,
NULL);
Thanks,
Troy
troygtroy@hotmail.com
|
|
|
|
|
To change a window's font, you will have to get the device context using GetDC(), then create a font (look up CreateFont), then call SelectObject() to select the font.
Be sure to call DeleteObject() when you are finished with the font, and ReleaseDC() when you no longer need the device context.
Documentation for these functions can be found on MSDN.
Like it or not, I'm right.
|
|
|
|
|
Geez, out with vb's Me.Font = "" and into a whole new world. Thanks for the help and for the quick response. I will follow your lead in MSDN.
Thanks again,
Troy
|
|
|
|
|
Hi, everyone
I am trying to develop some code to connect my local MS Access database. Now I have a very long char string, the length of this string could vary very differently. In my Access database, the field type is Memo. Now I am using ODBC function SQLBindParamenter to try to bind this string dynamically. My question is how should I set the columnsize parameter of the SQLBindParamenter method? I can always set a very huge number, like 50000, but the length of that string still could be larger. what should I do?
Anyone has any suggestions?
Thanks a lot in advance.
|
|
|
|
|
Hi !
Anyone knows about a tutorial where I could learn how to use CSpinButtonCtrl ?
Well, admit I have a MFC App with a CEdit and a CSpin.. next to it. How do I assign the CEdit as the buddy window for the CSpin ? My question could be : how do you retrieve the Cwnd * from a given control ?
Thanks
RaGe
|
|
|
|