|
when you OnSize, dynamically resize the bitmap to the client area rect, then CListCtrl::SetBkImage(), there are good chapters on bitmap manipulation in Charles Petzold's programming windows 95 and Programming windows with MFC by j. procise
|
|
|
|
|
|
Im currently working on an addin for visual studio 6.0 and I need to retrieve the selected item in the classview, the item could be the name of a class, method or attribute.
Any suggestions? Im totally stucked
|
|
|
|
|
There's a special UI tool in O'reilly's "Win32 API Programming with Visual Basic" on the compliment CD, that lets you grab any child window's handle by clicking on it.
You could get that book, then use the tool on the CD to get that class tree control's window handle, and view it's messages. It no doubt sends notify messages to its parent.
|
|
|
|
|
I'm relatively new at SDI programs (and I haven't touched MDI yet), but I have worked with MFC dialogs a lot. It would be convenient to be able to create a dialog resource (probably one without a frame) and then be able to use that as my view. Is this possible to do? If so, how would I go about doing this?
If this is not possible to do, where would I create windows such as CButtons and CEditBoxes? I tried doing this in the OnPaint function, but I just get flicker. Thanks for any help you can give me!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
If you want want to use a dialog as your main view either use AppWizard to create a dialog based application or, if you really want an SDI app, in the final stage of AppWizard change the base class of your view class to CFormView.
OnPaint is called every time the window needs redrawn, so is not the place to create controls. You could overload the Create method for the view and create them there.
You probably should get hold of a book on MFC programming - I found an earlier edition of this one very useful when I was learning the basics (I still refer to it a lot).
Niall.
|
|
|
|
|
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.
|
|
|
|