|
I have always assumed (and never been proved wrong) that the subitem is the same as the column number. As far as I have been able to tell, there is nothing else associated with the subitem number, although the MSDN information does not make it perfectly clear.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I have map
typedef std::map<int, mydatatype=""> myMap;
myMap m1, m2;
.....
m1 contains old data, m2 - new data. Normaly I am doing so
m1 = m2;
but it does actual copying. How can I copy refference m2 to m1 ?
|
|
|
|
|
You need to use pointers rather than references like:
typedef std::map myMap;
myMap *m1, *m2;
m1 = new myMap;
m2 = new myMap;
m1 = m2;
However, this will affect all the code in between so may not be the optimum solution to your problem.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
If you don't need m2 after its been used to update m1 use the swap function:
m1.swap(m2);
Steve
|
|
|
|
|
See more: VC++
Dear All,
I am working MFC Application, this application is compiled using VS2008.
To capture the key pressed
OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
method is used.
The strange thing happening is when i press the key "a" without caps lock its gives the nChar value as "65" which is suppose to be "97".
Even if the caps lock is "ON" the value i get is "65" when i press "A".
The thing is either the caps lock is on or off, i get the same value as if the caps lock is on. (this is the case with all the keys)
as the OnKeyUp() is as MFC method, I am not sure how to solve this issue.
Kindly help me and let me know if you require any more information.
Below is the code i am using, because of this what happens is, when i set a text using SetDlgItemText(), it is always going as Upper case letter or word.
void CMyProg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CString SBCommand;
CString Temp;
char *s = NULL;
char strnChar[10];
/* Alphabets and Numerals passed to the command box */
if((nChar >= 65 && nChar <= 90) || (nChar >= 48 && nChar <= 57))
{
pFrame->m_wndStatusBar.GetDlgItemText(IDC_SB_POINT,SBCommand);
Temp.Format("%c",nChar);
SBCommand += Temp;
pFrame->m_wndStatusBar.SetDlgItemText(IDC_SB_POINT,SBCommand);
/*pFrame->m_wndStatusBar.GetDlgItemText(IDC_SB_POINT,SBCommand);
SBCommand += (char*)nChar;
pFrame->m_wndStatusBar.SetDlgItemText(IDC_SB_POINT,SBCommand);*/
}
}
|
|
|
|
|
OnKeyDown: The key is Kept Down
OnKeyUp: The Key is released
The above two together form OnKeyPress
All three will give the state of the Keys.
OnChar is the best event for your expectation.
|
|
|
|
|
The character value is a virtual-key[^] code. You can use GetKeyState(VK_SHIFT) to check if any shift key is pressed or not.
Depending on your requirements, it may be better to handle WM_CHAR notifications (CWnd::OnChar() ) rather than using key up/down notifications. Then you will get the character code of the key that was pressed.
|
|
|
|
|
In addition to VK_SHIFT , you may also want to check the state with VK_CAPITAL .
|
|
|
|
|
Hi In VC++ 2005 i am working in SDI applications
1) How to change the whole background color of CStatusbar including all panes.also
2)How to change background color of a Menubar.
|
|
|
|
|
You will have to owner draw it.
For ex:
For the status bar you can do something like:
m_statusBar.SendMessage (/*setback color msg/*, 0 , (LPARAM)RGB (128,128,128)) ;
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
hi can you give the example.
|
|
|
|
|
Here[^]. here[^]
Also, you can find many other examples relating to owner drawn controls
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
|
Hi all
I created a Activex, when you click a button in Activex opens a FileDialog but when I click on treeview with folders list the list files screen is not update.
I started with C:\ folder, even I change folders in treeview or press F5 nothing happens. I'm using Windows 7 and this problem just happen inside a ActiveX and IE9. In the older version this just not happen and the code is the same.
Here is the code:
CFileDialog dlg(TRUE, szMask, szPath,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
aux, NULL, 0, TRUE);
dlg.m_ofn.lpstrInitialDir = initialDir;
if (dlg.DoModal() != IDOK) {
return;
}
Anyone can help me.
Thank you
|
|
|
|
|
What value are you passing in szMask?
|
|
|
|
|
Hi
I'm using default All files (*.*)
|
|
|
|
|
I think in this case you should pass NULL. Please note that you need to pass only extension, e.g. for Excel files you would pass _T("xls"). For all files, pass NULL in place of szMask
|
|
|
|
|
Thank you
But my problem is not with mask, when I use my activex component inside IE9, when I click on treeview with folder names the screen where show files are not refreshing, my initial dir is C:\ but if I click in e.g D:\ nothing is showed, the screen stays in C:\. This just happen with activex in browser. I could check if set to FALSE the last parameter in CFileDialog constructor is working in both cases, in my application and browser, this parameter set Vista Style dialog, but is not a acceptable solution.
|
|
|
|
|
Can someone please explain / provide better description about this C2010 error to me.
I have never used “...” ellipsis as function parameter.
Why is the compiler complaining about this?
Is this some recent addition to the language?
I am still happily using VC 6.0 and have no desire to let go of it.
Source:
#define USBERR(format,...) usb_err(__FUNCTION__,format,__VA_ARGS__)
#define USBERR0(format) usb_err(__FUNCTION__,"%s",format)
Error:
k:\0\0 littlewire\downloads\usb library\libusb-win32-src-1.2.6.0\libusb-win32-src-1.2.6.0\src\error.h(131) : error C2010: '.' : unexpected in macro formal parameter list
Only the first #define fails and I am not really sure I need it. I would be happy just to compile this USB library for now.
Any help will be as always greatly appreciated.
Thanks Vaclav
|
|
|
|
|
See Variadic Macros[^] in the MSDN.
The above link is for Visual Studio 2005 which introduces Variadic Macros. So it seems that you are using an older VS version.
|
|
|
|
|
Thank you.
My suspicion was correct, it is a recent (MS? ) addition to the language.
I'll try to bypass it and see if there are any serious problems with it.
I have not analyzed the library to see if the macro is executed as a result of logic error or hardware error.
|
|
|
|
|
|
Vaclav_Sal wrote: Only the first #define fails and I am not really sure I need it. So comment it out and see what happens.
You could always create something like:
#define USBERR1(format,argv1) usb_err(__FUNCTION__,format,argv1)
#define USBERR2(format,argv1,argv2) usb_err(__FUNCTION__,format,argv1,argv2)
#define USBERR3(format,argv1,argv2,argv3) usb_err(__FUNCTION__,format,argv1,argv2,argv3)
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi everybody. I trying to draw an overlay over a CDib bitmap:
CSize sizeDoc = pDoc->GetDib()->GetDimensions();
int cx = (int)((float)sizeDoc.cx * m_fZoomFactor);
int cy = (int)((float)sizeDoc.cy * m_fZoomFactor);
CSize sizeLog(cx, cy);
CBitmap bmp;
bmp.CreateCompatibleBitmap(pDC, sizeLog.cx, sizeLog.cy); CDC MemDC;
MemDC.CreateCompatibleDC(pDC); CBitmap* pOldBitmap = MemDC.SelectObject(&bmp); pDoc->GetDib()->Draw(&MemDC, CPoint(0,0), sizeLog); DrawOverlay(&MemDC, pDC); pDC->BitBlt(0, 0, sizeLog.cx, sizeLog.cy, &MemDC, 0, 0, SRCCOPY); pDC->SelectObject(pOldBitmap);
and everything goes well, except when user try to drag the view, while view goes slowly ... why ? (That behaviour is more visible when the picture is a little bit zoomed)How can I speed up the code from above ? Or, what I'm doing wrong ?
I have here[^] a simple sample project .... Thank you.
modified 16-Oct-12 7:28am.
|
|
|
|
|
The problem is with this line:
pDoc->GetDib()->Draw(&MemDC, CPoint(0,0), sizeLog);
You need to replace it with another BitBlt that will copy stuff to MemDC
|
|
|
|
|