|
Hi Experts,
I m trying to load an Image file(jpeg/png/gif/bmp)
of 900x630 into a bitmap on my classview(OnPaint)..
But wen i run i m realisin loss of color in my loaded image..
wats the reason for loss of color during bitmap loading..
Thanks in advance..
Gita
|
|
|
|
|
Without seeing any code it's hard to say what your problem is, but the biggest reason for color loss would be an incorrect HDC. When dealing with bitmaps, I usually get the desktops DC and make a compatible DC from that, this should then enable you to have access to the full color range.
Waldermort
|
|
|
|
|
WalderM ...this should then enable you to have access to the full color range.
Are there other DCs that wouldn't?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My point is, if you simply create a DC then it can only handle monochrome images. If you use a DC given to you by some other means, then you can never be sure of it's configuration.
Waldermort
|
|
|
|
|
Hi Waldermors,
I ve given my followin snippet for ur' clarification..
CDC dcMemory;//Create a compatible memory device context
dcMemory.CreateCompatibleDC(pDC);
CBitmap bmImage;//Load and select bitmap
bmImage.LoadBitmap(IDB_BITMAP4);
CBitmap *pbmOriginal = dcMemory.SelectObject(&bmImage);
dcMemory.SetMapMode( pDC ->GetMapMode());
CRect rcClient;
GetClientRect(rcClient);
pDC ->StretchBlt(rcClient.left,rcClient.top,rcClient.Width(),
rcClient.Height(), &dcMemory,0,0,50,50,SRCCOPY);
pDC ->SelectObject (pbmOriginal);
pDC ->SetBkMode(TRANSPARENT);
wats' the prob r deficiency in my above snippet..
Gita
|
|
|
|
|
Hello,
if i have a vertical scrollbar in my control, can i catch the event when i beginn to scroll?
Thanks in advance!
termal
|
|
|
|
|
WM_VSCROLL or if using MFC OnVScroll()
Waldermort
|
|
|
|
|
Hello,
i try this, but something is wrong in my code!
I write ON_WM_VSCROLL() in message list, and a funktion in my class:
void afx_msg CMyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
void afx_msg CMyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
AfxMessageBox(L"Hello from scroll");
}
But this dont work, execution never call this function!!
Thanks for your answer!
termal
|
|
|
|
|
If you have a scroll bar in your control, then the *control* will get the scoll message, not the dialog. You can subclass the control to do specific handling of the vscroll message.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Do you have any scrollbar on your dialog?
|
|
|
|
|
Hello together,
i have got a MFC application that uses an MS Access database over ODBC. When my application starts it compresses the database by calling SQLConfigDataSource API function. After this call the rights for my mdb file changed. The 'User' group is removed. Only an administrator, the system and myself can use the file from now on.
Other users without admin rights can't use my application anymore.
Has anybody an idea how to stop SQLConfigDataSource from changing the file rights?
Regards
Sascha
|
|
|
|
|
S. Becker wrote: ...it compresses the database by calling SQLConfigDataSource API function.
How are you calling it?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
CString sDriver = _T("Microsoft Access Driver (*.mdb)");
CString sAttributes = _T("COMPACT_DB=") + m_sTargetDB + _T(" ") + m_sTargetDB + _T(" General");
int retcode = ::SQLConfigDataSource(AfxGetMainWnd()->m_hWnd, ODBC_ADD_DSN, sDriver, sAttributes);
Regards
Sascha
|
|
|
|
|
This looks okay. When the compacting is done, can you add the Users group back to the file's ACL?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I never had to implement security functions before and it looked very difficult. This morning i was very happy to find a mail of a colleague that showed me where to find a function in our source base that exactly does that. My problem is solved.
Thanks you for your help.
Regards
Sascha
modified on Tuesday, February 12, 2008 5:12 AM
|
|
|
|
|
Hi all
I have created a file and passing some arguments through console application.Now when i open the file to read or write...no other must able to read or write into it...which is better concept shall i use....
thanks in advance..
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
Does this help?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Pardon?
You have created a program, and want it to only be run once at a time?
This is a little bit hard, but there are plenty of examples on codeproject. Just search for "singleton", or "run once"...
You have created a program, and it opens a file, and that file should not be openable by anybody else?
That;s the default - but don't take my word for it: look at the documentation for CreateFile, and the sharing flags like (eg) SHARE_DENY_WRITE etc.
------
Hi,
I am Iain, and I have not completed my Degree in psychic post-reading.
But I do realise that my sig is not the place for my CV - I have an about-me section on my member profil which anyone can see by clicking on my name.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
sharanu wrote: which is better concept shall i use....
It all depends on how you are opening the file. In general, you want to open the file exclusively, or deny others read|write access.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i am trying to insert text into notepad.
CWnd *myWnd = FindWindow(_T("Notepad"), _T("Untitled - Notepad"));
if(myWnd)
{
::PostMessage(myWnd->GetSafeHwnd(),WM_CHAR,(BYTE)'a',0x000e0001);
} if i enable the second line, notepad is quitting. how to insert a character? it is not working.
|
|
|
|
|
http://dictionary.reference.com/browse/destroy[^]
Destroy:
1. to reduce (an object) to useless fragments, a useless form, or remains, as by rending, burning, or dissolving; injure beyond repair or renewal; demolish; ruin; annihilate.
You're getting the main window for notepad.exe - so it shouldn't come as a great shock that if you send a DESTROY! message, it closes. What did you expect?
Even if you actually had the text area for notepad, why on earth would you think WM_DESTROY would help you put a character there? I hope I'm missing out on something in your question that you didn't write down.
Your idea of sending a WM_CHAR isn't bad - but you're sending it to the main window for the application. If I use Spy++ on notepad, there are two child windows - a big edit one, and a status bar window. You could get the child window, and try sending the WM_CHAR to that. But that is implementation dependent. For all I know, notepad.exe under Vista is built completely differently. Maybe it uses a richedit window, rather than an edit one? Or Notepad under windows 2000 didn't have subwindows, it just worked as you expected.
I would have a look at WM_PASTE message. It's likely the notepad's parent window would pass it on to the child edit window to handle, and that would paste the contents of the clipboard into notepad. It is harder to set up some text on the clipboard - but there are samples on codeproject - and it would allow you to do more than one letter at a time.
I hope that helps,
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Iain Clarke wrote: Iain Clarke appearing in spite of being begged not to by CPallini.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I was wondering when you'd spot that... I'm going to have to change it now!
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
can u please tell me how to get the handle of notepad's edit window/
|
|
|
|
|
What about EnumChildWindows [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|