|
Thanks for the reply.
But my dialog(Custom dialog) is not receiving any key pressed events.Could you please tell me where i am gone wrong?
Regards
Asha
|
|
|
|
|
CWnd::OnGetDlgCode(...) perhaps?
Also, you could cheat by detecting the ENTER key, and then using ::GetAsyncKeyState(...) to determine if ALT is down. That is not really the correct way to do it, because the function returns the state of the keys at the time the function call was made, NOT when the message was sent.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
I am just testing something out, this doesn't throw an error however it also doesn't print anything, am I missing something?
void CPrintDlg::OnPrintMe()
{
CDC dc;
CPrintDialog dlg (false);
if(dlg.DoModal() == IDOK)
{
dc.Attach(dlg.GetPrinterDC());
DOCINFO di;
::ZeroMemory(&di, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = _T("Budget Figures for the Current Fiscal Year");
dc.StartDoc(&di);
dc.StartPage();
CString a;
a = "Printing Test";
dc.TextOut(0, 0, a);
dc.EndPage();
dc.DeleteDC();
}
}
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
You forgot:
dc.EndDoc();
after
dc.EndPage();
that may help.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron wrote:
that may help.
Yep, thanks. BTW, any ideas as to why when I type ::ZeroMemory(....) I don't get intellisense?
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Nick Parker wrote:
when I type ::ZeroMemory(....) I don't get intellisense?
I don't think it's in the global namespace. When I type "::" ZeroMemory isn't in the list. I usually dont use that function anyway, I just make sure to initialize all my variables.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron wrote:
I usually dont use that function anyway, I just make sure to initialize all my variables.
How do you initialize an array?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If I'm using an array, I'll init:
int d[4] = {0,1,2,3};
if it gets too big for static init, i'll use a vector.
However, you may find an un-initialized array somewhere...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Ravi Bhavnani wrote:
How do you initialize an array?
Err, don't you mean a structure ?
You could initialize like this :
DOCINFO di = {0} ;
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
No, I meant an array. My point was ZeroMemory() comes in handy for initializing an array without having to loop through it.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
My point was ZeroMemory() comes in handy for initializing an array without having to loop through it.
Ah, ok , sorry for the post .
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
You can always use memset(...)
|
|
|
|
|
My point was you often need to programatically initialize data using ZeroMemory() (or memset() ).
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
ZeroMemory is a macro to memset (&xpto,0,sizeof(xpto))
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
Hi,
I use VC6+SP5, but the debuger can't watch static variable!
for a very simple function, eg:
int main()
{
static i;
i = 7;
printf("Hello World!\n");
return 0;
}
The debuger can't watch var i, and report a CXX0017 error
Any one got this similar problem? And how to solve this?
Thanks in advance
Alan Wen
|
|
|
|
|
Hello,
My app is failing without a reason (aparently), in any time.
I want to write in a file some variables at each 5 minutes to discover this reason.
I have tried to write the percent of RAM used, but this is not the problem. Which others variables or information could I write ??
Thanks,
Cris.
|
|
|
|
|
Well, have you tried using a debugger ?
Does it always crash doing the same operations ?
Dave you checked all variables so that they are really initialized ?
Do you check for NULL pointers ? check for valid return values ? check for valid input values ?
Do you have compilation warnings ? use level 3 or level 4 warning level ... and clean as much as possible, and document those you can't fix.
Max.
|
|
|
|
|
I can't use debugger because I don't know when ocurr the problem.
It doesn't crash doing the same operation.
I'll check the variables ... but it's dificult !!
I did also compile with leve 4 warning. Some I have cleaned (half).
Any other idea ??
Thansk for your help ...
Cris.
|
|
|
|
|
You may write a log in text file while programm is running.
code like this will help you to find function, where you have problems. when you find function, you may write more fprintf operators, or debug it.
CMyClass::Func1()
{
fprintf(logfile,_T("Entering Func1"));
...
fprintf(logfile,_T("Exiting Func1"));
}
write to log some useful information, variables, etc...
Dmitry Timin
|
|
|
|
|
How can I set to a window never get the input focus ??
Thanks,
Cris.
|
|
|
|
|
check for the CWnd::OnSetFocus and/or WM_SETFOCUS. ( or even WM_ACTIVATE )
one way is to set the focus back to the one that loose the focus instead of the one receiving the focus.
void MyWnd::OnSetFocus( CWnd* pOldWnd )
{
(void)pOldWnd->SetFocus( );
}
Max.
|
|
|
|
|
Ok, this solve the problem. But this cause a flash (kill and set quickly the focus) in the app.
I need to know how avoid that the app set the focus.
[]'s
Cris.
|
|
|
|
|
hey! plz if anyone can help me.
How can i read data from file and put its contenant in a Combo box.
For example i have to take from a file different mobile types and put it in a Combo box so the user can choose one of them.
Bebe Harhour
|
|
|
|
|
try
{
CFileDialog fd(true,_T("txt"), _T("*.txt"));
if(fd.DoModal() == IDOK)
{
CString buff = "";
int i=0;
int max_size = 256;
ifstream inFile;
inFile.open(fd.GetPathName());
do
{
inFile.getline(buff.GetBuffer(max_size),max_size);
this->m_ListCtrl.InsertItem(i, buff);
i++;
}while(!inFile.eof());
inFile.close();
}
return true;
}
catch(...)
{
return false;
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
iam using shellexecute to open outlook express
My to address & subject is appeared but again the problem is newline constant
what escape sequences i should give to make new line appear.
mailto:someone@someone.com&subject=VersionInfos&Body=
|
|
|
|