|
Try opening Task Manager and selecting the Processes tab. Open the View menu and choose 'Select Columns...'. Check the 'GDI objects' item. This will display a column for the number of GDI objects your application is using.
Software Zen: delete this;
|
|
|
|
|
I went and checked the GDI objects on the task manager and found that when I close the secondary window that I just opened the GDI object count doesn't decrease by the amount that was taken and will continue to grow as I open and close the page.
When I close the page I'm doing:
DestroyWindow();
PostNcDestroy();
My objects on the page are created using:
CButtonST Satus_RX;
CButtonST Satus_DUP;
CButtonST Satus_16F;
CButtonST Satus_16R;
etc.....
Then in InitDialog() I subclass them using:
Satus_RX.SubclassDlgItem(IDC_ALQ122_RX,this);
Satus_DUP.SubclassDlgItem(IDC_ALQ122_DUP,this);
Satus_16F.SubclassDlgItem(IDC_ALQ122_16F,this);
Satus_16R.SubclassDlgItem(IDC_ALQ122_16R,this);
Thus I'm under the impression that these will be delete with the window, am I wrong? What should I do now?
Also, I was looking at CButtonST and it appears that if m_MouseOnButton = 1 then it will re-draw the item every time. I set the button to 1 as this is how I display info from the other computer. example: if the other computer is ON then I set the mouse button to 1 so that its text displays "Running" and the Color is Green. If the other computer is off then the button is set to 0 and displays "OFFLINE" and the button is colored Red. Is this the wrong way to handle this?
Thanks for all the help guys. I've tried to download the GlowCode but haven't been able to yet....
|
|
|
|
|
You shouldn't be calling PostNcDestroy() yourself; it's called by the framework. Child windows are deleted by Windows when their parent is deleted.
I haven't used CButtonST . You might post/email a question to the author of the article it came from.
Software Zen: delete this;
|
|
|
|
|
Please let me know if you have any questions about using GlowCode, or about downloading an evaluation from www.glowcode.com/eval.htm.
Barbara Shafer
VP, Product Management
Electric Software, Inc. ~ developer of GlowCode
www.glowcode.com
|
|
|
|
|
In
int Box::AddString(LPCTSTR str)
{
if( _tcslen(str) == 0 )
why the tcslen? WHy not strlen? If I wanted to use wcslen (says its for wide characters) what would my argument look like?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
_tcslen
is the generic form of the command. It works for ANSI and UNICODE. If you compile for UNICODE it uses the wide character form of the strlen function, and for ANSI the strlen form.
So basically it future proofs your application. Its good practice to get into now.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Good to know. MAny thanks. I did look in the MSDN but it was obtuse...
Appreciate your help,
ns
|
|
|
|
|
I read about _T in MSDN but am not clear :
It says _T is ignored in rgComboBox[index]->SetWindowText(_T("")); so why do it at all? Then when is it necessary to use L("")...I've seen that as well...
Appreciate your help,
ns
|
|
|
|
|
Basically, every (almost) type which starts with T , functions which start with _t are ANSI/UNICODE related.
#ifdef UNICODE
typedef wchar_t TCHAR;
#else
typedef char TCHAR;
#endif
typedef TCHAR* LPTSTR;
typedef const TCHAR* LPCTSTR;
size_t _tcslen(LPCTSTR);
LPTSTR _tcsdup(LPCTSTR);
You get the picture...
--
Eventhough the forrest is full of trees, there's still no tree between the trees.
|
|
|
|
|
|
You know how in IE (for example in my Favorites menu item), if you have too many items that go off the screen, it has a little downward pointing arrow at the end and if you hover on it, the menu items scroll up automatically....
Well, in my MFC project I created a submenu flyout which has 200 items in it. SO when I hover on the submenu the flyout shows up with the downward pointing arrow at the bottom where the list has gone off the screen. But it only moves upward if you press on this arrow, one item at a time, rather than the smooth automatic scroll one expects with windows stuff.....
Is there some sort of flag I can set when I create the popUpMenu that will allow this to happen?
Appreciate your help,
ns
|
|
|
|
|
I don't know the answer I'm afraid, but I can tell that I wouldn't be using an app that had 200 items on a menu.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
I know - its goofy! THe items are merely informative...they dont respond to clicking. But I am considering saying in the flyout "All selected" (it reflects user choices). But I'm not the ultimate decider....
Then when the user does make a reasonable numbe rof selections the flyout can echo that.....
Appreciate your help,
ns
|
|
|
|
|
Got a quick question the following code works in the OnInitDialog function of CPropertySheet, however the same code does nothing in the OnInitDialog function of the CPropertyPage?
// CPropertySheet OnInitDialog code
CRect rect;
CPropertyPage *pPage = GetActivePage();
pPage->GetWindowRect(&rect);
ScreenToClient(&rect);
rect.right += 50;
rect.bottom += 50;
pPage->MoveWindow(&rect);
// CPropertyPage OnInitDialog code
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
rect.right += 50;
rect.bottom += 50;
MoveWindow(&rect);
Now i know it shouldn't matter to me cause i got it working in the sheet, but it's driving me crazy knowing that this should work in each individual page as well!! Help me understand this craziness
|
|
|
|
|
ok, i have a CFormView that is displaying a form image in the background, and placing text on top of it, this is called CDisplayPrintTemplate, I implemented a dragging hand (like adobe's) which works fine.
now i have a new class which is derived from CDisplayPrintTemplate that puts CEdits on the form. When i try to drag the view the form and the text scroll still, but the CEdits just sit still. I have tried moving the dragging code into my new derived class, but the same thing still happens.. I can drag the scrollbar and scroll the window fine..
void CGAFormsView::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_bDown == TRUE)
{
int nYPos = CFPCF::_round(((m_nStartDragY - point.y)) + m_nStartScrollPosY);
if (nYPos > GetScrollLimit(SB_VERT))
nYPos = GetScrollLimit(SB_VERT);
if (nYPos < 0)
nYPos = 0;
this->SetScrollPos(SB_VERT, nYPos, TRUE);
this->RedrawWindow();
}
else
{
::SetCursor(AfxGetApp()->LoadCursor (IDC_HAND_OPEN));
}
}
so what is different about how i am using SetScrollPos() versus how the scrollbar uses it (the scrollbar works fine)? any idea why can't i update the window without RedrawWindow() which causes everything to flicker?
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
In my mainframe i have:
int nIndex2 = m_wndToolBar1.GetToolBarCtrl().CommandToIndex(ID_COMBO1);
int nIndex = m_wndToolBar1.GetToolBarCtrl().CommandToIndex(ID_SLIDER1);
if (!m_wndToolBar1.CreateSlider(m_wndToolBar1.m_slider1, nIndex, ID_SLIDER1, 100, 100))
{
TRACE0("Failed to create toolbar's slider\n");
return -1;
}
int nIndex1 = m_wndToolBar1.GetToolBarCtrl().CommandToIndex(ID_SLIDER2);
if (!m_wndToolBar1.CreateSlider(m_wndToolBar1.m_slider2, nIndex1, ID_SLIDER2, 100, 100))
{
TRACE0("Failed to create toolbar's slider\n");
return -1;
}
I just added the combobox to my class which had sliders before. But in the resource editor I put the ID_COMBO1 at the very end of all the buttons, and when I debug, nIndex2 is indeed as it should be.
However when I run it, the combobox shows up as a blank white space (sort of like an edit box), and its replaced another button that I had in the toolbar!!!!!!
ANy ideas on how to make this behave?
Appreciate your help,
ns
|
|
|
|
|
Its so bizzare! When I reloacted the segment of code that creates the combobox to after the creation of the sliders, it came up in the right place!!!! Strange since I was positioning it by CommandToIndex.....
Appreciate your help,
ns
|
|
|
|
|
My program is running on a Pocket PC and receives some characters, better say a string (like "grün" - thats the german word for GREEN) from a device.
I save the string in a CString . The problem is that when I display the string on my dialog I will see a wrong character for the 'ü' character of the string.
The asci code of the received character is 0x81, but that's the wrong character on my Pocket PC, the asci code für 'ü' on my Pocket PC should be -4 (= 252 = 0xFC).
How can I convert some characters?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
the asci code für 'ü' on my Pocket PC should be -4
No, -4 is only equivalent to 252 only if casting to a 8bit unsigned char . I guess your problem is that you're reading characters from the device into a (signed) char variable and converting them into 16bit Unicode characters, which won't get 252 for ü. Try reading into unsigned char s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello...
Was wondering if anyone knows how to programmatically set the Visual C++ paths for .NET. In the old days of VC6, you could update the registry settings in "HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Directories" which worked just fine. However I could not locate this key for VC7, any help would be greatly appreciated.
- Scott
|
|
|
|
|
HKLM\Software\Microsoft\VisualStudio\7.0\Vc\VC_OBJECTS_PLATFORM_INFO\Win32\Directories
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Hi PJ,
Thanks for the answer, however I have tried that already with no success, sorry I should have mentioned that. It seems that when you insert a path using the registry editor, lets say:
Include Dirs - C:\My Company\My Code\Include;
And open VisualStudio.NET and choose "Tools", "Options", "Projects", "VC++ Directories" and select Include Files, you will not see the path you just added. Additionally, if you add this path from within VisualStudio, you will not see the registry entry update either.
It appears that this registry entry is not really used, or used for another purpose and there is an external file that VS.NET is using to store and read this information from.
Any help in solving this mystery would be greatly appreciated
Cheers, Scott
|
|
|
|
|
Have a look at the file "VCComponents.dat" found in the folder "C:\Documents and settings\<your user name>\Local Settings\Application Data\Microsoft\Visual Studio\7.0\"
I found that by entering a bogus name in one of the directory fields in vs7, and then doing a search for all files containing that bogus name. This was the file that came up.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you, that did the trick!
|
|
|
|
|
hi i am trying to use a hashtable in Visual C++. is there any class in VC++ to create hashtables ?
in some programs i saw that the hashtables is Sizable, for example a hash table with 2 mb Size (i think 2 mb of RAM) is it possible in VC++ to set a size of hashtable ?
thanx a lot
|
|
|
|