15,905,504 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by maladuk (Top 4 by date)
maladuk
14-Dec-14 10:55am
View
OK... I have reused some code that I found elsewhere. I guess it is set that big to simply ensure there is enough memory allocated. But changing it to 1024x768 does not make any difference. The Bitmap still does not show.
m
maladuk
14-Dec-14 10:37am
View
Thank you for answering. Yes, I should have upgraded to newer VS-tools long time ago, but as a project worker there is never enough time for it. And since the programs involved are made up of several thousands lines of code this will not be an option this time. Thank you anyway!
maladuk
maladuk
14-Dec-14 10:30am
View
Thank you for answering! I like this solution since it seems that it makes it possible to keep the original width x height on the main window when moving on to new screen resolutions. However, since I am rather unfamiliar with windows programming I would need some axample code to look at. So, if you have an example code as well, I would surely appreciate it.
maladuk
maladuk
14-Dec-14 10:24am
View
Thank you for answering! Since I use MFC the code is a little different from the code in your test app. And I am too unfamiliar with windows programming to identify what must be changed. Below is the ::OnPaint function where my BitMap is loaded, and my attempt to use your Resample-function. It compiles, but no resampled bitmap is loaded onto the canvas. If you have some suggestions I will be very grateful.
maladuk
void CSaulandDlg::OnPaint()
{
if (IsIconic())
{
....
}
else
{
CPaintDC dc( this ); // Device context for painting
CBitmap bmpBackground, *poldbmp;
/*new*/ CBitmap bmpResampled;
CDC memdc;
// Load the bitmap resource
bmpBackground.LoadBitmap( IDB_BACKGROUND );
// Create a compatible memory DC
memdc.CreateCompatibleDC( &dc );
/*new*/ //Create resampled bitmap
/*new*/ bmpResampled.FromHandle(CreateResampledBitmap(dc, (HBITMAP) bmpBackground.m_hObject, 1024, 768, STOCK_FILTER_BOX));
// Select the bitmap into the DC
//poldbmp = memdc.SelectObject( &bmpBackground );
/*new*/ poldbmp = memdc.SelectObject( &bmpResampled );
// Copy (BitBlt) bitmap from memory DC to screen DC
dc.BitBlt( 0, 0, 4700, 4700, &memdc, 0, 0, SRCCOPY );
memdc.SelectObject( poldbmp );
CDialog::OnPaint();
}
}