|
Are you sure you read the question right?
William
Fortes in fide et opere!
|
|
|
|
|
Whilst it cant be misused like a global (you cant change it from numerous places in your code, for example), it is suspectable to a namespace clash with something else of the same name. Just follow the standard rules of defining it before use, putting it into the smallest scope you can, and if necessary, use a namespace.
|
|
|
|
|
Thanks for replying.
What you said, makes a lot of sense!
William
Fortes in fide et opere!
|
|
|
|
|
I've been using SetWindowOrg for quite a while now, but it still bugs me that I don't completely understand what's happening with the "y" coordinate. I know that SetWindowOrg maps the logical (x,y) coordinates to the physical device's (0,0) coordinates (upper left), but I don't understand the sign associated with the "y" coordinate of SetWindowOrg. For example, the following code will draw a circle in the center of the screen (assuming that you've got a device context):
CRect rect;
GetClientRect(&rect);
CPoint point(rect.Width()/2, rect.Height()/2);
dc.SetMapMode(MM_LOENGLISH);
dc.DPtoLP(&point);
dc.SetWindowOrg(-point.x, -point.y);
dc.Ellipse(-50,50,50,-50);
So the origin has been shifted to the center of the screen. Here's my question. Why must negative point.y be sent to SetWindowOrg and not positive point.y? After all, in the MM_LOENGLISH mapping mode the coordinate system is with positive y up and negative y down. So if this code makes the logical upper left be in the second quadrant somewhere (-x,y), which is where it has to be if the logical origin is now in the center, then why do I have to send a negative point.y into the SetWindowOrg? Sending a positive point.y makes more sense, but sending a positive point.y ends up with the circle off the screen. The sign associated with point.x makes sense.
Ed
|
|
|
|
|
I'm trying to align static text windows on a CFormView dialog. I used the visual editor, but sometimes there's a larger gap between text windows than others, so I want to make this even.
I've tried to adjust the window positions in the OnInitialUpdate function. The confusing part to me is that the following 4 lines end up putting my static text window in random places within my application. Between the 3rd and 4th lines of code I would obviously adjust the CRect borders, but I was hoping somebody could give me a reason as to how and why these lines of code cause my window to appear (if it shows at all) in random locations within my dialog. How can I fix this? Thanks a ton!!!
CWnd * MyWindow = GetDlgItem( NUMBER_STATIC );
ASSERT( NUMBER_STATIC );
MyWindow->GetWindowRect( &WindowRect );
MyWindow->MoveWindow( &WindowRect );
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
you're using GetWindowRect, which is the rect of the window on the screen.
GetClientRect would return the control rect on the client x,y
BUT, grabbing a rect, then moving the window right back to the same position will do absolutely nothing, even if you do it right.
|
|
|
|
|
GetWindowRect() retrieves the window position in screen co-ordinates (i.e. 0,0 is the top-left corner of the screen. MoveWindow() moves the window to the specified client co-ordinates of its parent window (i.e. 0,0 is the top-left corner of the parent window).
You need to peform a conversion between the screen and client co-ordinates before moving the window as follows:
MyWindow->GetWindowRect( &WindowRect );
ScreenToClient( &WindowRect );
// Adjust the position here...
MyWindow->MoveWindow( &WindowRect );
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
I put a CEdit control into a simple frame OLE Active X MFC project, and created it on the OnCreate function, and it works fine, except that when I embed the active x control into a webpage, it will not receive the backspace messages.
Where did they go?, what took them? Is it internet explorer's client window that's filtering the keypress message?
Here is my project example, which is simply a standard MFC Active X control VC++6 project wizard output with a public CEdit member m_edit, that is initialized on the component's OnCreate function.
Please take a look and let me know what's going on
http://www.employsoft.com/test.zip[^]
|
|
|
|
|
Most likely they are going to the IE main window. The backspace causes IE to navigate back one page.
"What lies behind us and what lies before us are small matters compared to what lies within us." -- Ralph Waldo Emerson
FLUID UI Toolkit
|
|
|
|
|
ok, now what?
can I pretranslate the IE client WND's messages from inside an embedded component?
What can I do?
|
|
|
|
|
|
|
from MSDN
Some objects might want to support the inside-out activation model by marking themselves with the OLEMISC_INSIDEOUT flag. In this model, a single click on the object causes it to be activated in place.
mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VS\1033\inole.chm::/D1/S12f9.htm
Therefore, to select the object as a whole, the user selects the border, or some other handle, provided by the object or its container. For example, the container
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch12f.asp
I found out that If i click the top level window(the one with the elipse drawn from my example), the backspace will work.
Now I know why it wouldn't work in the first place, the ocx has the OLEMISC_ACTIVATEWHENVISIBLE flag, but it WON'T activate when visible, as the quote above from suggests, unless the user clicks the control border.
Now, who in their right mind is going to click the border instead of the CEdit in the control?
jdunlap's link doesn't work, because my example is an active X control and not a ATL Com control, so the activateinplace method is not exposed.
Also, MDunn's suggestion won't work either because it's not a keystroke problem
|
|
|
|
|
how to load and write data into SQL server? please show me ex.
thanks
Nho'c Ti`
|
|
|
|
|
SQL's INSERT command would probably be a good start
I'm drinking triples, seeing double and acting single
|
|
|
|
|
hello ppl,
i am making a very simple program that is a window application. pretty much a basic hello world program to just get myself started and i have the program set up. its written in c++ and compiled with visual basic 6.0
my question is how do you pick text colors and font size? i also have a couple console programs (they open with a dos command prompt) and i would like to know how to do it in those as well. its been making me insane cause its taking so long to find something as simple as the code to change text color.
mabie i would even like to add a next page to it so u can toggle pages, but i want to take it one thing at a time and try and figure this color thing out first.
i would appreciate any help or advise, thank you.
|
|
|
|
|
How did you write it in C++ and compile it in visual basic?
Visual Basic allows you to change the color by setting the window/form object property...if I remember correctly...it's something like forecolor and backcolor if you want to do it dynamically at run time. Or you can play with the properties though the properties dialog box.
In C++ assuming your using MFC or SDK it's a little different...there is no way to cheat and use a properties dialog box, you have to code it like the first example I gave you in visual basic.
pDC->SetTextColor(RGB(64,128,255)); if your using MFC or
SetTextColor(hdc, RGB(64,128,255)); if your using SDK
As far as setting text colors at the DOS console...thats totally different.
I believe in c, you had to use a library like borlands BGI library..in QBasic...I believe it was the COLOR statement.
This should atleast give you a starting point to work from so long as I understand you correctly anyways...
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Hockey wrote:
How did you write it in C++ and compile it in visual basic?
That's what I was wondering too, but actually, I think he means in Visual Studio.
"To know what is right and not do it is the worst cowardice." -- Confucius
FLUID UI Toolkit
|
|
|
|
|
hi,
thank you for your seggustions i will try the out when i get the chance. i think i did mean visual studio... its the program called microsoft visual c++ 6.0. sorry about the mixups im a coding newbie. (n00b alert)
i have edited lots of good code but never really come up with my own program from scratch. I customized quake2.exe to have all kinds of new features, graphics and commands. i made my own mod for quake2 also (thats gamex86.dll). i pretty much did it all with no help or prior experience but now i want to attempt something simple as making my own little program and its a lot harder then i would have imagined.
thanks again
|
|
|
|
|
hockey,
i tried the code you gave me and it worked! thanks a lot man i really appreciate that. the line i entered was..
SetTextColor(hdc, RGB(64,128,255));
theres one thing i was wondering about... theres a white highlight to just the text, i changed the backround and text color but there is still a white backround to the text. im going to try and see if i can switch that color too thanks again.
|
|
|
|
|
SetBkMode(TRANSPARENT)
I'm drinking triples, seeing double and acting single
|
|
|
|
|
eheh got it, i think my line was setbkcolor. i just searched the include files for the settextcolor line, and saw it right above.
the program is set to draw one string. i tried to add another and i cant get it to draw the second one. i was thinking about having it show one little page of info. Then going through the menu or other button and having it display another string of info, kind of like a bunch of pages. any idea on how to do something like that? another thing that would be a cool addition would be a image added to the backround. i saw a ton of functions for the images in the include files and it would be a prayer if i actually found the right function for this.
im gonna keep messing with it though and learn as i go.
-later
|
|
|
|
|
I found this sample program here and
have some problem when the formview
is small enough to display scrollbar.
It prints out the content as well as
the scrollbar. How can i avoid printing
out the scrollbar?
Any help is appreciated.
Thanks
Shin
|
|
|
|
|
Ok i don't know the right terminology for this so this is also included in my question. If i have an IP i want to convert it to a name like e.g. 62.56.23.1 is the same as proxy.parabla.gr (just an example its not real but u know what i mean). How can i do this? Is there a Winsock2 function i can use for this because i think it is all very unclear in the MSDN and i need something that works on Win9x as well as 2000/XP.
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|