|
|
AHHHH!! I'm starting to like that location, perhaps I should build a house there.
Ok, so how do I initialize it correctly? Would I use the CMyDoc::GetDoc() and CMyView::GetView()? How do I get the pDC to point to the correct location using these? I have them programmed, just not used yet.
Other than that, am I coding the process correctly, other than getting the current position?
|
|
|
|
|
I don't understand why you need draw it from document.Set value in the doc,call from doc to updateallviews and in the view OnDraw call to
and call to dc->textout(pdoc->getvalue()).
Good luck.
|
|
|
|
|
GetDC() will return the pointer to the Current Device Context..
Renjith-CPian.
|
|
|
|
|
Bear with me here, so you call GetDC() and then you assign this to pDC correct?
Would the code look like this?
GetDC()* pDC;
How do you tell which document is active or do you need to?
|
|
|
|
|
YES!!!!!!!!!!!!!!!!
I found a command that worked!!!!
Since I'm using an EditView this function works:
void CMyAppView::OnTestingInserttext()
{
CMyAppDoc* pDoc = (CMyAppDoc*)GetDocument();
CString outtext;
CEditView::GetWindowText(outtext);
outtext=outtext+"This is my new stuff";
CEditView::SetWindowText(outtext);
pDoc->UpdateAllViews(NULL);
}
Thanks again for all your help, I simply stumble across the GetWindow text while looking for CDC information.
|
|
|
|
|
Good. Now try checking out CEdit::ReplaceSel function. It is more efficient than getting the current text into a string and appending and sending back to control. You will also need to look at CEdit::SetSel.
James.
Drinking In The Sun
Forgot Password?
|
|
|
|
|
|
Oh sure, now you tell me
I found it before I read any replies, but thanks for offering advice. Now the next question that comes to mind is, what is all that DrawText and TextOut used for?
Also, I know how to pass a variable from a modal dialog, how do you pass one from a modaless? Or should this be under a new thread?
|
|
|
|
|
Matt Fenwick wrote:
DrawText and TextOut used
DrawText and TextOut are used when you need to paint directly to the window. If you are using an edit control then the edit control will handle drawing directlty to the window, all you need to do it tell it what text to draw.
Matt Fenwick wrote:
how do you pass one from a modaless?
The variable must be a public member of your dialog class. Then you can access the variable from anywhere. Or you can create it private/protected and make a public function to retreive it. It is the same in modal/modeless.
Drinking In The Sun
Forgot Password?
|
|
|
|
|
I looked everywhere fonts, text api's but could not find a flag to set in order to draw text as superscript or subscript (using GDI). How is it normally done?
|
|
|
|
|
halve the font size and offset if necessary.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
That is simple. It just did not occur to me. Thanks!
|
|
|
|
|
I develop my application on my computer. Everything is OK.
but when I copy my application (.exe and .dll) to the another computer. It occur "Application Error" if I ran it
NOTE: I copy everything that my application dependence on
==============================
this is full error message
screen_mate.exe - Application Error
The instruction at "0x004010a7" referenced memory
at "0x00000000". The memory could not be "read"
Click on OK to terminate the program
Click on CANCEL to debug the program
=========================
What's wrong ?
How could I do ?
Thank you so much for your kindness
|
|
|
|
|
Have you distributed the release or debug build ? Have you run both builds on your own PC ? Have you tried commenting out different bits of code until you can establish which code is crashing through a process of elimination ?
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
I try to build both debug and release version on my computer. Everything is Ok. and I try to run both version on the another computer but It occurs "application error"
NOTE: I copy everything that my application dependence on each version
Thanks in advanced
|
|
|
|
|
meta wrote:
I copy everything that my application dependence on each version
I'm guessing not.
Do you expect me to tell you what the problem is, when I don't even know what framework you're using, your dependencies or what your code does ? Even if I did, I doubt I could answer. Do what I said - comment out parts of the code that might cause such an error ( for example are you creating any COM objects and not checking them before you use them ? ) and then let us know if you find the code that is breaking and still cannot figure out why. I'd love to help, but you're simply not giving me enough information at this stage.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
I'm sorry that my information is not enough.
More information
1) My computer has 2 OS (Windows 2000 Advanced Server
and Windows 98 SE). I develop on windows 2000 Advanced Server
and It's work. after this I copy my app and the Dependence
to Window 98 and run it.(it's work)
2) The another computer that I try to run is
Windows 2000 Profressional)
3) My Application (Screen Mate) does as following;
- Windowless
- SetWindowRgn
- Draw Bitmap on Window Region
Thanks a lot for your kindness
|
|
|
|
|
Work backwards then - do a build without the draw, see if it crashes. The don't set the region, see if it crashes. Then you can figure out where the problem is.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
Debug it on the puter where it crashed.
Either install what you need to debug or do remote debugging.
/Magnus
|
|
|
|
|
I'm sorry for posting so much code, but since i really dont have any idea why is isn't working I dont know what to show and what not to.
Using the debug tool I have managed to figure out my app crashes at run-time when it executes this line
int int_mode = 0;
CString str_buffer;
if(int_mode == 1)
im sure there is something I dont know im doing wrong, so please enlighten me its been driving me crazy most of the afternoon.
int format_chars(int int_offset, CString input)
{
int i = 0;
int a = 1;
int output = 0;
int int_mode = 0;
CString str_buffer;
while(true)
{
if(int_mode == 1)
{
if(input.GetAt(i) == ' ')
{
output = atoi(str_buffer);
return output;
}
str_buffer += input.GetAt(i);
}
if(input.GetAt(i) == ' ')
{
a++;
if(a == int_offset)
{
int_mode = 1;
}
}
i++;
if(i > input.GetLength())
return -1;
}
return -1;
}
|
|
|
|
|
if(i > input.GetLength())
should be if i >= input.GetLength(); For efficiency you should also put this value into a const int prior to starting your loop.
The reason for >= is that the string is zero indexed, so a string with a length of 5 has only values up to [4].
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Remember that amateurs built the ark. Professionals built the Titanic.
|
|
|
|
|
if string = NULL or empty so CString::GetAt(0) raise assertion.
So first you need check if it not empty and i < CString::GetLength()
|
|
|
|
|
|
People like me now know how to read these subjectless mails without difficulty.
I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio about posting in the right forum. The Lounge - June 23, 2002
|
|
|
|