|
Either
ListView_SetExtendedListViewStyle(m_hWndYourListViewHwnd,LVS_EX_FULLROWSELECT);
or
SendMessage( m_hWndListviewhwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)LVS_EX_FULLROWSELECT );
==================
The original message was:
how do you make the selected item highlight the full, entire length of all the columns in a CListCtrl. this is hard to explain... please look at the attached picture to see what I am talking about.
|
|
|
|
|
...
or
CListCtrl& ctlList = GetListCtrl();
ctlList.SetExtendedStyle( LVS_EX_FULLROWSELECT );
|
|
|
|
|
You need to call SetExtendedStyle with the LVS_EX_FULLROWSELECT after the window has been created. A good place to do this may be when you add the columns to the list control object. It requires Version 4.70 of common controls dll which is available with IE3+.
Hope it helps.
|
|
|
|
|
Hi there,
i have a really annoying problem with exceptions. On my system (Windows 2000, VS 6, SP3) the following code produces an unhandeld C++ exception:
class TEST {
public:
TEST() {};
};
try {
TRACE("before throw TEST\n");
throw TEST();
} catch (TEST x) {
TRACE ("test catched\n");
} catch (...) {
TRACE ("unkown catched\n");
}
TRACE("after throw TEST\n");
The debug window shows the following:
>before throw TEST
>test catched
>after throw TEST
>Nicht abgefangene Ausnahme in TESTEXCEP.exe (KERNEL32.DLL): 0xE06D7363: >Microsoft C++ Exception.
What's going wrong?
Any help is welcome.
Thanx
Klaus
|
|
|
|
|
Hello Klaus,
What do you really expect of the program? To me, not an expert in exceptions anyway, it is the normal flow.
Probably you may gain some confidence from the ff. MS own codes under the topic "C++ Exception Examples"... Check the MSDN for the expected results and see how this is different or similar to yours. Again, I am not an expert, so take this as my humble piece!!!
#include <iostream.h>
void MyFunc( void );
class CTest
{
public:
CTest(){};
~CTest(){};
const char *ShowReason() const { return "Exception in CTest class."; }
};
class CDtorDemo
{
public:
CDtorDemo();
~CDtorDemo();
};
CDtorDemo::CDtorDemo()
{
cout << "Constructing CDtorDemo." << endl;
}
CDtorDemo::~CDtorDemo()
{
cout << "Destructing CDtorDemo." << endl;
}
void MyFunc()
{
CDtorDemo D;
cout<< "In MyFunc(). Throwing CTest exception." << endl;
throw CTest();
}
int main()
{
cout << "In main." << endl;
try
{
cout << "In try block, calling MyFunc()." << endl;
MyFunc();
}
catch( CTest E )
{
cout << "In catch handler." << endl;
cout << "Caught CTest exception type: ";
cout << E.ShowReason() << endl;
}
catch( char *str )
{
cout << "Caught some other exception: " << str << endl;
}
cout << "Back in main. Execution resumes here." << endl;
return 0;
}
|
|
|
|
|
Hi,
I'm writing a MDI application and I want to put each pair of Doc-View rinning in a separate thread.
Does anyone know how to do this?
Thanks in advance!
|
|
|
|
|
AFAIK, it's not safe or desirable to put user interface elements in separate threads with MFC. Use threading to do the jobs that will take a long time to do in the user interface (and which usually lock it up), for example: Loading a large file, or performing a calculation on a large set of data can be usefully done in a separate thread.
==================
The original message was:
Hi, I'm writing a MDI application and I want to put each pair of Doc-View rinning in a separate thread. Does anyone know how to do this? Thanks in advance!
|
|
|
|
|
Hello,
Check the MS Advanced MFC sample -- MTMDI. It does exactly
what you want. When I studied this the first reaction was why will someone do anything like this, since the sample will still run correctly without the threaded support. Now, I realize such a need do exist!!!
Regards,
Paul.
|
|
|
|
|
Hi,
i am looking for an example which use
a TRANSPARENT(both button and window) toolbar
not in a rebar control
i am trying to host the tool bar in a CWindow(ATL)
derived,and i always get a white background
although the CWindow OnPaint draw a red background
thanks
tomer
|
|
|
|
|
How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?
|
|
|
|
|
use this code...
CString fileName = "c:\\pics\\picture.bmp"; // this should be a path to the file to load, can also use CFileDialog to get path
// this wil load the image from disk into an HBITMAP
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
CBitmap cBmp; // create a CBitmap to hold the image
cBmp.Attach(hBmp); // here is the CBItmap that contains the image
==================
The original message was:
How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?
|
|
|
|
|
I have a view based SDI application. It monitors other process.
If no problems are detected I would like it to be invisible to the user. I do not want it to show on the task bar, nor should someone be able to Alt-Tab to it.
How do I hide the frame and the view?
|
|
|
|
|
Towards the end of your application InitInstance method,
the following lines exit
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
Changing the show (SW_SHOW) to hide (SW_HIDE) or something similar will prevent the window from showing. It will actually initial show and then hide. If you wish to prevent this too, you may have to take care of the actual creation functions in the mainframe class.
|
|
|
|
|
This may have been covered in a previous post, but I don't know because there are just too many previous posts to wade through.
I am trying to print a bitmap graphic that is generated from data. It is in a view, so currently I am just printing the view using the whole doc/view printing made easy functions. Actually, I didn't even have to do any programming at all because somehow it was all set up pretty well already just by the MFC standards. Only I have two imposing problems:
1) My bitmap's y axis is reversed or something, because it isn't just printed upside-down, it is printed with the entire y-axis completely reversed, but the x-axis normal. So my graphic is innacurate.
2) My bitmap is being printed really tiny, which makes it hard to see. Because it is generated from data, it needs to be able to be seen clearly.
So can anyone help me flip the y-axis and enlarge it when it gets printed but leave my view as it currently is (unflipped and not enlarged)? I can't seem to find any useful information on how to do either, because I'm not working with text. Any help would be appreciated.
If you would like to email me, you can do so at: ALeonard@bruker-axs.com
|
|
|
|
|
get the picture into a DC..
then use some code like this...
CPrintDialog printdlg(false, NULL); // instantiate the printer dialog
if (printdlg.DoModal() != IDOK) // show the printer setup dialog
return;
CDC srcDC; // this needs to be the image
HDC hDC = printdlg.GetPrinterDC(); // get a DC to the printer
CDC pDC;
pDC.Attach(hDC); // attach the printer dc to a CDC
pDC.StartDoc("printing"); // start the document
pDC.StartPage("page 1"); // start the current page
int width = 500 // image width
int height // image height
// this next function will stretch the image to full size (as it is displayed)...
pDC.StretchBlt(0, 0, width * 3, height * 3, &srcDC, 0, 0, width, height, SRCCOPY);
pDC.EndPage();
pDC.EndDoc();
==================
The original message was:
This may have been covered in a previous post, but I don't know because there are just too many previous posts to wade through.
I am trying to print a bitmap graphic that is generated from data. It is in a view, so currently I am just printing the view using the whole doc/view printing made easy functions. Actually, I didn't even have to do any programming at all because somehow it was all set up pretty well already just by the MFC standards. Only I have two imposing problems: 1) My bitmap's y axis is reversed or something, because it isn't just printed upside-down, it is printed with the entire y-axis completely reversed, but the x-axis normal. So my graphic is innacurate. 2) My bitmap is being printed really tiny, which makes it hard to see. Because it is generated from data, it needs to be able to be seen clearly.
So can anyone help me flip the y-axis and enlarge it when it gets printed but leave my view as it currently is (unflipped and not enlarged)? I can't seem to find any useful information on how to do either, because I'm not working with text. Any help would be appreciated.
If you would like to email me, you can do so at: ALeonard@bruker-axs.com
|
|
|
|
|
I did exactly what you have said to do here. But, apparently some printers do not support
dc.StretchBlt (). They did before because my code worked for about a year. I don't know
what happened but it stopped working.
I am now trying as follows (with little success):
HANDLE hBitamp = ::CreateCompatibleBitmap (printerDC, width, height);
memDC.SelectObject (hBitmap);
// do some drawing into the printerDC
CBitmap it;
it.Attach (hBitmap);
unsigned char *bits = new unsigned char [640*480];
it.GetBitmapBits (640*480, bits);
::StretchDIBits (printerDC.GetSafeHdc (),.... bits,....);
And it does most of what I want. The image is flipped about the Y axis, but that's not a
problem. But, none of the line graphics appear. Any ideas?
Thanks,
Mike
|
|
|
|
|
how do you add items (subitems) under a column header in a CListView control?
if you don't understand my question, please look at the image I attached. it should explain it.
|
|
|
|
|
ListView_SetItemText(GetDlgItem(IDC_YOURLISTIVEW), iRowNumber, iColNumber,"Text");
==================
The original message was:
how do you add items (subitems) under a column header in a CListView control? if you don't understand my question, please look at the image I attached. it should explain it.
|
|
|
|
|
how do you add items under column headers in a CListView (using report view). ie: subitems
|
|
|
|
|
after i highlight the text the text will be able to change colour
so i can know that the text has been highlight before
|
|
|
|
|
I have a child program that is opened by a parent app. This child program is actually a seperate fully
functional program (such as a game) that is executed as a child program of the parent. This
child program has user buttons on it, how would I get my parent app to send a click event to this
user button contained within the child program?
|
|
|
|
|
I'm trying to build a simple ActiveX server control for use in my ASP pages.
The coding part is going just fine, but the stopping and rebooting of my web servers is driving me crazy.
If I just try to do a NET STOP on all the web services, the .dll *will* unload and I can copy it over, but when I try to do a NET START I get a 1068 error saying one of the support services failed to load. Which requires me to reboot the machine before I can get it working again.
I've been searching through MSDN (which usually answers my questions just fine, but I can't find anything about remote compiling and stopping/starting the web services).
If anyone has a better method, I'd love to hear it.
|
|
|
|
|
I'm trying to build a simple ActiveX server control for use in my ASP pages.
The coding part is going just fine, but the stopping and rebooting of my web servers is driving me crazy.
If I just try to do a NET STOP on all the web services, the .dll *will* unload and I can copy it over, but when I try to do a NET START I get a 1068 error saying one of the support services failed to load. Which requires me to reboot the machine before I can get it working again.
I've been searching through MSDN (which usually answers my questions just fine, but I can't find anything about remote compiling and stopping/starting the web services).
If anyone has a better method, I'd love to hear it.
|
|
|
|
|
When I add buttons to CMDIChildWnd I cannot tab between them, but the buttons respond on mouse. How make the tab key working ?
|
|
|
|
|
Hello -
I've a client application. The server sends data packs through a stream socket. It works very well for clients running on WinNT and Win95/98. But for some how, when I run the client in a Win2000 PC, whenever the server sends a specific large message (large compared with the other messages, but it's about only 650 bytes long) the client side gets a disconnection notification with error WSAENOBUFS.
I don't believe socket buffer are this small in Windows 2000. Does anyone out there have any clue... tip... trick?
Thanks in advance.
Best regards.
- Thales
|
|
|
|