|
I have a dlgbar in mainframe, with its resident controls accessed directly by cmainframe ( as modeless dlg ). The problem is that certain user actions on the dlgbar ( closing it via the system close icon, or moving / resizing it ) need to cause additional action. I have tried deriving a class from CDialogBar to manage the bar and adding to the message map to trap these actions, but do not seem to get any effect, except during program initialization or shutdown.
( eg: I tried processing wm_destroy in CDerivedDialogBar and got an effect only when the program terminated. I tried processing wm_close and got no effect at all. )
Anyone know what messages I need to process or how I can trap these actions?
This is driving me nuts trying to find solutions.
Thanks
|
|
|
|
|
CControlBar-derived objects (including CDialogBars) are not destroyed when you click on the 'x' icon - MFC just hides them. To trap this event, you can override virtual method CControlBar::DelayShow. The function is undocumented, but worked OK for me.
What kind of problems are you having with resizing? No WM_SIZE message?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks. That sounds like it might be what I need, but what are the parameters for DelayShow()?
As for the other, it's not a problem with resizing as such, but rather a result of any user action on the dlgbar window itself. This particular bar is set to float or dock, and it contains a listcontrol which is its main feature. Whenever the bar is moved, the input focus switches to the bar itself, and stays there. I need it to return to the listcontrol after the move is complete ( as soon as the mouse is released ).
Thanks again.
|
|
|
|
|
> what are the parameters for DelayShow()?
It's declared like this in afxext.h:
virtual void DelayShow(BOOL bShow);
Are you using 'raw' CDialogBar or some derived class?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I'm using a derived class with one additional member -- a boolean flag representing the bar's visibility state.
Thanks again.
|
|
|
|
|
Hi all.
I'm writing program by MSCOMM ...
I wrote sending data section in my program.
My problem is in getting data section !!!
It mean i don't know for getting data i must use which function !!!
I must use, GetInput() or SetInput() or ... ?!!!
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
There are a couple of ways to take care of this problem. I'll tell you about the way I solved it in my project a couple of weeks ago...
The GetInput function gives you the content of the input buffer and it resets the input buffer to empty (that is, if you do it correctly in respect to VARIANT types... I told you this a few weeks ago). Now you can choose to work on event-basis or on time-basis. If you work on even-basis, you have to catch the 'input buffer threshold reached' event. You can program the 'GetInput' function right inside the event handler and store the received character(s) in a string member variable. If you choose to work on a time-basis you will have to start polling the size of the string already in the inputbuffer. Don't forget to program a time-out procedure in the latter case, because if you don't and the communication gets messed up, your program will hang!
Now, in either case, you have to think of some wat to package your communication. I packaged my messages inside STX and ETX commands (some low-value ASCII characters). You can then extract the messages from your member string variable by searching for ETX commands (you can use whatever you want of course, even \n if you like).
Hope this helps a little!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Thanks for your help ...
Your helps is very nice.
Now, i have other question, how can i take the phone ?
Does i must use of ATH1 for do it ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Answering the phone:
1) Wait until it rings
2) Pick up the horn and say your name, preferably 'goodmoring' as well
Just kidding Now this is how your modem should do this:
First you have to set the DTR to true. Don't ask me why, you just have to. You can use the SetDTREnable(true) function for that.
Then send the next message to the modem:
ATE1S0=1
followed by a carraige return - line feed again.
Now it will pick up the phone (if everything's okay, you will probably see the AA light on your modem light up... Auto Answering mode).
Now you're gonna have to poll the input buffer and as soon as you get a message from the modem (ended by a carraige return - line feed) which starts with the string 'CONNECT ', then you know the handshake has succeeded and your connection is open...
Good luck!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Thanks aloooooooot for all helps.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi again ...
I want to know can i control the Microphone in MSCOMM ?
Because i can dialing by MSCOMM, and i can hang up the phone and ... but when i speak in microphone, my friend can't hear my voice !!! why ???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Oh, well,
you lost me there. All I ever did was let 2 PC's communicate. I've no idea where the voice comes in... I don't even know if it IS possible, even though I think it should be...
Good luck!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Hi again,
How are you ?, i have other question ...
I see example about MSCOMM in MSDN ..., in this example he write function for sending data(I wrote, too), but he write this function, too !!!
void DoEvents()
{
MSG msg;
while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(!AfxGetThread()->PumpMessage()) return;
}
}
Just, i want to know for recieving data, i must use of this function ???
Thanks.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello again to you too,
I'm doing fine, thanks. What about you? I'm starting to get curious about the sort of application you're building at the moment... If it's not too rude sticking my nose into your business
Anyways, I've left the MSComm story a month ago and am now busy programming some ASP-website.
About your question, this function looks like some weird windows-messaging function. I think it's probably a GUI-related function from the example. Shouldn't worry about it too much. I never used it and my application is working great.
Good luck!
Structured programming vs. chaotic mind boggling
|
|
|
|
|
Thanks, you really helped me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Using Visual C++ 6.0 and MFC
I have populated a CEdit control programmatically. Sometimes the text is longer than the display area.
Can anyone please tell me how to issue a command to scroll back to the start of the text. Currently it always scrolls to the end.
Thanks in anticipation
Sara
|
|
|
|
|
How did you get the such a strange behaviour ... ?
I've just created a MFC dialog-based app with a single line edit control and I tried that code:
1)m_edtText.SetWindowText("I'm the man with the mission");
and that:
2)m_strText = "I'm the man with the mission";
UpdateData(FALSE);
and all works fine (it means - I can't reproduce your app behaviour =).
Anyway - try this code:
m_edtText.SetSel(0,0);
Hope it will help you.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Calling the CEdit member function SetSel(0, 0, FALSE) will scroll it so the first character is visible.
p1514
|
|
|
|
|
Many thanks to Ben, anonymous , markkuk.
As a result of your help (jun 14) I share the next example program that worked very well for my purposes:
// Example about using map
#include <iostream>
#include <string>
#include <utility>
#include
using namespace std;
const int tam=10;
struct stTot {
string stLey;
double dMonto[tam];
};
stTot myTot;
map<string, sttot=""> mpCont;
string clave;
int main()
{
myTot.stLey = "Text one";
for(int i=0; i<tam; i++)
="" mytot.dmonto[i]="i+11;
" mpcont["one"]="myTot;
" mytot.stley="Text two" ;
="" for(i="0;" i<tam;="" clave="two" mpcont[clave]="myTot;
" map<string,sttot="">::iterator it = mpCont.find("one");
cout << (*it).first << " " << (*it).second.dMonto[3] << endl;
it = mpCont.find(clave);
cout << (*it).first << " " << (*it).second.stLey << endl;
return 0;
}
/*
Output obtained for both cases is:
one 14
two Text two
*/
|
|
|
|
|
Unfortunately, some words or characters seems not to be displayable, for example the include files: these are iostream, string, utility and map, all enclosed in angular parenthesis.
There some others but I think these are easy to discover for the interested people.
|
|
|
|
|
They're lost because HTML is parsed in our posts. SO a < > pair is assumed to contain an HTML command and is therefore not shown. To get those signs I used & lt and & gt, without the spaces.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Alternatively you could use the <pre> tag before your code segment and the </pre> after, everything in between should be exactly as you typed it.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
hey guys,
how do i save my drawing, which i make using onDraw(CDC* pDC) in a MFC application as an image file or how do i export it to word or any other software??
Nitish
|
|
|
|
|
GDI+ lets you save images in a variety of formats, at last count GDI supports - none. Sorry
Seriously though, there is code on the CP to save bmp files, if you want a variety of formats, you can go to www.paintlib.de and download paintlib. It supports bmp, gif, jpg, png, tif and if they've finally put in the code I gave them last year, tga as well.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Actually i am facing the problem to open a new dialog window by clicking a hyperlink in the client area of the window--
How is it possible?
Can i insert menu in a dialog window?
|
|
|
|