|
Hi all,
In my MDI application, I need to repaint a child window, which has title "Child Window 3", from the application class. How to use FindWindowEx function to get the window handle of the child window? Or is there an alternative?
Kindly suggest me some ideas.
Thanks in advance,
Sarvan AL
|
|
|
|
|
What is the problem with FindWindowEx ?
Elseway, could you create manually a simple loop to find the desired window in the windows list?
Or
UpdateAllView(NULL) probally cold be the more easy solution (but it takes some CPU time)!
|
|
|
|
|
Hi Russell,
FindWindowEx always gives NULL. When I click on New, a new child window opens with titile "MyView1", "MyView2",... When I click this menu item, I want the child windows to be repainted one at a time. Pls have a look at the code:
void CMainFrame::OnUpdateViews()
{
CString strTitle ;
static int nChild = 1 ;
strTitle.Format("MyView%d", nChild) ;
HWND hWnd = ::FindWindowEx(
this->GetSafeHwnd(),
NULL,
"CMyView",
(LPSTR)(LPCTSTR) strTitle) ;
if(::IsWindow(hWnd))
::SendMessage(hWnd, WM_COMMAND, (WPARAM)WM_USER, 0) ;
nChild ++ ;
}
In my WM_USER handler, I simply call "Invalidate()". Instead of repainting all the children, I need to do it for a specific child window.
Hope I have explained my problem clearly.
Sarvan AL
-- modified at 7:55 Tuesday 2nd May, 2006
|
|
|
|
|
Well, ...how to use this routine more times? the variable 'nChild' looks hard to be reset, or not?
About your function: everything looks correct, but:
The CView is child of a frame that is child of the MainFrame, I don't know if it is a problem for FindWindowEx.
Are you sure that strTitle contains the right title? In debug mode you can check the RuntimeClass.
|
|
|
|
|
Hi Russell,
Pls forget abt 'nChild'. As you said, I tried this:
HWND hWnd = ::FindWindowEx(MDIGetActive()->GetSafeHwnd(),
NULL,
"CMyView",
(LPSTR)(LPCTSTR) strTitle) ;
But in vain. What else can solve this problem?
Sarvan AL
|
|
|
|
|
I think that this must work: :->
POSITION ViewPos;
CView* pView;
CString string;
ViewPos=pDoc->GetFirstViewPosition();
while(ViewPos){
pView=(CSWAView*) pDoc->GetNextView(ViewPos);
pView->GetWindowText(string);
if(string==strTitle){
...
}
}
In this way you could refresh more View (if exists) with the same name.
|
|
|
|
|
Hi Russell,
Thanks a lot for your great suggestion.
Sarvan AL
|
|
|
|
|
|
I created a link list using CList class
i add new nodes using using new operator and addtail function
the question is when i remove a node using removeat function will the memory allocated by new operator be freed
if possible give me any exact explanatory links that could satisfy my question
Deepchand P
Software Developer
Optiwise Solutions
|
|
|
|
|
Deepchand P wrote: the question is when i remove a node using removeat function will the memory allocated by new operator be freed
No it will not. It will remove the object from the list, but will not free the memory it pointed to. That is your responsibility. You can check this in the CList source code if you want.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
How could i block certain area with a rectangle out of 400*400 pixels in a bitmap
|
|
|
|
|
Do you need to segment from one bitmap? if yes I suggest use BitBlt
|
|
|
|
|
can we use static allocation instead of dynamic one with structures to vector array
typedef _strct{
int field1;
int field2;
...
}STRCT;
////////////////////////////////////////////////
func(){
vector<STRCT> vec;
...
fillvector(&vec, N);
...
}
/////////////////////////////////////////////////
fillvector(vector<STRCT> *vec, N)
{
for(int i=0; i<N; i++)
{
STRUCT str;
str.field1 = rand();
str.field2 = rand();
...
vec->push_back(str);
}
}
or is it better to get a STRUCT *str = new STRUCT to a vector<STRUCT *> vec
|
|
|
|
|
How will you reallocate a static struct?
Nibu thomas
Software Developer
|
|
|
|
|
Yes, it's perfectly safe to use it that way. The vector will make a copy of your struct and hold the copy.
|
|
|
|
|
|
Hehe, toxcct is back
I saw that you updated your article. That's nice . I'll take a look at it.
|
|
|
|
|
Cedric Moonen wrote: Hehe, toxcct is back
Cedric Moonen wrote: I saw that you updated your article.
yup, plenty of work to do yet, but version 3.0 is there !
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Hi toxcct.
Designer visualcalc
|
|
|
|
|
|
|
HI All
I work with Visual studio 6 (C++).
In some cases i make change in the code and want to press the 'Apply code change' button to look if my change fix the problem - but the visual pop up message that say that i need to re-compile to apply my changes.
How can i do it with out re-compile ? i meed just run over the code with my fix that i add .
Thanks for any help.
|
|
|
|
|
yanshof wrote: How can i do it with out re-compile ? i meed just run over the code with my fix that i add .
You have to enable the Edit and Continue option.
Nibu thomas
Software Developer
|
|
|
|
|
Thanks , but where this option is define in the Visual ?
|
|
|
|
|
In the Project Settings dialog box that appears, click the C/C++ tab . Select General from the Category group box. In the Debug info group box, select "Program Database for Edit and Continue." The /ZI compiler switch will appear in the Project Options box at the bottom of the dialog box. Any other selection in the Debug info group box will disable the /ZI compiler switch. Click OK to accept the settings.
More[^] info.
Nibu thomas
Software Developer
|
|
|
|