|
Hi
I`m in trouble with setting a bitmap in any row I want in ClistCtrl.
I have no problem to make a ImageList, but it put the same bitmap
in every row. I need to put any bitmap in any row I want.
The CListCtrl was made by MFC-Wizzard.
Can anybody help me ?
thanks,
Sascha
|
|
|
|
|
Post your code related to SetImage and imageList
|
|
|
|
|
I'm not sure, but I think that if you don't set an image explicitly for an item it gets the first from the imagelist.
Be sure to pass LVIF_IMAGE to SetItem in the 'mask' argument only for those items you want to have images.
I have no other ideas.
|
|
|
|
|
Hi,
Is it possible to change the menu which resides in the menu bar in run-time? I would to enable/disable pop-up menus which resides in the command bar menu.
I know how to modify menu item inside a menu but I don't know how to change the top pop-up menu.
Thanks,
Shai
|
|
|
|
|
Dear Shai,
Here's something that might help:
BOOL CMainFrame::DoChangeMenu()
{
CMenu menu;
if (!menu.LoadMenu(IDR_MYMENU))
return FALSE;
if (!SetMenu(&menu))
return FALSE;
DrawMenuBar(); // refresh menu bar with new menu
return;
}
Hope that helps!
|
|
|
|
|
Hi,
how can I detect whether an integer operation like a+b or exp(i) generates an overflow? When adding two big numbers like INT_MAX-4 and INT_MAX-25, the result will be negative and no error is generated. In mathematics, such overflows can also happen when using __int64 data type. Who has a solution?
Thanks
Andreas
|
|
|
|
|
You can test the overflow flag with the _asm instructions jno and jo. You can also explicitly invoke the integer overflow trap if you want to use exceptions:
void CTestDirDlg::OnButton2()
{
int a, b, c;
a = INT_MAX - 4;
b = INT_MAX - 25;
try {
c = a + b;
_asm {
jno wereOk;
int 4;
}
}
catch(...) {
MessageBox( "Overflow!", "Error");
}
wereOk:
return;
}
I realize there is the issue of portability here, but its one possible solution - could be refined. Using SEH you might be able to identify the EXCEPTION_INT_OVERFLOW exception with more certainty than the catch(...), and avoid the _asm.
You might not even want to throw the exception, just test the flag.
I think there is code out there somewhere that can convert these kinds of traps to C++ exceptions - or perhaps it would be better to just throw our own exception object, rather than invoking the processor trap. The trap might be useful if you want to enable first-chance exception handling for c0000095.
I can't seem to find a way to enable this trap in the way that we can enable floating point exceptions with controlfp.
|
|
|
|
|
OK, works fine. But what is with other operations like multiplication, and other data type like long or __int64?
|
|
|
|
|
How can I change resource for dialog form a meny in that dialog.
|
|
|
|
|
hi,
i am using MFC, i create a CDialogBar in a CRebar and my CDialogBar has 3~4 editboxes, however, i cannot uses ctrl+c or ctrl+v in these textboxes anymore and also cannot tabs thru the controls. the problem is so obvious so i think it must be something i missed.
pls help!!
gordon
|
|
|
|
|
Can someone please enlighten me about how to maximize the app's mainframe at startup? I have tried calling ShowWindow() from the InitInstance() and that doesn't do it. I've looked through the MS docs in the Visual Studio 6 and not come accross anything relevant (like a code snippet, for example!) Some pointers would be greatly appreciated!
One person suggested setting the style to WS_MAXIMIZE in PreCreateWindow() but that does not do it.
|
|
|
|
|
In the CWinApp descendent:
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
m_pMainWnd->UpdateWindow();
SW_SHOWMAXIMIZED does it for you.
Also in the Application wizard in step 4 of 6 there's an Advanced Button. Follow that button to the Windows Style Tab and check the Maximized box.
|
|
|
|
|
Both of them are correct!!
but only if you join both of their answers
at InitInstanse there is a variable called
p_MainWnd
do the following
p_MainWnd->ShowWindow(WS_MAXIMISE);
a good place to put it is at the end of that function
|
|
|
|
|
You don't want to pass WS_MAXIMIZE, a style code, to ShowWindow.
You're supposed to do as Mr. Warg pointed out:
Change
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
to
pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
pMainFrame->UpdateWindow();
Note the WS_* in front means a *W*indow *S*tyle code, whereas the SW_* in front means a *S*how*W*indow code.
AppWizard supplies the
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
code for you; all you have to do is to replace the m_nCmdShow with SW_SHOWMAXIMIZED, and you're in business!!
Brian Hart
|
|
|
|
|
I'm trying to find out from an application if another one has blocked (ie. "Not responding" in the NT Task Manager). How do I do that?
Thanks
|
|
|
|
|
Do any of these extra macros for code formatting do word wrapping on comment blocks? I would really like something like this. So when you have a large comment block like:
// blah blah blah blah blah blah blah blah blah
// blah blah blah blah blah blah blah blah blah
// blah blah blah blah blah blah blah blah blah
And you have to edit it a lot, you don't have to manually word wrap it. Anyone know a macro that does this?
|
|
|
|
|
Can anyone explain the situations in which SelectObject will return NULL? I'm writing code to print a bitmap (see my message in the discussion for the article "Printing Made Easy") and it is returning NULL. My bitmap and memDC appear to be fine.
Thanks in advance.
|
|
|
|
|
I am trying to capture the Tree Item the cursor is over and when I use the below code in the "Right-Click"...It always returns NULL??? Can anyone help me???
CPoint MousePosition;
GetCursorPos(&MousePosition);
TVHITTESTINFO HitInfo;
HitInfo.pt = MousePosition;
if (m_ctrlTree.HitTest(&HitInfo) != NULL) {
int Mask = TVHT_ONITEM | TVHT_ONITEMRIGHT;
if (HitInfo.flags & Mask) {
m_ctrlTree.Select(HitInfo.hItem, TVGN_CARET);
CString csTest = m_ctrlTree.GetItemText(HitInfo.hItem);
MessageBox(csTest);
}
}
Dan
|
|
|
|
|
GetCursorPos() returns screen coordinates. You need to convert that point to client coordinates of the tree control:
m_ctrlTree.ScreenToClient ( &MousePosition );
|
|
|
|
|
Thanks Mike...That was it, I guess sometimes it takes a new set of eyes to see clearly. I actually used this before but had commented out the "GetCursorPos()" instead of leaving it there???
Thanks again,
Dan
|
|
|
|
|
I'm developing an app that usues msvfw32.dll and avicap32.dll in Win98. If either when running under debig mode I press SHIFT+F5 (end debug) or something I wrote causes the app to crash the two DLLs stay loaded. In then need to reset my PC for everthing to work again.
Does anyone know how I can remove loaded DLLs in win98 please? It's a pitty the CTRL+ALT+DEL window doesn't list them!
Thanks
|
|
|
|
|
I have made a custom CPrintDialog and I want touse it instead of the default one, without manage the whole printing process.
Can I tell MFC to use my dialog just before the beginning of the process?
Thanks, ...
|
|
|
|
|
You will likely need to implement in your CView derived class, a DoPreparePrinting() method and do *NOT* call the base class method. You will still need to set all of the PRINTINFO structure members as required, but instead of using CPrintDialog member, you can instantiate your own dialog instead. Have a peek at the MFC source in VIEWPRNT.CPP for what the base class does and that should help you figure out the stuff you need to do instead.
HTH.
|
|
|
|
|
Project: Write a simple program that will sit in background and alow easy and reliable transfer of files from computer to computer on a windows network.
Problem: At first I thought it would be a simple task of slight modifications to an old pascal IPX chat program that I wrote mainly in assembly a year or so ago. BUT I now found out that I can not use inturrupts in Inline Assemebly in VC6++.
Does this mean that I have got to learn WinSock if I want to program a network program or is there another way to send IPX data over a network using VC6++?
|
|
|
|
|
I don't think there is any "Built In" IPX functionality in MFC or in the Platform SDK, but I may be wrong.
What about downloading the Novell SDK from developer.novell.com?
|
|
|
|