Click here to Skip to main content
15,912,756 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralConsole window in Windows Pin
Iceberg769-May-04 15:14
Iceberg769-May-04 15:14 
GeneralRe: Console window in Windows Pin
Member 10582029-May-04 17:59
Member 10582029-May-04 17:59 
GeneralRe: Console window in Windows Pin
Iceberg769-May-04 18:13
Iceberg769-May-04 18:13 
GeneralRe: Console window in Windows Pin
_foo9-May-04 18:26
_foo9-May-04 18:26 
GeneralRe: Console window in Windows Pin
Member 10582029-May-04 18:57
Member 10582029-May-04 18:57 
GeneralRe: Console window in Windows Pin
FirstPerson9-May-04 20:46
FirstPerson9-May-04 20:46 
GeneralRe: Console window in Windows Pin
Anthony_Yio10-May-04 1:09
Anthony_Yio10-May-04 1:09 
GeneralMain Window Icon loading Pin
robert_s9-May-04 13:18
robert_s9-May-04 13:18 
Hi.
Usual question. How can I load an Icon into my main MFC window. I already searched on this web site for answers but obviously they won't work for me. I tried several differnt ways:

I then tried this :

BOOL CMyAppView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;

m_hIconFrame = AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDR_MAINFRAME));

cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), reinterpret_cast<hbrush>(COLOR_WINDOW+1), m_hIconFrame );


return TRUE;
}

Then I tried :

in MyApp::InitInstance()
{

AfxGetApp()->LoadIcon(MAKEINTRESOURCE(IDR_MAINFRAME)); <--- this wont work
CWinApp::LoadIcon(IDR_MAINFRAME ); <------------------------- this wont work too

m_pMainWnd = pFrame;
// create and load the frame with its resources
pFrame->LoadFrame(IDR_MAINFRAME,WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);

}

Then I tried in int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct). Still no luck..
However same function call ie. AfxGetApp()->LoadIcon(IDR_MAINFRAME); in my dialog class displays the bloody icon ok.
what is going on? Why can't I see this icon in my main window caption bar? ARGH....
Can somebody help please. thank you.
GeneralRe: Main Window Icon loading Pin
Iceberg769-May-04 15:22
Iceberg769-May-04 15:22 
GeneralRe: Main Window Icon loading Pin
_foo9-May-04 18:36
_foo9-May-04 18:36 
GeneralRe: Main Window Icon loading Pin
robert_s10-May-04 4:51
robert_s10-May-04 4:51 
Generalstd::sort( Ran first, Ran last, Cmp cmp) Pin
Laing,James9-May-04 11:17
Laing,James9-May-04 11:17 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Milton Karimbekallil9-May-04 19:31
Milton Karimbekallil9-May-04 19:31 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Maxwell Chen9-May-04 20:20
Maxwell Chen9-May-04 20:20 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Laing,James9-May-04 21:51
Laing,James9-May-04 21:51 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Milton Karimbekallil10-May-04 18:11
Milton Karimbekallil10-May-04 18:11 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Mike Dimmick10-May-04 1:43
Mike Dimmick10-May-04 1:43 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Paul Ranson10-May-04 4:14
Paul Ranson10-May-04 4:14 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Laing,James10-May-04 9:42
Laing,James10-May-04 9:42 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Laing,James10-May-04 9:58
Laing,James10-May-04 9:58 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Paul Ranson10-May-04 10:39
Paul Ranson10-May-04 10:39 
GeneralRe: std::sort( Ran first, Ran last, Cmp cmp) Pin
Laing,James11-May-04 9:35
Laing,James11-May-04 9:35 
GeneralDialogs Pin
Member 6226669-May-04 10:51
Member 6226669-May-04 10:51 
GeneralRe: Dialogs Pin
Christian Graus9-May-04 13:03
protectorChristian Graus9-May-04 13:03 
Generalsnapping windows Pin
Roman Nurik9-May-04 9:19
Roman Nurik9-May-04 9:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.