|
Why not create the controls through the recource editor and hard code them in your class or use the appwizard for creating controls!
I prefer hardcoding all controls.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Hi,
I have many dialog boxes in my application, and I need to transfer the data to another dialog box, in other words how do I access the data stored in a variable in a dialog from another one.
Hope my question is quite clear,
Thanks
Deepak Samuel
|
|
|
|
|
One solution is messages. Send a message to the parent window and have it dispatch does the data transfer.
Kuphryn
|
|
|
|
|
when you want to access a public member variable of dialog A from dialog B just do that:
((CDialogA*)GetParent())->m_member_variable = ...
in case of CDialogA being the parent of dialog B
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Where we have to write this code "((CDialogA*)GetParent())->m_member_variable = ...";
please help me....
Thanks a heap...
|
|
|
|
|
I am trying to learn how to open and communicate through a communication port (COM) but I am new and don't know were to start. Can anyone reply with a helpful website seggestion or maybe even a book... THX
[It is possible to represent everything in this universe by using 0 and 1]
I'm going to live forever or die trying.
|
|
|
|
|
Here is one reference from MSDN on serial port.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
Kuphryn
|
|
|
|
|
Here are some links on codeproject:
Link 1: [^]
Link 2: [^]
Link 3: [^]
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Dear Friend
I used file operation method to get a grip with communication port and as it's my first time I've lots of problem and couldn't continue so...
I'd be appreciated if you could advise me
Regards
BOOL CMainFrame::InitSerialPort()
{
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
m_hComPort = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if(m_hComPort == INVALID_HANDLE_VALUE)
{
// Handle the error.
CString str;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str);
return FALSE;
}
fSuccess = GetCommState(m_hComPort, &dcb);
if (!fSuccess)
{
// Handle the error.
CString str1;
str1.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str1);
return FALSE;
}
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
fSuccess = SetCommState(m_hComPort, &dcb);
if(!fSuccess) //////////// this line hs been repeated ////////
{
// Handle the error.
CString str2;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str2);
return FALSE;
}
return TRUE;
}
|
|
|
|
|
Check out the previous post and the links there:
[^]
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
DeaR friends
I use the file operation method to get a grip with Communication port but as it is my first time, I have lots of poblems and couldn't continue so!
I used this method as bellow.
I'd be appriciated if anyone could advise me.
Regards
BOOL CMainFrame::InitSerialPort()
{
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
m_hComPort = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if(m_hComPort == INVALID_HANDLE_VALUE)
{
// Handle the error.
CString str;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str);
return FALSE;
}
fSuccess = GetCommState(m_hComPort, &dcb);
if (!fSuccess)
{
// Handle the error.
CString str1;
str1.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str1);
return FALSE;
}
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
fSuccess = SetCommState(m_hComPort, &dcb);
if(!fSuccess) //////////// this line hs been repeated ////////
{
// Handle the error.
AfxMessageBox("SetCommState failed with error %d.\n", GetLastError());
return FALSE;
}
return TRUE;
}
|
|
|
|
|
How can I get Hyperlinks into a CTreeCtrl?
I need individual items of the tree to function and look like hyperlinks.
Thank you,
XP
|
|
|
|
|
you probably won't like my answer
you can add the normal, non-linked url text to give the tree items the propersize, then cycle through them and get each of their rect bounds for the ones you want to hyperlink, then make an instance of 1 Subclassed CStatic over each TREEITEM bounds rect. (CStatic subclassed with the mouseover(trackmouseevent) and cusor change, + notify OnPressed + MAPPED function in parent, to the parent for the link)
for (int i=0; i
|
|
|
|
|
Better find an example of a custom-draw treeview control and customize it to display blue underlined text. To make the mouse cursor behaving as on hyperlinks you'll need to invent detection of where the cursor resides at each moment it is under the control (there is a simple WinAPI function that reports if the mouse cursor is under the text, or icons, or white space) and use a timer to detect OnMouseLeave. 2-3 day of work, probably
--
Best Regards,
Andrew
|
|
|
|
|
Hi all
why does this mean?
(CTestDoc*)m_pDocument;
Thanks
|
|
|
|
|
just like that ? no context ?
it simply means that the m_pDocument (that must be a CDocument class) is casted into a CTestDoc class.
meaning that the variable will be "seen" as a CTestDoc instead of the generic CDocument base class.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Thanks
Why? it is (CTestDoc*)m_pDocument; not CTestDoc* m_pDocument;
|
|
|
|
|
Because it's not a variable definition, it's a cast.
|
|
|
|
|
the first one is operation called 'casting' - looking to the same thing in a different way - e.g. when one object is derived from some base and you have a pointer to that object, you can cast it to be the pointer to the base and use methods from the base class, but still using the same instance of object.
The second constructs creates a new uninitialized pointer to CTestDoc.
|
|
|
|
|
(CTestDoc*)m_pDocument; //this is type cast
CTestDoc* m_pDocument; //this declares a variable
Consider this:
void* GetDocument(); //function declaration -> notice it returns a void*
CTestDoc* m_pDocument; //declare a variable of type CTestDoc*
m_pDocument = (CTestDoc*) GetDocument(); //Call the function. Notice how the result is cast using (CTestDoc*). A void* would not fit into the m_pDocument variable of type CTestDoc*. Hence it is cast using (CTestDoc*).
XP
|
|
|
|
|
Hi all
is this Casting?
(void *) TNptr;
|
|
|
|
|
yes, it casts TNptr into a void* pointer ( generic pointer).
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
It may help to point out that casting usually occurs on the right hand side of the assignment operator (=). Casting means "make this variable look like...". So if the compiler encountered statements like this, it would complain about the invalid assignment to pFoo :
CBar aBarObject;
CFoo* pFoo = &aBarObject;
But if you made &aBarObject look like a pointer to a CFoo (for the purpose of the assignment), all would be well. As in:
CBar aBarObject;
CFoo* pFoo = (CFoo *) &aBarObject;
Hope this helps.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I’m writing telnet program. All chars I get from client socket (except telnet commands of course) I pass to command.com/cmd.exe (running in separate process).
Problem is: when client passes “regedit.exe” for instance – it is run on server machine ( !!) which is not what I intended …..
So the question is: HOW to protect from running GUI programs by my command interpreter?
(I’m pretty sure it can be done ... in pure DOS you can see the message “This program can not be run in DOS mode … this is what I want)
Please HELP
|
|
|
|
|
You mean you're writing a telnet _server_.
But anyway, that's not necessarily a bad thing to run windows apps. For remote administration I find it useful to run, for example, "shutdown.exe /l /r /c /y /t:60" from the NT Reskit via telnet or remote shell, which I believe is a non-console app.
|
|
|
|