|
|
This may be elementary to most of you gurus. I have an ATL COM DLL which I instantiate from ASP (using Server.CreateObject). If I want to debug it, what should I do ? I tried follwing: Project->Settings->Debug->Executable for debug session = IEXPLORE.EXE - I am able to put the break points but it would not stop on the break points. If I use a small app written in VB for the same purpose, I am able to debug.
Please help,
Thanks
|
|
|
|
|
Hi..
I think you should choose InetInfo not IEXPLORE .. its the IIS which processes asp not the browser...
|
|
|
|
|
Can you please tell me how to do that ? I tried attaching the inetinfo process but the breakpoint would still not stop execution of the program. Thanks.
|
|
|
|
|
Right Idea, wrong executable:
If you are using iis4 try inetinfo, else for Com+ attach to DLLHOST.EXE.
Brian
|
|
|
|
|
As testing for a real MFC application I made a trivial one, but ran in to problems. To my mind this exemplifies the difficulties faced by the newbie to MFC and doc/view.
I wanted a single-window MFC doc/view app with a static control on the window.
I used AppWizard to make an MFC EXE. It ran and showed an empty window.
I put my static control in the view .h file
private:
CStatic Statcontrol;
Now I made my ..Create() in the view .cpp file
RECT rect = {100,100,200,200};
Statcontrol.Create("hello",WS_CHILD | WS_VISIBLE | SS_CENTER,rect,this,ID_STAT);
But where do I put this code? In the view constructor it fails. In PreCreateWindow() it fails. All I get is a FALSE return - not much diagnostics. (But I guess 'this' is wrong). In the OnDraw() handler it works! But then it's called multiple times.
Help! Why is something so simple so difficult? MFC books never help with things like this.
Andrew
MisterTransistor - germanium is King
|
|
|
|
|
Try putting it in your view class OnInitialUpdate function leave
CStatic Statcontrol in the header...should work
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Gary,
thanks - that has indeed fixed it.
You don't by chance know a good book/article that explains the principles of MFC programming rather than just showing which menus to click?
cheers
Andrew
|
|
|
|
|
I am kind of partial to "Inside Visual C++" by Kruglinski.
I have found that the best way to learn MFC is by doing. I have never learned much from reproducing book examples. I came from a C, Basic, FORTRAN, assembly language background. I learned the most by taking one of my old programs and making a MFC application out of it. I already knew how the meat of the program worked, so I could just concentrate on the GUI interface. I would use the programming books I bought (I own quite a few) and use the coding examples that applied to the program I was writting.
It may not be the best way to learn MFC, but it worked for me.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
There is no such thing as a "trival MFC" app.
That's why it is EOL;P
|
|
|
|
|
I have an integer. For example my integer is 2147483712.
Now in hex form this is: 0x80000040
Now i need this system that works with "flags", flags as in a property that can be given to an object (what kind of object or whatever is beside the point). For example:
Property name HEX DEC
Property1 0x1 1
Property2 0x2 2
Property3 0x4 4
Property4 0x8 8
Property5 0x10 16
Property6 0x20 32
... and so on till
Property32 0x80000000 2147483648
So the object can have different properties which are put together into a single integer like this:
For example an object has properties 7 and 32 so the integer is 2147483712 as mentioned before. My question is, how do parse this, how do i get the individual properties from the integer, there must be an algorithm for this but i can't think of it.. (i never was very good at maths). So can anyone help me?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Hi..
the good news is that you don't need to be good at math
use bitwise and operator &
msdn explains it better than me:
The bitwise-AND operator compares each bit of its first operand to the corresponding bit of its second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
so if you need to check the first bit (the first boolean property) use :
if(intVar & 1)
to check the second use :
if(intVar & 2)
etc..
so you compere with 1,2,4,8 etc ..
got it ?
|
|
|
|
|
You can check the flag with a logical AND like this
if(flag & Property32)
if the if statement returns true then the flag was set if it returns false (0) then the flag wasn't set.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
ok..
small correction : logical AND is &&
& is a bitwise operator
|
|
|
|
|
I'm sure this[^] can help!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hey Guys,
Just wondering if there is a quick and easy way [Other that using the Registry] to add System Variables and to add to the PATH.
e.g.
Adding BOB_RULES as a system variable and pointing it to c:\cp
and adding %BOB_RULES%\soapbox to the PATH
???
Thanks in advance lads
Regards,
Brian Dela
Run naked in the snow until you're sweating like a stuck pig and can't seem to catch your breath. When the flu becomes pneumonia, they can cure that with a shot. - Roger Wright
|
|
|
|
|
I'm writing a graphing program that draws x- and y- axis in a picture box and I want to label some of the hash marks. I cheated a little and used read only edit controls for the labels. My problem is this - I need to convert the array of labels (doubles) to an array of strings so that I can send them to the edit controls for display in the picture box. I've tried the CString.Format function and ToString function and even _gcvt but I can't seem to get any of them to do what I want. Can anyone help?
Here my button click event that is supposed to handle this:
void CGraphView::OnBnClickedBtnplot()<br />
{<br />
<br />
double* Labels;<br />
<br />
GetDlgItem(IDC_PICT)->GetWindowRect(pictRect);<br />
ScreenToClient(pictRect);<br />
<br />
Labels = GetLabelVals();<br />
<br />
SetDlgItemText(IDC_EDITINTERSECT, "INT"); <br />
SetDlgItemText(IDC_EDITX1, str); <br />
SetDlgItemText(IDC_EDITX2, "x2"); <br />
SetDlgItemText(IDC_EDITX3, "x3"); <br />
SetDlgItemText(IDC_EDITX4, "x4");<br />
SetDlgItemText(IDC_EDITX5, "x5"); <br />
SetDlgItemText(IDC_EDITY1, "y1");<br />
SetDlgItemText(IDC_EDITY2, "y2"); <br />
SetDlgItemText(IDC_EDITY3, "y3");<br />
<br />
InvalidateRect(pictRect);<br />
}
Instead of the "x1...y3" I want the label strings to go in.
Any help would be appreciated!
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
Why doesn't CString.Format do what you want...it will give you a formatted string. If you want an array of strings then check out CStringArray.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Would it then look like this?
void CGraphView::OnBnClickedBtnplot()<br />
{<br />
<br />
CStringArray strings;<br />
strings.SetSize(26);<br />
double* Labels;<br />
<br />
GetDlgItem(IDC_PICT)->GetWindowRect(pictRect);<br />
ScreenToClient(pictRect);<br />
<br />
Labels = GetLabelVals();<br />
<br />
strings[1].Format("%.3d\n", Labels[1]);<br />
<br />
SetDlgItemText(IDC_EDITINTERSECT, "INT"); <br />
SetDlgItemText(IDC_EDITX1, strings[1]); <br />
SetDlgItemText(IDC_EDITX2, "x2"); <br />
SetDlgItemText(IDC_EDITX3, "x3"); <br />
SetDlgItemText(IDC_EDITX4, "x4");<br />
SetDlgItemText(IDC_EDITX5, "x5"); <br />
SetDlgItemText(IDC_EDITY1, "y1");<br />
SetDlgItemText(IDC_EDITY2, "y2"); <br />
SetDlgItemText(IDC_EDITY3, "y3");<br />
<br />
InvalidateRect(pictRect);<br />
}
Am I using the .Format correctly? The output on the screen is not correct. If Labels[1] is 10.26356897 then I get something like -85478 or something like that in the edit control when i run it. Could you give me an example of what it would take for my output to look like this: 10.3 I don't have a lot of space in the picture box so the output needs to be rounded to have only one number after the decimal place.
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
student() wrote:
Would it then look like this?
Yes, however keep in mind that C arrays are 0 based...when you add a string to the CStringArray it will start at the 0 index. You can either handle it with the index or add a dummy string to the 0th location.
student() wrote:
Am I using the .Format correctly?
No, change the d to an f
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Alright! That worked perfectly! I REALLY appreciate the help.
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
Disregard the first part of my last post...I didn't see that you had used SetSize. Since the array is zero based, in order to start at an index of 1 then you will need to make the array size one larger than the number of items you are storing.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
One last question..
Why will this work...
strLabels[3].Format("%.2f\n", dblLabels[3]);
But this won't?
for (int i = 1; i < 26; i++)<br />
strLabels[i].Format("%.2f\n", dblLabels[i]);
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|
|
I don't see anything wrong with what you posted. What does it do?
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
The output on the screen shows -9255 for every string no matter what is in my dblLabels array when I use a for loop. If I put the literal index in it works but that would be too many lines of code.
Heres the whole thing again just in case:
void CGraphView::OnBnClickedBtnplot()<br />
{<br />
GetDlgItem(IDC_PICT)->GetWindowRect(pictRect);<br />
ScreenToClient(pictRect);<br />
<br />
CStringArray strLabels;<br />
strLabels.SetSize(26);<br />
<br />
double* dblLabels = GetLabelVals();<br />
<br />
for (int i = 1; i < 26; i++)<br />
strLabels[i].Format("%.2f\n", dblLabels[i]);<br />
<br />
SetDlgItemText(IDC_EDITINTERSECT, "INT"); <br />
SetDlgItemText(IDC_EDITY1, strLabels[3]);<br />
SetDlgItemText(IDC_EDITY2, strLabels[6]); <br />
SetDlgItemText(IDC_EDITY3, strLabels[9]);<br />
SetDlgItemText(IDC_EDITX1, strLabels[12]); <br />
SetDlgItemText(IDC_EDITX2, strLabels[15]); <br />
SetDlgItemText(IDC_EDITX3, strLabels[18]); <br />
SetDlgItemText(IDC_EDITX4, strLabels[21]);<br />
SetDlgItemText(IDC_EDITX5, strLabels[24]); <br />
<br />
InvalidateRect(pictRect);<br />
}
"It has become appallingly obvious that our technology has exceeded our humanity."
- Albert Einstein (1879-1955)
"I think there is a world market for maybe five computers."
- Thomas Watson (1874-1956), Chairman of IBM, 1943
"640K ought to be enough for anybody."
- Bill Gates (1955-), in 1981
"Half this game is ninety percent mental."
- Yogi Berra
|
|
|
|