|
I want to set align for each column in my listview
so I get handle of header control of listview then
use SetItem member function of CHeaderCtrl to do this.
About Align => ok, I got it but I lost all caption
(text) in each column header (no text in headers)
if I use only hdi.mask = HDI_TEXT; >> my texts will
not disappear
What I need to do to set align for each column and
all text is still appear
/////////////////////////////////////////////////
#define LEFT 1
#define CENTER 2
#define RIGHT 3
MyListViewCtrl m_ListCtrl;
m_ListCtrl.cColumnMax = 4;
m_ListCtrl.InsertColumn (0, "#");//left-default
m_ListCtrl.InsertColumn (1, "ID");//left
m_ListCtrl.rgcAlign[1]=1;
m_ListCtrl.InsertColumn (2, "Name");//center
m_ListCtrl.rgcAlign[2]=2;
m_ListCtrl.InsertColumn (3, "Cost");//right
m_ListCtrl.rgcAlign[3]=3;
m_ListCtrl.SetAlign();//set align for all column
////////////////////////////////////////////
void MyListViewCtrl::SetAlign()
{
CHeaderCtrl* pHeader = GetHeaderCtrl( );
HDITEM hdi;
for (int i=0; i<ccolumnmax; i++)=""
="" {
="" char="" buffer[256];="" ="";="" hdi.mask="HDI_TEXT|HDI_FORMAT;
" hdi.psztext="buffer;
" hdi.cchtextmax="256;
" verify(pheader-="">GetItem(i, &hdi));
hdi.fmt = (rgcAlign[i]==LEFT?HDF_LEFT:(rgcAlign[i]==CENTER?HDF_CENTER:HDF_RIGHT));
hdi.pszText = buffer;
hdi.cchTextMax = 256;
VERIFY(pHeader->SetItem(i, &hdi));
}
}
|
|
|
|
|
Check the replies in the microsoft.public.vc.mfc newsgroup.
|
|
|
|
|
Hi,
I am filling my tree control with elements, and each element has an image. but there are some elements that dont need an image. How can I do this? (I ve been stuck on this all afternoon )
I create and load the image list like this:
m_imageList.Create( IDB_SIMULATIONICONS /*name of the bitmap*/,
17 /*size of the bitmap*/,
1 /*ngrow*/,
RGB(255,255,255) /*mask*/ );
m_tree.SetImageList( &m_imageList, TVSIL_NORMAL );
I insert my elements to the tree like this:
HTREEITEM item;
item = m_tree.InsertItem( "Tree Item",
3 /*image index nr.*/,
4 /*selected image index nr.*/
);
I have tried NULL and -1 but it doesnt work. I would appreciate any help.
-thanks
A. Paluszny
|
|
|
|
|
You can't. The only way to do that is to custom draw your Treecontrol, which is not easy. You could display an empty image, but the items position would be shifted from the image width, and it looks ugly IMHO (items seem to hang in the air )
~RaGE();
|
|
|
|
|
Maybe somebody of you can guide me you to use the QoS SDK in order to use it as a Bandwidth Manager. I've searched for hours but without any success, maybe there is an tutorial or source code available.
thank you
Mario
|
|
|
|
|
I am running Visual C++ 6.0 Standard and when i compile my programs, the compiler never completes. I must then end the process to close c++ 6. If anyone can help, it would be appreciated.
|
|
|
|
|
Does it happen for hello world type program ? all programs or just one in particular ?
put some of your code in comments, and check where it freezes ?
if nothing works, uninstall VC and reinstall, apply patches and service packs; upgrade platform SDK, ...
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Hi i'm writing a multithreaded TCP server with my own protocoll. I had to switch to a simple multithreaded model because Win9x doesnt support IOCP. I've looked at a lot of examples already, but still i face the same problem. The samples i've looked at have a client thread function that handles each client seperately (like and echo server of files transfer server or whatever). But the problem is that i need to be able to send data to all of the clients at once, like a chat server would do.. When someone types a message, it gets processed and depending wether its a private message or a message intended for a certain room or just all clients it is broadcasted or sent to a specific ip. I thought about making a list of all the socket handles that have a connection running and then simple making a function that sends the data on all these sockets but i am affraid this will mess up the threads somehow.. and that it is just too simple. Does anyone know how this is generally implemented?
Kuniva
--------------------------------------------
|
|
|
|
|
This DWORD offset points to a list of null terminated strings containing alternate RAS phone numbers. I have gotten it to work using Visual C++ 6.0/Windows 2000 but it only seems to allow phone numbers.
Does anyone know if there is some magic format that will allow me to include strings for the alternate phone entry comments line? We have been manually copy and pasting numbers for ISP's for our state in the phonebook files and would like to automate it. The comment line is necessary to identify what city the phone number is good for.
I can parse the phonebook for the entry's key after using RASSetEntryProperties and trigger off of 'DEVICE=modem' to insert the alternate list including the comments section but this seems somewhat cheesy.
Any suggestions or alternate solutions welcome,
Thanks
|
|
|
|
|
hello,
I have a big problem, I want to print a page (with MFC) and everything worked fine until I tried to print a colored text .... if I try to draw on printer CDC a color line or rectangle it works but with text don't ! why ?... if my color is less then RGB(255,128,0) the text is black if my color is greater the text is white ... please help ...
thanks!
|
|
|
|
|
maybe a silly answer..
but maybe your printer driver has got gray-scale set as default?
check out the DEVMODE -structur (membervar in CPrintDlg).
It has a member dmColor. It can be set to DMCOLOR_COLOR or DMCOLOR_MONOCHROME. Set it correctly and it should work.
<code>
CPrintDialog dlg;
m_DC = new CDC;
m_DC->Attach(r_printdlg.GetPrinterDC());
m_DC->m_bPrinting = TRUE;
DEVMODE* pDevMode = r_printdlg.GetDevMode();
pDevMode->dmColor = DMCOLOR_COLOR;
m_DC->ResetDC (pDevMode);
Maybe this works..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
Dear All,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000. I have used some header files to support some functions , I have included a header file #include <afximpl.h> which is giving error
The error is:
fatal error C1083: Cannot open include file: 'afximpl.h': No such file or directory
Error executing cl.exe.
Can any body suggest why this error is coming and some way to solve this error.
I have this header file in my vc/src directory
Feel free to ask any further queries in this regards,
Thanks
Rohit Dhamija
|
|
|
|
|
Try this: #include "..\src\afximpl.h"
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
It could be a number of things. First click Alt+F7 (Project/Settings). Select the C++ tab, and the Preprocessor category. In the Additional include directories box, add the (absolute or relative) path to the ...\MFC\SRC folder.
Did that do it?
|
|
|
|
|
I tried this still the problem remains there.
Any other way ?
|
|
|
|
|
Ok, let's rule out the obvious. Put the absolute path to the .H file in the #include statement.
Also, what is your INCLUDE environment variable set to?
|
|
|
|
|
Dear David,
I have set the path to absolute but it didnot solved my purpose. what do you mean by:
...Also, what is your INCLUDE environment variable set to?
//////////////////////////
http://www.thecodeproject.com/shell/RecycleBin/RecycleBin_src.zip
/////////////
I compiled this code and it gave the header file error.
Can you plz run it on your system and tell what may be the error.
Thanks.
|
|
|
|
|
Ok, I compiled the code as-is and got the C1083 error. Then I simply followed the instructions here and it compiled fine.
|
|
|
|
|
How to activate some choosen thread?
Even if it in sleep(time) state.
Thanks you.
|
|
|
|
|
what do u mean with 'activate'?
please explain your situation a little more precise!
Don't try it, just do it!
|
|
|
|
|
Do you want your routine to be called by a timer?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
|
What you really wanted to ask did not come across very good.
Did you look up SetTimer() , which will call a function of your programm in regular intervals?
Does it help you?
If working with MFC, be sure to also look up CWnd::SetTimer() and CWindow::SetTimer() !
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I work with Windowless ATL ActiveX.
I need to implement Window class to get a timer?
Or a possible to use some system timer,
like myltimedia timer?
Or I can do it with system syncronizing methods and objects?
|
|
|
|
|
The Win32-API call SetTimer() can either send your window a WM_TIMER, or you can provide it with a function to call. This is probably what you want to do.
I do not have any idea about multimedia timers, so I can not tell you if they are of any value in your case.
As for system synchronizing methods, I do not understand you fully, but if you mean something like WaitForSingleObject() , then no, this won't wake your application from a Sleep() . If you need to wait until, say, a socket or disk IO times out, then it might help you (but I can not )
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|