|
Cool! Learn something new everyday!
I suppose this is faster (performance wise) than use a derived class from CEdit etc and doing DrawItem ect. And much simpler.
|
|
|
|
|
first of all Thank u for your reply
I am using a MFC application
were i am displaying a Dialogbox
were i have a CEdit control .
Which is suppose to change the colour
when a user enters invalid entry (non-numeric)
I dont wont to touch the base class (CEdit)
or nor want to derive new class from it .
ON_WM_CTLCOLOR
I need some solution i have tried to get the
"Device Context "of the edit box but it could
not print inside rather it printed outside the
Edit box .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
first of all Thank u for your reply
I am using a MFC application
were i am displaying a Dialogbox
were i have a CEdit control .
Which is suppose to change the colour
when a user enters invalid entry (non-numeric)
I dont wont to touch the base class (CEdit)
or nor want to derive new class from it .
ON_WM_CTLCOLOR
I need some solution i have tried to get the
"Device Context "of the edit box but it could
not print inside rather it printed outside the
Edit box .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Use that message and handle it, amin, it is very easy. Do a search on the web you will get an example in msdn. I just spent 5 min doing that and get a test case working.
As to the number thing, you should be able to config the edit ctrl to accept number only. In the code, you may be able to use something like this:
DDV_MinMaxLong(...) <-- check reference how to use it. It's been a while since I last use them.
What u will get is if user inputs an invalid entry, a messagebox will come up telling him so. You do not even need to change the CEdit color to let him know.
|
|
|
|
|
Thank you very much
i have got the code working now
The client requirement was to change the colour of the
dialog box so i had to do that .
just pasted the code for other programers
Example<br />
<br />
<br />
HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)<br />
{<br />
pDC->SetTextColor(RGB(255, 0, 0));<br />
<br />
pDC->SetBkMode(TRANSPARENT);<br />
<br />
hbr = m_brush;<br />
}<br />
<br />
return hbr;<br />
}<br />
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I am using URLDownloadToFile to download a url, but default download manager like DAP intercepting the download. Is there a way to make it downloadable without using default download manager.
|
|
|
|
|
Does anyone know how you can add an effect over a timeline track, with a lower priority over a transition applied on the same track using DirectShow Editing Services?
I have 2 video tracks with a transition between them, the first track contains green colored areas (0, 255, 0) and the second track is applied over the first using a key transition over the green areas. I want to add an effect over the first track (e.g. Grayscale)... now the problem is that the effect applies itself before the transition, thus changing the key transition color, and the second track doesn't appear anymore.
Is there anyway to apply the effect after the transition?
Thank you!
|
|
|
|
|
Do you people ever come across problem that this does not work?
HBITMAP hBmp = ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP2));
I got 0 returned by the above func. Why? I am always in a bit of struggle with bitmap as I have not done much with it. Anyone can shed some light?
My bitmap is created in dev studio.
|
|
|
|
|
You have to pass the handle to the application instance as first parameter function.
|
|
|
|
|
The code is from Msdn website. I just mangaged to get it work:
BOOL CMFCPlayingPenDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
.....<br />
DWORD dwStyle = WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE;<br />
m_staticX.ModifyStyleEx(0, dwStyle);<br />
HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1));<br />
m_staticX.SetBitmap(hBmp);<br />
}
The strange thing is that I did not change much but this time bitmap was loaded. However, the bitmap does not appear on my static ctrl...
|
|
|
|
|
Is that working if you pass the handle of the application instance as first parameter as I suggested in my first post ?
Laffis wrote:
The strange thing is that I did not change much
Laffis wrote:
HBITMAP hBmp = ::LoadBitmap(0, MAKEINTRESOURCE (IDB_BITMAP1));
What did you change EXACTLY at this line of code (post what was shown on the MSDN website).
|
|
|
|
|
I tried to ::AfxGetInstanceHandle() and passed it replace 0 with the instance handle. Bitmap still gets no-shown.
cedric moonen wrote:
What did you change EXACTLY at this line of code (post what was shown on the MSDN website).
I played about the static ctrl the bitmap is supposed to attach to. I may have modified style, and later create a derived class off CStatic, that's about it. The CStaticX class does nothing special inside apart from the code generated by Wizzard.
|
|
|
|
|
Hello guys,
Hope you can help me ....
I wrote a Dialog MFc Application, I use a TreeControl for displaying hiearachical item.
I want to use a contextmenu for each item (Actually I put the menu on the dialog OnInitMenuPopup() event) but the menu is not display !!!
Only a little band on the writeis display ? What can i do for getting a working context menu ??
Thanks in advance
|
|
|
|
|
There is an event for the TreeCtrl.
NM_RCLICK
You need to handle this notification message.
To show the context menu on it:
CMenu m;<br />
CMenu* p;<br />
m.LoadMenu(IDR_MENU1);
p = m.GetSubMenu(0);<br />
CPoint pt;<br />
GetCursorPos(&pt);<br />
p->TrackPopupMenu(0,pt.x,pt.y,this,NULL);
this is this.
|
|
|
|
|
|
Hello,
I would like my MDI application to start without any doc/view window. How do I do that? I've tried to override OnCreateClient in ChildFrm but that only generates a message box that says "Failed to create empty document".
Thanks...
|
|
|
|
|
Change your CWinApp::InitInstance function.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
Insert line in bold in code before ProcessShellCommand
|
|
|
|
|
If you mean that you dont want
any intial window that appears
in a MFC project generated by wizard.
then add this code to your applicaton.cpp file in InitInsatance function.
CXyzApp::InitInstance()
{
// CG: The following block was added by the Splash Screen component.
\
{
....
....
.....
....
...
....
....
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_APPMENU))
return FALSE;
//->---------------no empty document window on startup------------------------
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
//->--------------------------------------------------------------------------
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
.....
.....
....
}
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Thank you,
everything works perfect now.
/Toomas
|
|
|
|
|
Hello, lets take a look at the STL.
We have
<br />
std::multimap<sth*, sth*> pairs;<br />
<br />
void remove(sth* s1, sth* s2)<br />
{<br />
std::multimap<sth*, sth*>::iterator i;<br />
if ((i = std::find(pairs.lower_bound(s1), pairs.upper_bound(s1), std::make_pair(s1, s2))) != pairs.end())<br />
pairs.erase(i);<br />
}<br />
Well that doesn't work. I get MANY template compile errors (really hard to read, and rearly make any sense). I'll give you a small sample:
<br />
f:\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(31): error C2784: 'bool std::operator ==(const std::vector<_Ty,_Alloc> &,const std::vector<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'std::allocator<_Ty>::value_type'<br />
with<br />
[<br />
_Ty=std::pair<sth *const ,sth *><br />
]<br />
<br />
f:\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(31): error C2784: 'bool std::operator ==(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'std::allocator<_Ty>::value_type'<br />
with<br />
[<br />
_Ty=std::pair<sth *const ,sth *><br />
]<br />
<br />
f:\Microsoft Visual Studio .NET 2003\Vc7\include\algorithm(31): error C2784: 'bool std::operator ==(const std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'std::allocator<_Ty>::value_type'<br />
with<br />
[<br />
_Ty=std::pair<sth *const ,sth *><br />
]<br />
I think you get the idea. All the compile errors point inside std::find() where the arrow points:
<br />
template<class _InIt,<br />
class _Ty> inline<br />
_InIt find(_InIt _First, _InIt _Last, const _Ty& _Val)<br />
{
for (; _First != _Last; ++_First)<br />
----> if (*_First == _Val)<br />
break;<br />
return (_First);<br />
}<br />
I just can't understand where the problem is. Everythink looks fine to me, but obviously it isn't.
Anyother idea how am I supposed to erase a single pair from a std::multimap()? I can only find functions that erase all <key_value, mapped_value=""> pairs for a specified key but I just need to erase one of those pairs given a specified mapped_value.
That all,
Themis
PS - std::remove() also doesn't work as it relies on std::find() (at least in VS .NET 2003 implementation)
-- modified at 6:08 Friday 23rd September, 2005
PS2 - I don't know if you are already aware of that but the code tags of the forum are not rendered properly with the Firefox Browser.
|
|
|
|
|
Themis wrote:
PS2 - I don't know if you are already aware of that but the code tags of the forum are not rendered properly with the Firefox Browser.
I haven't noticed anything wrong with the code tags. Are you sure your HTML is correct?
|
|
|
|
|
Yes I just read my message in firefox (browser I use) and then reloaded it in IE (just because of curiosity) and saw that in IE code blocks are printed red and the rest black. However in firefox everything is printed in black until a code block begins, then everything below that point prints in red, even after the code block end. Anyway that just a note.
Themis
|
|
|
|
|
Hi all
I am using IImnAccountManager interface for outlook express email accounts.
This interface requires imnact.h header file I downloaded this file from link
http://ftp.teklynx.fr/online//31-%20IDEAM/PPCSDK2000/Program%20Files/INCLUDE/IMNACT.h
I am writing this code
<br />
IImnAccountManager m_pImnAccountManager;
<br />
m_pImnAccountManager = NULL;<br />
<br />
HRESULT hr = CoInitialize(0);<br />
if(FAILED(hr)) <br />
{<br />
MessageBox(_T("Error CoInitialize."));<br />
<br />
}<br />
<br />
hr = CoCreateInstance(CLSID_ImnAccountManager, <br />
NULL,<br />
CLSCTX_SERVER, <br />
IID_IImnAccountManager,<br />
(LPVOID*) &m_pImnAccountManager);<br />
<br />
if(FAILED(hr)) <br />
{<br />
MessageBox(_T("Error creating OE Accounts."));<br />
<br />
}<br />
<br />
hr = m_pImnAccountManager->Init(pAdviseMigrateServer);<br />
if(FAILED(hr)) <br />
{<br />
MessageBox(_T("Error initializing OE Accounts."));<br />
m_pImnAccountManager->Release();<br />
<br />
}<br />
<br />
m_MailList.ResetContent();<br />
<br />
<br />
return TRUE;
}<br />
<br />
when I use this code then it gives errors
/*-------------------------------------------
Linking...
OutlookAccountDlg.obj : error LNK2001: unresolved external symbol _CLSID_ImnAccountManager
OutlookAccountDlg.obj : error LNK2001: unresolved external symbol _IID_IImnAccountManager
Debug/OutlookAccount.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
OutlookAccount.exe - 3 error(s), 0 warning(s)
/*-------------------------------------------------
Though I have included imnact.h file.
Please suggest me.
Thanks
|
|
|
|
|
rajeevktripathi wrote:
http://ftp.teklynx.fr/online//31-%20IDEAM/PPCSDK2000/Program%20Files/INCLUDE/IMNACT.h
you forget to download corressponding _i.c and _p_c
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
You use the tlb or idl files to extract the objects information..
You can do this by using #import<..>
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|