|
Cedric Moonen wrote: I don't think this will make a big difference.
Anyway, why don't you use BringWindowToTop ?
as you know,I need create many buttons(more than 200) for the flexgrid, and some other controls in the cell, BringWindowToTop function must reset after flexgrid create/change/resize.....the code become more difficult for management.
Cedric Moonen wrote: Also, there is a lot of informations in the MSDN, try to use it because it is very helpfull.
yes,but it is very difficult to find
|
|
|
|
|
sorry for disturbing you so many times.
I found I'm real a fool.
Only a simple way is add the WM_MOUSEMOVE message for CFButton class, then add SetFocus();
whether or no, thank you very much.
|
|
|
|
|
Hello everyone!My first post so i\m kinda nervous
What's my problem:just started visual c++ and i'm trying hard to make a child window for my app(a single document made with app wizard ). I have some stuff happening in the main window and i want to be able to pop up a new window showing the status of some parameters from the main window and also to be able to control them from that second window. I would really appreciate a link or something to help me with this
|
|
|
|
|
v3r50r wrote: My first post
Wellcome
Open a new window could be a big problem if you have to initialize it, but if you want to understand how create a standard new window (in an MDI app) follow the sample code used in
CMDIFrameWnd::OnWindowNew() in winMDI.cpp
that create a copy of the current window.
void CMDIFrameWnd::OnWindowNew()<br />
{<br />
CMDIChildWnd* pActiveChild = MDIGetActive();<br />
CDocument* pDocument;<br />
if (pActiveChild == NULL ||<br />
(pDocument = pActiveChild->GetActiveDocument()) == NULL)<br />
{<br />
TRACE(traceAppMsg, 0, "Warning: No active document for WindowNew command.\n");<br />
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);<br />
return;
}<br />
<br />
CDocTemplate* pTemplate = pDocument->GetDocTemplate();<br />
ASSERT_VALID(pTemplate);<br />
CFrameWnd* pFrame = pTemplate->CreateNewFrame(pDocument, pActiveChild);<br />
if (pFrame == NULL)<br />
{<br />
TRACE(traceAppMsg, 0, "Warning: failed to create new frame.\n");<br />
return;
}<br />
<br />
pTemplate->InitialUpdateFrame(pFrame, pDocument);<br />
}
|
|
|
|
|
well..it's like this:all i want to do is to press a control(button) on my app a dialog to appear saying:parameter1 is:...(from first form ).thank tou and i'll look the MDI up ( i suppose that's multi document something right? )
|
|
|
|
|
v3r50r wrote: all i want to do is to press a control(button) on my app a dialog to appear saying:parameter1 is
Then you should create a dialog template (through the resource editor), then create the associated class. Then, on the button function handler, create an instance of this class and call DoModal.
If you want to pass some parameters, then add a new function in the class (that receives the data) and use these parameters in OnInitdialog. This new function is called before you call DoModal.
|
|
|
|
|
ok i thonk i got it thank you
btw,what does DoModal() do?
and how do i
Cedric Moonen wrote: add a new function in the class (that receives the data)
receive the data? I mean, if say i have in the main frame's class an int data;
and then it's initializrd in the application by say data=10; how do i write the function on the new dialog that gives me data's value?
|
|
|
|
|
You only need to show some parameters value in a string for example ? Then it is much easier to go for a simple MessageBox.
Here is how you can do that (let's say that you want to show the values of Param1 and Param2 wich are both integers):
char szString[255];
sprintf(szString,"Value of Param1: %i, Value of Param2: %i",Param1,Param2);
MessageBox(szString);
(I suppose you put this code in a class derived from CWnd).
Take a look at the doc of sprintf[^] for more details.
|
|
|
|
|
mmm
then you need this:
<br />
CString String;<br />
int N=5;<br />
String.Format("parameter1 is: %d", N);<br />
AfxMessageBox(String);<br />
|
|
|
|
|
wouldn't that print out : parameter 1 is=5 ?
i need the real value of param 1
|
|
|
|
|
|
Do we have any SDK to get the charset for the current language OS?
I have an application which will dyanmically generate the html file and display. I have a requirement where if I am displaying the html in the Japanese OS, I should mention japanese charset in the content info of HTML file.
Thanks in advance.
Sandeep
|
|
|
|
|
My application is reading data from serial port. But the data may arrive at any random time. So i want to interrupt the application when data arrives on the serial port. Can anybody suggest me some solution to this problem.
aasstt
|
|
|
|
|
You won't be able to use hardware interruptions in your program (and it's bad design also ). A better solution is in general to spawn a thread that will poll the serial port for data. A good design for doing that is starting this thread in a separate class that will send a message to your application when data is available (custom message). This may sound 'complicated' but if you don't want to freeze your GUI, it is the best way of doing that.
|
|
|
|
|
Cedric Moonen wrote: to spawn a thread that will poll the serial port for data.
From my experience in the past, polling eats processor resource even though we have added something in the loop in the thread like Sleep(1) .
Personally I prefer to feed an event to the serial port API, and use WaitForMultipleObjects or WaitForSingleObject ...
Cedric Moonen wrote: This may sound 'complicated' but if you don't want to freeze your GUI, it is the best way of doing that.
Yes this is so true! Basically all those communication related applications have to be designed in multi-threading to prevent from GUI frozen.
Maxwell Chen
|
|
|
|
|
Use Overlapped I/O and WaitForSingleObject
|
|
|
|
|
http://www.codeproject.com/system/simpleserialcomm.asp
http://www.codeproject.com/system/cserialport.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Is pTmpl initialized? In your example there isn't any init.
if yes what about pTmpl->UpdateAllViews(NULL); ?;)
|
|
|
|
|
Now again question is hide
|
|
|
|
|
I hope that the author isn't desappeared like the message (and that my resp solved his problem;))
|
|
|
|
|
me too
|
|
|
|
|
How can i understand the child window which i got is of child dialog?
i did this to get the child.
CWnd* pWnd = GetWindow( GW_CHILD );
i want to know if pWnd is of child dialog?
ajeesh c v
|
|
|
|
|
I'm not sure that I understand your question, but I think that if you want to know what kind of object is pointing pWnd you could use
if(! pWnd ->IsKindOf(RUNTIME_CLASS(CChildClassName))){;)
//Error
}else{
...
}
|
|
|
|
|
Hope I understood your question
see IsChild[^]
and CWnd::IsChild
|
|
|
|
|
i got the child window using CWnd* pWnd = GetWindow( GW_CHILD );
but the pWnd i got is of the edit control of the parent dialog.
i need to get only the pWnd of child dialog and not of child controls.
ajeesh
|
|
|
|