Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PropertySheet Icon

Posted on 1998-09-10
8
Medium Priority
?
235 Views
Last Modified: 2013-11-20
How could i add an icon to the title bar for a propertysheet?. I am developing under Visual C++ 1.52.
0
Comment
Question by:MohammedFahmi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:MohammedFahmi
ID: 1322020
Edited text of question
0
 
LVL 1

Expert Comment

by:motigust
ID: 1322021
Do you mean the Titlebar of the dialog that contains the PropertySheet, or the headers of the tabs?
0
 
LVL 1

Expert Comment

by:motigust
ID: 1322022
Do you mean the Titlebar of the dialog that contains the PropertySheet, or the headers of the tabs?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:agreen
ID: 1322023
0
 

Author Comment

by:MohammedFahmi
ID: 1322024
I am sorry, may be you misunderstod me, i need to add an icon for the whole propertysheet but not for the TABs. Notice the image in the URL that you sent "http://www.codeguru.com/propertysheet/tab_image.shtml", the titlebar "Property Sheet" missing the icon.
0
 

Expert Comment

by:ankor
ID: 1322025
Let assume that each Property Page has an Icon member: HICON m_hIcon.
In constructor or OnInitDialog you can load an Icon Bitmap from resources: m_hIcon = AfxGetApp()->LoadIcon( IDI_ICONID ).
Than in Property Page function OnSetActive() you can have something like: AfxGetApp()->GetMainWnd()->SetIcon( m_hIcon, FALSE );
You can also set "big" app icon passing TRUE as second parameter.
In my example an icon would change depending of selected Property Page.
It works just fine!
0
 

Author Comment

by:MohammedFahmi
ID: 1322026
I am very sory, i need it under MS VC++ 1.52, this mean under 16 bit Developing.
0
 
LVL 12

Accepted Solution

by:
migel earned 400 total points
ID: 1322027
Do you want run your app only under Win95 and above?
If it`s true you can make this steps:

1. Derive your own class from CPropertySheet
2. Owerride OnCreate function.

int CMyProperty::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
        return -1;
    m_hIcon = ::LoadIcon(AfxGetInstanceHandle(), "ico name");
    ::SetClassLong(m_hWnd, GCW_HICON, (WORD)m_hIcon);
    return 0;
}

4. Owerride OnDestroy

void CMyProperty::OnDestroy()
{
      CPropertySheet::OnDestroy();
    ::SetClassLong(m_hWnd, GCW_HICON, NULL);
    // free resource
    ::DestroyIcon(m_hIcon);
}
5. It`s all

Under Win16 it`s more complex (due to Win16 do not draw icon at window caption automatically):
you must owerride OnNCPaint message and draw this icon manualy.
code may look like this:
afx_msg void CMyProperty::OnNcPaint( )
{
CPropertySheet::OnNCPaint();
HDC hdc = ::GetWindowDC(m_hWnd); // dc of the entire window
int nBorderWidth = ::GetSysMetrics(SM_CYBORDER);
int nxOffset = ::GetSysMetrics(SM_CYCAPTION);
// You can set clipping region here
::DrawIcon(hdc, nxOffset, nBorderWidth, m_hIcon);
::ReleaseDC(m_hWnd, hdc);
}

0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question