|
|
|
at the release of VS.NET 2003 they demo'd how you could use the IDE form editor with C++ projects now, including all that cool anchoring stuff. My understanding is that this is only available for managed C++ projects, not for MFC. Is this right?
|
|
|
|
|
Unfortunately, that is true. But you can use unmanaged code in a managed project. I haven't gotten into that yet.
Do Lipton employees get coffee breaks?
|
|
|
|
|
Hello...I have a form with some edit controls boxes and buttons. There are two modes (1 and 2). In mode 1 some edits controls should be available for editing, and a button visible and available; and other controls should be unavailable for editing and another button not visible.
Changing to mode 2 invert the availability.
My problem is that I do not know if this is possible to do it at runtime. If this is possible, how do I do it?
I know where to put the code to enable and unenable the controls, but I would like to know what are the visual c++ statements to do this.
Can anyone give me a hand?
What I meant is how can I change the edit control styles and button control styles, specifically WS_TABSTOP and WM_ENABLE? This at run time
Thanks
Eric Manuel Rosales Pena Alfaro
PhD student
Unversity of Essex
Wivenhoe Park
Colchester, CO4 3SQ
Essex, Uk
email: emrosa@essex.ac.uk
tel: +44-01206-87311
|
|
|
|
|
EnableWindow() // TRUE or FALSE (controls are windows)
ShowWindow() // SW_SHOW or SW_HIDE
Trust in the code Luke. Yea right!
|
|
|
|
|
Your_Control.EnableWindow(1) ->Enables control in run time
put the arg to 0 to disable..
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
Hi there,
I'm having a problem with the WSAAccept() command on MSVC 6.0, using ws2_32.dll. Using the code below (before calling listen) it goes something like:
bind() etc...
int setsockopt(mySock,SOL_SOCKET,SO_CONDITIONAL_ACCEPT, (const char*) val, sizeof (val));
listen()...
The problem is that it just won't compile, I've tried changing the version, using winsock1 etc. The compiler just doesn't recognise the function call, like it isn't in winsock2, but I know from a Microsoft book ("Writing Secure Code") that it is. I'm very confused!?!
Once again thankyou in adv.
noxon
|
|
|
|
|
are you linked with ws2_32.lib..???
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
OK, I am newbie, writing a MFC SDI-app, and I want to write text to my view.
Besides the text, there is a lot of drawing in the view, primarily lines and rectangles which I draw, basically this way:
<br />
CClientDC ClientDC(this);<br />
CRect area;<br />
<br />
area.SetRect( 10, 10, 250, 400);<br />
DrawRectangle(&ClientDC, area, 2);<br />
<br />
area.SetRect( 10, 10, 40, 399);<br />
DrawRectangle(&ClientDC, area, 1);<br />
<br />
...<br />
And DrawRectangle is the following:
<br />
void CITPAView::DrawRectangle(CDC *pdc, CRect rect, int width)<br />
{<br />
COLORREF penn, bakgrunn;<br />
penn = RGB(0, 0, 0);<br />
bakgrunn = RGB( 255, 255, 255);<br />
<br />
CBrush Pensel( bakgrunn);<br />
CPen Penn( PS_SOLID, width, penn);<br />
<br />
pdc->SelectObject(&Penn);<br />
pdc->SelectObject(&Pensel);<br />
<br />
pdc->MoveTo( rect.left, rect.top);<br />
pdc->Rectangle( rect.left, rect.top, rect.right, rect.bottom);<br />
}<br />
This drawing works just fine as far as I can see, but it gets me to another question:
- Memory cleanup, how should I go about here? And if anyone got a more efficient way to do this, go right ahead and tell me, please!
I have found out how to write plain text with the CDC-class, but how do I output it in a certain angle? Is there some smart way to do this?
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
OldViking wrote:
I have found out how to write plain text with the CDC-class, but how do I output it in a certain angle? Is there some smart way to do this?
Use the Escapement member of the font to set the angle in degrees, starting from ->straight left.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
How do I set up a message handler that notifies my dialog application that a byte has hit the serial port? I have been given the website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
but I only leave this site more confused as I did before.
My Serial read functions are working great when in a loop, but I need my application to remain event driven.
Thanks
Kevin Shaffer
Student of Computer Science
University of Kansas
kshaff03@msn.com
|
|
|
|
|
You could use PostMessage() to send a user defined message to the app. I assume the serial port stuff is running in a thread. Also have a look at articles here on CP re. serial ports.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
You need to have a second thread in your application that checks for events. I am not sure if the website that you are listing is the same that I have looked at 3 years ago but if it is, they list all the functions needed. The main problem is that you need to have a thread that checks your port.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I have a client who is installing an NT Service on a W2K server in a Novell network. The can install but are unable to start the service. I don't have any Novell experience...yet!
My gut reaction is that Novell may require the user the service runs under to have some special permissions. Any ideas or guidence on where to look to solve this?
Thanks,
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
Does anyone know how to automatically perform a funcion when a dialog appears, such that in the function you can update an edit control and the user can see the update? I basically need to perform a function when the dialog is loaded, and throughout the function it sends updates to an edit box to display the status of the function. I tried placing a call to the function in OnInitDialog() but the dialog doesn't paint until after the function has returned. Does anyone know how to do this?
|
|
|
|
|
At the tail-end of OnInitDialog(), use PostMessage(). This will place a message in the dialog's message queue, but still allow OnInitDialog() to return.
|
|
|
|
|
i am a novice myself, but if i understand you correctly this is the answer to your question.
use the function SetDlgItemText(int nID,LPCTSTR lpszString);
for example:
i call a function which writes to a CEdit control from OnInitDialog() in one of my applications, this is how i display text in the edit box.
SetDlgItemText(IDC_YOUR_EDIT_CONTROL,yourString)
or using the class wizard you can assign a CString variable to the edit control.
Once you do this you will it be defined in the header file.
//header
CString yourEdit;
then in your OnInitDialog() do the following:
//cpp
yourEdit = yourString;
UpdateData(TRUE);
I hope this is what you asking for
|
|
|
|
|
Desanto is correct on how to replace all text in the edit control in OnInitDialog().
It also appears you want to receive more updates after the dialog is loaded. One way of doing that would be to start a timer using SetTimer() and handle the WM_TIMER message, so you can check if an update is required.
1) if you want to replace all text call SetDlgItemText().
2) If you want add to the current text then you have to A) use EM_SETSEL (CEdit::SetSel()) to set current selection to end of currently displayed text [it might already be set there by last write], B) use EM_REPLACESEL (CEdit::ReplaceSel()) to insert the new text you want to add [followed by CR/LF].
Hope this helps.
Trust in the code Luke. Yea right!
|
|
|
|
|
I'm doing the following
#include <fstream.h>
then later
fstream fin;
and it gives me this error.
C:\parsells\C++ Testing\ccode\odbc_stuff\odbc_stuff.cpp(137) : error C2872: 'fstream' : ambiguous symbol
there is other code in there as well, but that is where it says the error is.
ICXC
NIKA
|
|
|
|
|
scope?? are you 'using namespace std?'
std::fstream
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
when I put in the std:: infront of the the fstream the error changes.
I wrote this code and compiled it on it's own and it all worked, now when I'm trying to merge it into some code that I downloaded it doesn't work. here's what I'm doing.
std::fstream fin;
fin.open(filename,ios::in | ios::nocreate);
the errors I get are:
odbc_stuff.cpp(30) : error C2079: 'fin' uses undefined class 'basic_fstream<char,struct std::char_traits<char=""> >'
odbc_stuff.cpp(31) : error C2228: left of '.open' must have class/struct/union type
odbc_stuff.cpp(31) : error C2039: 'nocreate' : is not a member of 'basic_ios<char,struct std::char_traits<char=""> >'
odbc_stuff.cpp(31) : error C2065: 'nocreate' : undeclared identifier
I don't get it. I thought I was doing a standard file open.
ICXC
NIKA
|
|
|
|
|
I created a Win32-based (MFC, ATL and ActiveX support via wrappers) control a while back. The thing is generally useful, and I find myself using it quite a bit. The problem is that I have to constantly refer to the headers to find message and notification declarations, and then hand-code the message maps, etc.
I'd really like VS.Net to automagcially support my class as well as it does, say, COMBOBOX. Is there a way to declare the interface of my control to VS so that it can add the appropriate stuff to the "events", "messages" and "overrides" section of the properties window (shown when a class is selected in Class View. I'd really like it to work when a member of my control class is added to a dialog, AND when I use CCtrlView with my class.
Anyone have experience with this? Or, at least know where this stuff is documented?
Thanks,
|
|
|
|
|
Hi,
Here is my problem. I have a MDI App that countain some modeless dialogbox. I would like to make sure that my dialogs are always withing the boundary of my mainframe. Also, I would like to find a way that my dialogs follows the MDI App when I move the mainframe.
Any Ideas?
thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Have u tried using CWnd::MoveWindow for your modeless dialog?
|
|
|
|