|
hi there,
i want to debug my unicode console application.
even when i set break point it does not stop.
can anyone suggest as to what am i missing out.
i am building it in the debug version...
|
|
|
|
|
3 possiblities I see :
1. You're setting a breakpoint in a file which actually does not belong anymore to your project (happened to me as I copied several times a project to do multiple versions of it )
2. The section of code you're trying to debug is never executed.
3. You changed the debug settings .
~RaGE();
|
|
|
|
|
no this is not the case
1.the break point is in the same file
2.well when i start the application it should atleast put me at start even without a break point so second point is also ruled out
3. no i did'nt change any of the debug settings
|
|
|
|
|
Well unless you send me your code so i can try it out, i do not think we'llbe able to help you
~RaGE();
|
|
|
|
|
Dont launch the app with "Start Debug/Go" but with "Start Debug/Step Into" which will stop at the first statement in the app. If it does not, then rethink your live and have a XMas break
But it still might be that the code at the breakpoint is never executed.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
dear all,
i'using mfc dialog based app.
the application adds a tray icon and a dialog box appears on dblclicking it.
the problem is that on every double click a new instance of dialog box appear.
how do i ensure that only one dialog can appear at a time.
Also, if the dialog is modal, how do i forcibly close the dialog say after 15 seconds.
When i use Create func to create a modeless dialog box, the dialog flashes and disappears. Why is it Happening?
I'm new to VC programmer. plz. help
rishabhs
|
|
|
|
|
rishabhs wrote:
Also, if the dialog is modal, how do i forcibly close the dialog say after 15 seconds.
Here you'll have to use a Timer.Here we go ...
SetTimer(100,15000,NULL);
Then handle your WM_TIMER message (Right Click on your Dialog in the class browser, Handling Windows Message ... [Dialog opens], doubleclick on WM_TIMER in the right column so that it appears in the middle one, click Edit now (I don't know the exact english denomination, i have it in german here =/)
You'll get something like :
void CBuilderDlg::OnTimer(UINT nIDEvent)
{
CDialog::OnTimer(nIDEvent);
}
add the following lines :
void CBuilderDlg::OnTimer(UINT nIDEvent)
{
if(nIDEvent==100)
{
OnCancel();
}
CDialog::OnTimer(nIDEvent);
}
rishabhs wrote:
When i use Create func to create a modeless dialog box, the dialog flashes and disappears. Why is it Happening?
You probably did :
CMyDialog mydialog;
mydialog.Create(bla...);
so your dialog is created as a local variable, and when you exit the function, it disappears.
Create a new member variable (Rightclick on your dialog in the class browser, Add a new memeber variable) named m_mydialog .
Then call the Create function with
m_mydialog.Create(bla...)
Whereas to
rishabhs wrote:
how do i ensure that only one dialog can appear at a time
post your code handling your double click on the tray icon ...
You may also want to look at Mike Dunn's FAQ for further question.
Hope this helps
~RaGE();
|
|
|
|
|
It would help if you post some code.
To display a dialog for 15s, use a timer (SetTimer ) and use DestroyWindow to kill the dialog.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
hi FREDRIK! Nice to see u help me again.
This is my code:-
LRESULT CTimer::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
CSchdDlg *dlgObj;
dlgObj = new CSchdDlg(NULL);
switch(message)
{
case WM_NOTIFY_ICON:
switch (lParam)
{
case WM_LBUTTONDBLCLK:
dlgObj->Create(IDD_SCHD_DIALOG, NULL);
// SetTimer(2,15000,NULL); to disappear dlg after 15 seconds + I've used just a return in ONTimer func
// dlgObj->DestroyWindow();
break;
default:
break;
}
break;
default:
break;
}
return CFrameWnd::WindowProc(message, wParam, lParam);
}
now can u answer my questions!
waiting..............
rishabhs
|
|
|
|
|
rishabhs wrote:
now can u answer my questions!
OK. Let's see a few points :
1. The SetTimer and OnTimer stuff I gave you should be implemented in your CSchDlg.
2. You really _have_ to declare your dialog as a member varaible if you do not want it to vanish a 1/1000e second after you created it with Create
3. If you want to close the dialog after 15s from _outside_ the CSchDlg, do like Frederik said, but again you'll need a member variable m_myDlg to perform a m_myDlg->DestroyWindow(); (it is IMO far much better to do it from within the CSchDlg, but )
4. To avoid multiple instances, just put a boolean as memeber variable, set it to 1 when you first create the SchDlg, reset it when destroying it, and do a test in your case WM_LBUTTONDBLCLK to know if you acn or not recreate a dialog.
Hope this helps.
~RaGE();
|
|
|
|
|
See the answer from Rage.
Another thing, you are doing one new , but no delete , and that causes memory leaks.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
you new the dialog in the function
and delete it in this funtion too
so you can not see the dialog
|
|
|
|
|
Rage gave you a great response, but let me just add my personal solution:
Like Rage said, the modeless dialog dissapears because you're probably creating the class as a local variable.... so, to kill 2 birds with one stone, the solution is simple: create the class as a static variable!
static CMyDialog s_dlg;
if (::IsWindow(s_dlg.m_hWnd))
s_dlg.ShowWindow(SW_SHOWNORMAL);
else
s_dlg.Create(CMyDialog::IDD);
This keeps your dialog class around and also ensures that only one is created.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
i am trying to findout if there are a Line Class in MFC.
for example in a Specified Device Context i want to define a Line Object with 2 attributes
1. Source-Cpoint
2. Destination-Cpoint
if i change the Source-CPoint of a Line Object in a DC then Line changes in that DC.
|
|
|
|
|
There is no actual line object per se in MFC, but as it is just two points, its not difficult to
roll one yourself.
You could either make a new class / struct with two point members:
struct CLine
{
CPoint ptStart;
CPoint ptFinish;
void DrawLine (CDC *pDC)
{
pDC->MoveTo (ptStart);
pDC->LineTo (ptFinish);
}
};
Or just use a CRect to store your coordinates, and use .TopRight () as one end, and BottomRight () as the
other, which is what I do.
Most of the time I want to draw a bunch of lines, so PolyPolyLine is superior anyway even if is not included
in CDC...
Iain.
|
|
|
|
|
Why not
class CShape {
public:
virtual void Draw(CDC* pDC) const = 0;
virtual ~CShape();
};
class CLine : public CShape {
public:
CPoint ptStart;
CPoint ptFinish;
CLine(const CPoint& ps, const CPoint& pf) : ptStart(ps), ptFinish(pf) { }
void Draw(CDC *pDC) const {
pDC->MoveTo (ptStart);
pDC->LineTo (ptFinish);
}
};
Then you can start adding other shapes to your system.
--
Only in a world this sh*tty could you even try to say these were innocent people and keep a straight face.
|
|
|
|
|
I run my VC on a Simplify Chinese Windows 98 . The font which could be selected of the VC editor is limit, only 5 types can be selected. I know it is different from the English Version of Windows. So I want to know how to make more font selections. Do I need to modify the registery table? Thanks!
|
|
|
|
|
Hi,
I have written this to draw the edge.
DrawEdge(pDC->m_hDC, &rect, BDR_SUNKENINNER , BF_BOTTOMRIGHT | BF_ADJUST);
Now i want to cahnge the edge color ,How can i do that?
|
|
|
|
|
I have some messages that are dispalyed in my application (error messages, welcome messages).
I was wodering what is the best way to define those strings:
1. in a resource file, or
2. define my own const CString object in a common header file.
I would like to hear your pros and cons on both options.
Thanks!
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
If you ever think of doing something like localisation, resources are the way to go (probably even a resource DLL).
But if you are happy with one (or maybe very few, with different binaries) languages, you can probably stay with const strings in your application.
Both are Unicode-ready, but when you choose english as your applications language, you will probably not need this.
Just my 2 Euro-cents
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
i have searched all over the MSDN to find a Function to chand this attribute
is there and Class Member of CWnd that can change the BackGround (of ForeGround )Color or Text Color.
tnx
Fight with the Best
Die like the Rest
|
|
|
|
|
To draw on a Windows pane, you need a windows device context (DC), which with MFC comes wrapped up in a CDC class. If you look in MSDN for CDC, you will find all sorts of drawing stuff.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
i want to know how i can Draw a bitmap on a Window.
when i make a window and draw a Bitmap on it the window is still at top and my bitmap goes under the window:
cw=new CWnd;
cw->Create(_T("STATIC"), "99",WS_VISIBLE |WS_THICKFRAME ,CRect(0, 0, 20,20), this, 0xffff);
.
.
.
pDC->BitBlt(point.x-10,point.y-10,bm.bmWidth,bm.bmHeight,dc,0,0,SRCAND);
whats wrong ?
if anybody has a suggestion for attach a BitMap to a Window plz tell me.
|
|
|
|
|
Well, for starters, you're SRCANDing the bitmap over the window, I think SRCCOPY might be what you want, but I cannot remember, to be honest. Second, where are you drawing this ? It should be in OnEraseBackground.
How do you know it goes under the Window, surely the Window would cover it if it did ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
This makes me me crazy!
Tell me the C functions that can help me to separete the extension of a string like myfile.jpg .
thus, I only want the .jpg to be left.
And again, just tell me what C functions that perhaps help me with this. I want to build the code myself because this is a pretty much simple thing. I don't want sample code
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|