|
You can create a Registered Message and send this message to all child windows using SendMessageToDescendants .
Make sure you send it to all immediate child windows only.
Have a message map entry in each child window for this message. Do updation there.
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu,
Great. I never thought of this function.
Thanks a lot for your fruitful suggestion.
Sarvan AL
|
|
|
|
|
Hello,
I'm trying to add some text to a picture, drawing with the CxImage DLL.
The picture will be draw, but the text doesn't.
This is the code:
CPaintDC dc(this);
CRect rcDraw;
GetClientRect(&rcDraw);
CString text = "Test";
COLORREF color = 0x00FFAFFF;
// Draw Image
m_pImage->Draw(dc.GetSafeHdc(), rcDraw);
m_pImage->DrawString(textdc.GetSafeHdc(),0,0,text,m_pImage->RGBtoRGBQUAD(color),"Arial",1,400,0,0,true);
What's my fault???
Thank you for answers!!
Greatings
RiHaus
|
|
|
|
|
i m new to activeX controls.i had used datagrid in VC++. data grid contains more rows than visible ones. i send message to grid for updating a particular row.if this row is not visible in the grid then error : invalid row number is displayed.
so now can anybody tell me the way so that i can make that particular row visible.
i need immediate help on this. plzzzzzzzz help me
--------------------------------
jiteen tilekar
|
|
|
|
|
Your question is not very clear. Why are you sending a message to the grid control ? I think it offers some functions that allows you to show or hide rows (I'm not sure).
helpcode wrote: if this row is not visible in the grid then error : invalid row number is displayed.
What is the exact error ? I suppose this is a runtime error (something that happens when you execute your prog, not during compilation). Do you get a message box showing an error message ? Can you post the EXACT error message ?
I guess you try to access a row that is not in the control: the rows are zero-indexed, which means that the first rows is 0 and the last one is RowCount-1 (you probably try to access the row at RowCount)
|
|
|
|
|
the error messagebox is :
Invalid Row Number
this error is not at runtime or design time.but rather i think is it a limitation of DBGrid control?? here from combo if i select row number 20 and grid is displaying only 10 rows at present then this error displayed
But after scrolling manually rows if now grid is displaying rows from suppose 15 to 25 or a range in which row num 20 is there ,then it works fine.
now u can guess i have access to only those rows which r displayed in grid at that time....
jiteen
|
|
|
|
|
helpcode wrote: this error is not at runtime or design time
Yes, this is a runtime error: you get an error message when something happens during the execution of your program.
helpcode wrote: here from combo if i select row number 20 and grid is displaying only 10 rows at present then this error display
That is logical ! If there are only 10 rows in the grid and you try to access an inexistant row, you will get an error. That seems perfeclty logical to me. You cannot access something that doesn't exists. Or what ? How many rows do you have in your grid ?
Post the code of: 1) the creation of your grid and when you add rows to it and 2) the code which is giving you the error.
|
|
|
|
|
this event i have written on combo selection.
m_msdGrid : obj. of DBGrid control's CMsDGridCtrl class
i got error on this line: m_msdGrid.SetRow(i);
all the rows r present in the grid.
eg if u wanna to see this docu. u will scroll it. but at first only some aprt is visible.u need to scroll to see rest of it. same case is there.all the rows r there in the grid.but for seeing 20 th row u need to scroll down.
i need auto scrolling so that even if i selected any row from the combo control the grid should be scrolled to that row until that row becomes visible in the grid view.
void CProppage::OnIdSelected()
{
CString strGridID;
m_cmbReaderID.GetLBText(m_cmbReaderID.GetCurSel(), m_strReaderID);
if(m_strReaderID.IsEmpty())
return;
long lReader = atol(m_strReaderID);
m_msdGrid.SetCol(0);
for(int i = 0; i
|
|
|
|
|
hi,
I have derived a class ListCtrlEx from CListCtrl and exported that class in a dll. The ListCtrlEx containes some member variables of CRect and CString.
Now in a standard MFC dialog based application, I have created a class which is derived from ListCtrlEx. Then when compiling I am getting some warning saying..
"warning C4251: 'm_MinBtnRect' : class 'CRect' needs to have dll-interface to be used by clients of class ListCtrlEx"
What is problem.. How can fix this warning( i don't want to use #pragma disable )
Thanks in advance
nave
|
|
|
|
|
|
Hi,
I have one menu as PanelMenu in Doc/View and it contains some popup menus...I have to delete the main menu as well as pop up menu..
I used DeleteMenu command but it deletes only the PopUp menu.
I have to delete the main menu itself.
Wat can i do?
-- modified at 1:27 Thursday 27th April, 2006
|
|
|
|
|
Anu_Bala wrote: I have to delete the main menu as well as pop up menu..
Anu_Bala wrote: I have to delete the main menu itself.
What about SetMenu(NULL) ;
Nibu thomas
Software Developer
|
|
|
|
|
Hi all!!
Does there anyone know what's the difference between CDialog and CView?
I would appreciate your reply!!
|
|
|
|
|
See MSDN CView and CDialog
it's perfect.
|
|
|
|
|
Questions for you genius coders out there:
1) Are the iterators for maps produced random? I need to be able to call random_shuffle, and I want to make sure I can with this type of container.
2) Is there a way to insert to the front of a map, even if the key I want to insert isn't lexiographically the first key listed? (i.e. if I call begin, then I want to see it first)
3) Can I store dynamically created objects in a map?
Thanks very much in advance!
-- modified at 0:03 Thursday 27th April, 2006
|
|
|
|
|
1) They are bidirectional iterators, not random access.
2) No.
3) Yes - store a pointer to the object.
Calling random_shuffle makes no sense for a map .
Steve
|
|
|
|
|
1 - No, maps are hash tables. So, I believe that they generate a hash and use that to decide what bucket to put stuff into
2 - I don't believe so
3 - sure. If you do, it's the memory address that will be hashed, I would think, and I would think that would be as close as you'd get to a random insert order, although I still don't think you can shuffle it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ok then what's the best data structure for:
1) Being able do a random_shuffle () on,
2) Being able to search by key to get to a value.
I'm using vector right now, but I have a key-value pair combination that I need to update fairly often, so it seems like a map would be ideal for this..., but if this is the case, I need a way of randomly shuffling the map somehow, so when I do an interator and go from the beginning to the end, its random every time.
|
|
|
|
|
Can't you turn the keys into a list and then shuffle that ? How often do you need to shuffle them ? I'd think a list of the keys which you shuffle would be the way to go here.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You can get the best of both worlds by combining the two: use a std::map for fast access to data but a std::vector of std::map::iterators into the std::map which you can shuffle. Here's an example using sets.
------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
typedef std::set<string> StringSet;
typedef StringSet::const_iterator StringSet_CI;
typedef std::vector<StringSet_CI> StringSetIterators;
typedef StringSetIterators::const_iterator StringSetIterators_CI;
int main(int argc, char* argv[])
{
const char* Names[] = {"Bob", "Sue", "James", "Ralph", "Steve", "Paul", "Kim", "Mary"};
const char** pEndNames = &Names[sizeof(Names)/sizeof(Names[0])];
// A map of strings.
StringSet strings;
// Fill the set with the names.
copy(Names, pEndNames, inserter(strings, strings.end()));
// Output the set to the console.
cout << "Names in set:" << endl;
copy(strings.begin(), strings.end(), ostream_iterator<string>(cout, "\n"));
cout << endl << endl;
// Vector of set iterators.
StringSetIterators ssi;
StringSet_CI e = strings.end();
for ( StringSet_CI i=strings.begin(); i!=e; ++i )
{
ssi.push_back(i);
}
for ( int times=1; times<=3; ++times )
{
// Shuffle the iterators.
random_shuffle(ssi.begin(), ssi.end());
// Output through the shuffled iterators.
cout << "Shuffled names:" << endl;
StringSetIterators_CI ee = ssi.end();
for ( StringSetIterators_CI ii=ssi.begin(); ii!=ee; ++ii )
{
cout << *(*ii) << endl;
}
cout << endl << endl;
}
return 0;
}
Steve
|
|
|
|
|
Christian Graus wrote: 1 - No, maps are hash tables.
Actually in general std::map s are red-black trees.
Steve
|
|
|
|
|
Damn - of course they are. I've been in the C# wilderness for far too long...
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: C# wilderness
So you started as a C++ programmer? How do you find C#? I'm a C++ programmer who is resistant to the whole dotNET phenomenon and as such interested in what a C++ programmer has to say about it.
Steve
|
|
|
|
|
Yes, I was a C++ programmer for a long time. When C# was announced, we made fun of it. Then I moved to writing web apps, and ASP.NET was just streets ahead of ASP, hence the move to C#. I think C# is nice, I like it a lot. I think with 2.0, it's finally turning into it's own language, all the more so when 3.0 comes out, with LINQ, etc. However, overall there are definatley things about it that still bug me to this day. I've fairly recently been doing some C++ work, which has just gone full time, and I'm enjoying it very much. Having said that, I write an image processing app in C#, and that's still happening in my spare time. The focus has moved to C++ again, but I am happy to move between the two languages on a daily basis, they both have strengths and weaknesses.
For a desktop app, I'd say C# is faster, and better supported. C++ is still more powerful and has the better std library. It's a question for me now of choosing the tool for the job.
It still hurts to admit that when I use C#, I'm compiling to the same runtime as VB does now
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
When you say, "C# is faster" do you mean faster to program or faster at runtime?
Steve
|
|
|
|