|
How change volume of sound and cursor in system (9x)
|
|
|
|
|
It is necessary to create CListCtrl so that the user could not change the size of columns. Flag LVS_NOCOLUMNHEADER cannot be used. Columns should have header.
Help me.
|
|
|
|
|
Hi!
Try to handle WM_SETCURSOR, HDN_BEGINTRACKA/HDN_BEGINTRACKW and HDN_DIVIDERDBLCLICKA/HDN_DIVIDERDBLCLICKW messages:
BEGIN_MESSAGE_MAP(CMyHeaderCtrl, CHeaderCtrl)
...
ON_WM_SETCURSOR()
ON_NOTIFY_REFLECT_EX(HDN_BEGINTRACKA, OnBeginTrack)
ON_NOTIFY_REFLECT_EX(HDN_BEGINTRACKW, OnBeginTrack)
ON_NOTIFY_REFLECT_EX(HDN_DIVIDERDBLCLICKA, OnDividerDblClick)
ON_NOTIFY_REFLECT_EX(HDN_DIVIDERDBLCLICKW, OnDividerDblClick)
END_MESSAGE_MAP()
BOOL CMyHeaderCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
DWORD dwPos = ::GetMessagePos();
HDHITTESTINFO hdhti;
hdhti.pt.x = LOWORD( dwPos );
hdhti.pt.y = HIWORD( dwPos );
ScreenToClient( &hdhti.pt );
DefWindowProc( HDM_HITTEST, 0, ( LPARAM )&hdhti );
if ( !IsResizableColumn( hdhti.iItem ) && ( hdhti.flags & HHT_ONDIVIDER ) )
{
return true;
}
// Do default processing
return CHeaderCtrl::OnSetCursor(pWnd, nHitTest, message);
}
BOOL CMyHeaderCtrl::OnDividerDblClick(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
if ( !IsResizableColumn( phdn->iItem ) )
{
*pResult = 0;
return true;
}
// Do default processing
return false;
}
BOOL CMyHeaderCtrl::OnBeginTrack(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
if ( !IsResizableColumn( phdn->iItem ) )
{
*pResult = 1;
return true;
}
// Do default processing
return false;
}
Regards,
Nikolay Denisov
|
|
|
|
|
Hi
This Doc/View architecture is still giving me a headache. I'm using the Kodak Imaging Controls Admin, Thumbnail and Edit. I have a SDI with three panes. One shows the thumbnail control, the other shows the edit control, the other live video and the admin control resides in CMainFrame. Except I'm certain this isn't an efficient way of doing things because I end up with code like in CMainFrame:
CDocument * pDoc = GetActiveDocument();
POSITION pos = pDoc->GetFirstViewPosition();
while (pos)
{
CView * pView = pDoc->GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CEditView)))
((CEditView*) pView)->SetImage(strFullPathName);
if (pView->IsKindOf(RUNTIME_CLASS(CThumbView)))
((CThumbView*) pView)->SetImage(strFullPathName);
}
It seems I have two choices.
1/ Derive my ThumbView & CEditView class from some base class (eg. ImageView) and have virtual functions for eg. SetImage. But wouldn't this still require calling IsKindOf because I would only want to call ImageView and not say MovieView which I also have?
2/ Or do I put all the controls in the Document class and my views can just access them when needed? However because the thumbCtl is only concerned with displaying images, this seems incorrect
Of course there's the 3rd possibility that I've got everything wrong
Any advice is greatly appreciated.
Regards
Brendan
|
|
|
|
|
There are lots of solutions to this problem actually.
The most efficient is probably to derive your classes from a common CImageView class. Then you can override these functions in the actual view class to do what you want.
Now, instead of using the Doc/Vew mechanism for calling functions, which is inherantly error prone, you can instead create a publish/subscribe handler, also called Observer Pattern.
In your CDocument derived class, you create and instance of an Observer class. This is a class which simply takes a pointer to some other kind of class (CImageView in this case) and stores it in a list. Then, when you go to update, you need only get each item in the list (and since they're already stored as CImageView pointers, you need only do this pListItem->SetImage(...).
This avoids all the issues your dealing with by calling the functions directly, and then only for the objects which are actually CImageView's.
example (off the top of my head, so it may not compile):
#include <list>
class CImageViewObserver {
std::list<CImageView*> imageList;
public:
AddView(CImageView* pView){imageList.push_back(pView);}:
RemoveView(CImageView* pView){imageList.remove{pView);};
Update(CString s){};
}
Then, in your CThumbView or whatever simply put a call to AddView in your OnCreate(), or OnInitialUpdate() (but be sure to clear out your Observer in OnNew() to make sure you don't leave anything hanging around):
CMyDoc *pDoc = (CMyDoc*)GetActiveDocument();
pDoc->m_ivObserver.AddView(this);
Then, wherever you update, you need only pass the image path to the Observer::Update function.
|
|
|
|
|
Hi,
I know there is both std::string for standard asci text, and std::wstring for unicode chars...
My problem is that I want to write code that compiles both with and without unicode defined. With chars I just use TCHAR, and the preprocessor makes the work for me, is the anything defined when using STL?
TIA.
- Anders
|
|
|
|
|
The following is based on Microsoft's version of STL included in MSVC 6.0 SP3.
std::string is really just the definition std::basic_string<char> and std::wstring is std::basic_string<wchar_t>. If you want a TCHAR version you will have to declare your own as I have not found support for it directly: So in a header file you can define
#include <tchar.h>
#include <string>
using std::basic_string;
basic_string<tchar> tstring;
Then use tstring where you would use string 's or wstring 's. TCHAR will be preprocessed into the proper version for you.
Of course, you can apply this to all the character based STL using the 'basic_*' template definitions.
For example:
A build specific version of cout could be:
basic_ostream<tchar> tout;
It is up to you if you want to add these to the std namespace or your own. But it would not take much to create a header file that defines all character related stl classes in this manner. However, there are some interface functions that do not use the char_traits<> template (such as basic_ifstream::open which takes a const char * for the name of the file to open) so just be aware of these.
Good luck,
Chad
|
|
|
|
|
The original post seemed to eat my < > chars:
The following is based on Microsoft's version of STL included in MSVC 6.0 SP3.
std::string is really just the definition std::basic_string< char > and std::wstring is std::basic_string< wchar_t >.
If you want a TCHAR version you will have to declare your own as I have not found support for it directly:
So in a header file you can define
#include < tchar.h >
#include < string >
using std::basic_string;
basic_string< TCHAR > tstring;
Then use tstring where you would use string 's or wstring 's. TCHAR will be preprocessed into the proper version for you.
Of course, you can apply this to all the character based STL using the 'basic_*' template definitions. For example: A build specific version of cout could be:
basic_ostream< TCHAR > tout;
It is up to you if you want to add these to the std namespace or your own. But it would not take much to create a header file that defines all character related stl classes in this manner. However, there are some interface functions that do not use the char_traits<> template (such as basic_ifstream::open which takes a const char * for the name of the file to open) so just be aware of these.
Good luck,
Chad
|
|
|
|
|
Thanks a lot, I'll do it my self...
I just thought that, maybe, MS had done it for us...
- Anders
|
|
|
|
|
I am looking for a way to force my MFC program to
look at the message queue, like the Visual Basic
DoEvents() function. Like this:
while(some_bool)
{
callFunc();
Force_To_Look_At_Message_Queue_Func();
}
Does anyone have any good ideas?
Thanks!
|
|
|
|
|
I have the following static function in my class. (I also have a non-static function that takes no arguments and simply calls HandleMessages(m_hWnd, true). The reason I gave it the option to not do Idle processing is that OnIdle will kill the table that maps your CWnd's to HWND's. That is, if you have a temporary CWnd*, it will be useless after Idle processing happens. Anyway, all the function does is mimic what your program does while it's sitting around doing nothing. (The declaration is private: static void HandleMessages(HWND hWnd, bool bIdle = true))
void CypherusDlg::HandleMessages(HWND hWnd, bool bIdle )
{
MSG msg;
while (::PeekMessage(&msg, hWnd, 0, 0, PM_NOREMOVE))
{
if (!AfxGetApp()->PumpMessage())
{
break;
}
}
if(bIdle)
{
LONG lIdle = 0;
while (AfxGetApp()->OnIdle(lIdle++))
{
}
}
}
|
|
|
|
|
Hi,
We are having a problem with our MFC application which seems to be related to MFC's temporary/permanent handle map mechanism. Our application incorporates HTML Help functionality. If we bring up the HTML Help file, the application asserts when it is being closed. This does not happen in case the HTML Help file is not brought up.
We had break points in most of the Wincore.cpp functions. Our point of concern is the CHandleMap not getting the correct pointer. Following is the statement which causes the problem
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
We debugged into afxMapHWND() to find some details. From what we have seen, member variable m_pmapHWND should not be NULL. This map contains both temporary and permanent Maps for CWnd vs HWnd for the windows created by application vs windows opened by the application.
Any pointers on why the m_pmapHWND attribute gets invalidated in case the HTML Help file is brought up would be greatly appreciated.
P.S. The call to HtmlHelp API is:
HtmlHelp(0, strFileName , HH_HELP_CONTEXT, nContextID);
|
|
|
|
|
Hi,
Is it possible to save an HICON(from a CImageList) into an ico file with VC++.
I've got the ico file structure, but I don't know how can I have a DIB from my HICON...
Thanks a lot, for help
Vincent
|
|
|
|
|
i am eager to wait your reply.
thanx
|
|
|
|
|
The Rogue Wave/Stingray package has a class to display GIFs, its the only one I know of.
The reason there are not many such classes is that to use GIF you have to buy an expensive license from Unisys. I looked into this once, and couldn't even find a person at Unisys who could tell me how to go about getting GIF license. I concluded that Unisys would rather sue people using GIFs than sell them a license.
Is there any reason your application can't use PNG or JPG formats? There are plenty of good classes for these formats.
|
|
|
|
|
Yup, I agree... If your app doesn't _need_ to be GIF-compatible, use PNG.
Also, check out http://www.paintlib.de. Some very usefull stuff here, if you ever menage to compile it
Enjoy!
Marc
|
|
|
|
|
MArc, if, like me, you got paintlib 2.3 the day it came out, the gif link was pointing to the wrong source - I needed to make a number of changes to get that one to compile, although I believe the one up now is quite alright. The other thing you may find ( at least I did ) is that the jpeg encoder swaps the r and b values, which I have written to tehm about.
paintlib rocks. it also has a mailing list where you can get help on these sorts of issues, and gets around the gif issue by using a library that reads them and writes them uncompressed ( i.e. no patent infringement )
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi Guys!
Do you all mean -> GIF images OR -> ANIMATED GIFs?!
If it is about Animated GIFs, then I had posted here before, also I tried other places. Unfortunately never got replies!
If it is about just the GIF image loading/veiwing, then the PaintLib is excellent!
However, I am still interested to have any reply on the Animated GIF programming, something like the things we do with AVIs.
"Silence is golden, but my eyes still see."
-- Masoud Samimi
Website: www.geocities.com/samimi73
|
|
|
|
|
An animated GIF is just lots of gifs, isn't it ? Have you looked on the web for a file format ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hi Christian!
Thanx for reply. You mentioned:
An animated GIF is just lots of gifs, isn't it ?
True! But as an AVI is just lots of BMPs, yet needs alot to be done inorder to put the BMP guys together and make the AVI, Right?
OK, just last night by searching in the google.com, I have found couple of good stuff w/source codes, but not at all windows based (UNIX). So I was gonna see them later and find out what I could use from it.
I'll post the links here later.
"Silence is golden, but my eyes still see."
-- Masoud Samimi
Website: www.geocities.com/samimi73
|
|
|
|
|
In fact that's pretty easy!! You don't need any 3th party library, if you're using VC6.0, you have everything you need.
The solution is to use the IPicture interface. You just have to use ::OleLoadPicturePath to load the GIF file and then IPicture::Render to actually draw the picture.
If you need more information, I could send a sample application to you.
If you need to display animated GIF files, that's different However I can remember that there is an ATL control which does that. You can find it in www.codeguru.com
|
|
|
|
|
I need putting some animated gifs on my dialog.
I have downloaded a class named "CGif98a".Unfortunately it is not a good class .Anyone have used this class?
|
|
|
|
|
|
Hi Again!
OK, Console app proj in VC++6, Compiled fine! Ran the EXE from dos! BUT got an ERROR!?
Here is the copy of my dos prompt stuff:
C:\gif>mygif
whirlgif Rev 3.02 (c) 1997,1998 by Hans Dinsen-Hansen
(c) 1995,1996 by Kevin Kadow
(c) 1991,1992 by Mark Podlipec
Usage: whirlgif [-o outfile] [-loop [count]] [-time #delay]
-disp [ none | back | prev | not ]
[ -i listfile] file1 [ -time #delay] file2 ...
C:\gif>mygif -o test.gif -loop 5 -time 5 -disp prev -i resume_s.gif -time 1 email_s.gif -time 1 orders_s.gif -time 1
whirlgif Rev 3.02 (c) 1997,1998 by Hans Dinsen-Hansen
(c) 1995,1996 by Kevin Kadow
(c) 1991,1992 by Mark Podlipec
Can't open GIF89ad for reading.
C:\gif>
You can see the line: Can't open GIF89ad for reading.
I feel !
"Silence is golden, but my eyes still see."
-- Masoud Samimi
Website: www.geocities.com/samimi73
|
|
|
|
|
WhirlGIF is a program to *create* animated GIF files; it does not
display them at all.
What seems to be searched for is MFC code to *display* animated GIF files.
|
|
|
|
|