|
Sorry, I thought you wanted to send messages from one view to the other.
For your acceletators, try to use CMainFrame or the CMDIChildWnd.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Ok, thank you for your time.
Nelson Gonçalves
|
|
|
|
|
What's the difference between CCriticalSection and CSingleLock ?
When should i use CCriticalSection and when CSingleLock ?
|
|
|
|
|
Hi..
you use CSingleLock and CCriticalSection to control access to a resource you only need to wait on one object at a time and just one thread at a time can access this resource.
|
|
|
|
|
Hi,
I am working on an application in which the mainframe is split into four panes. Two panes are folderviews and the other two are fileviews. I created a separate view for each pane.
The folderviews are derived from CFormView and consist of a CTreeCtrl and some CBitmapButtons. Both folderviews are identical, yet I have to do all coding twice. As far as I know I cannot create a single class and derive both folderviews from this class as dialog id's have to be unique.
Is there any way around this problem. It seems like a waste of code and I do not like the double maintenance.
Woody
|
|
|
|
|
how I can change the tiltle Bar, StatusBar and Dialog BackGround Color....
Thanks In advance
|
|
|
|
|
For dialogs (and even StatusBar??) you can implement CWnd::OnCtlColor , there reacting on CTLCOLOR_DLG. If this doesn't work for status bars you could try OnEraseBackground .
And what about title bars? I remember that I've seen some articles about that here on CP;)
|
|
|
|
|
BOth Not works,
OnEraseBackground errases background, but how I set new background eg (Dialog with RED background)
|
|
|
|
|
OnCtlColor works for sure when used for dialogs. Here's an example:
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
switch (nCtlColor)
{
case CTLCOLOR_DLG:
{
CBrush* back_brush;
COLORREF color;
color = (COLORREF) GetSysColor(COLOR_BTNFACE);
back_brush = new CBrush(color);
return (HBRUSH) (back_brush->m_hObject);
}
}
return(CDialog::OnCtlColor(pDC, pWnd, nCtlColor));
}
And a solution for OnEraseBackground could look similar to this:
BOOL CSampleView::OnEraseBkgnd(CDC* pDC)
{
CBrush backBrush(RGB(255, 128, 128));
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect);
pDC->PatBlt(rect.left, rect.top, rect.Width(),
rect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
return TRUE;
}
*both examples taken fom MSDN and slightly modified
|
|
|
|
|
yes u are right...OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
works well,....
UPDATES In Initial Requirements.... ;P
Now I want to change the Background of Property Sheet.
OnCtColor works well for property pages, but not works for Property Sheet...
ALthough Property Sheet to inherit from CWnd....
|
|
|
|
|
Hello:
I am in the midst of trying to make a small dialog based application that has an interface to a COM port. I need to be able to display the data that comes from the COM port into a text type box that is organized in specific rows and columns similar to a terminal display. I have tried to use an edit control, a static text box and other types of controls but none give me the features I need. I am curious as to whether anyone has any idea of where I can start with this project in order to get it off the ground.
Here I list the requirements that are needed for this text display area...
- It needs to permit me to use a fixed width pitch for the characters so that distinct columns are produced. It would be nice of the actual font used is selectable but that is not a requirement.
- The text area needs to be accessable to dynamically determined row and column positions of the array so that a text string can be displayed.
- Any given part of the text needs to be able to be displayed in an alternate color scheme. Ideally the effect that needs to be achieved is to make certain text appear as reverse video to the rest of the text in the box.
- It is not really necessary for there to be any kind of cursor in the text area for "user entry of data. Just think of this text area as a display field.
- The control mechanism needs to be able to function as a control on a dialog.
I am somewhat experienced with creating windows applications but so far all my work has been with dialog based applets. The current project is one of this type and the request for help here is to try to add a small display window to the dialog that works somewhat like the text box of a HyperTerminal window with regards to the display of data characters that will be arriving from a serial port.
Any help, discussion, pointers, or sample code would be extremely helpful to me.
Note that I am working in a Win32 environment with MFC and Visual C++ Ver 6.
Thanks
Mike Karas
-
|
|
|
|
|
use a list control that does what u r looking for..and it also displays in rows and colums..search for more on list in CP and u will find many such articles...
cheers
Himanshu
|
|
|
|
|
I have looked at all the CList control articles on this web site and tried to study each carefully. I cannot directly see how a list control would be used to simply display a box of text. I did see one article about using the CustomDraw features of the List Control - but that seems way over kill to me....... does it need to be this complicated to support a terminal emulator screen at 25x80 characters with just a reverse video attribute capability?
Michael Karas
|
|
|
|
|
I would think about a "owner drawn" control. You derive a CStatic in which you Paint yourself. Then you need a output, for which you make such a control in your dialog resources.
It´s a lot of work, but you´ll should enjoy it.
Try this @ home. (B&B)
|
|
|
|
|
Thanks for the suggestion.....unfortunately I have no idea where to start in order to implement such a control. Can you make a suggestion where I can see a sample CStatic control in "Owner Drawn" mode that supports multiple lines (25 in my case) where the string for each row would be independent and each row need to be displayed in a manner with some text in normal video (black char on white background) and some characters in reverse video (white char on black background)?
Michael Karas
|
|
|
|
|
It is very simple you drawing in the Onpaint message handler evry thing. with Texout and so on. There is the CDC class which will help you.
Try this @ home. (B&B)
|
|
|
|
|
Does anyone have a code snippet (or can describe) how to load contents of a file into an object that exposes the interface IStream? The idea is I want to be able to pass an IStream which can be used to read the contents of this file. There does not need to be a direct link between the interface and the file - I need to load the file's contents into the object and access the aforementioned contents using IStream..
TIA!!
|
|
|
|
|
One implementation looks like :
CreateFile() and ReadFile() to open and read the file contents. Then create a new IStream(CreateStreamOnHGlobal()) and then
pStm->Write();//write file contents
I haven't checked this out. but theoritically this ought to work. These is also the new SHStreamOnFile() function that seems to do what we want.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
Thanks, Amit.
That, in fact, does work. I had discovered it a couple of weeks ago (I forgot to follow-up on my question). Once you've got a memory buffer and a corresponding HGLOBAL, you can use CreateStreamOnHGlobal to generate an instance of a stream object with an IStream interface.
Thanks!
|
|
|
|
|
Yes, I tried it too. Now let us suppose we were to write something like StreamFromFile([in] LPCTSTR szFile,[out,retval]IStream *ppStream). I can only see a related MAPI utility function and an shlwapi 5.0+ function SHStreamFromFile(). The implementation I guess is no longer a mystery.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
hi,
how do i change the titlebar text of a sdi program? i want the titlebar to display "My program", not "My program - Untitled".. is there a way to make the windows not displya "- Untitled"? i tried modifying idr_mainframe, but that didn't work.. thanx in advance..
|
|
|
|
|
|
thx for the help, once again.. mike.
|
|
|
|
|
I know this sounds crazy but I'd like to build an application that will allow we to modify other applications' icons. I have an application that generates other small exe files and I want to allow users to select or paste an icon into my configuration app for them. Is there an API for this ? Any ideas about how to do this ? I want to do it in VC++
Thanks,
Matt
|
|
|
|
|
take a look at the UpdateResource() function
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|