Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC6 to 2003/2005: where's native.h? Pin
Judah Gabriel Himango28-Feb-06 18:24
sponsorJudah Gabriel Himango28-Feb-06 18:24 
Questionrecvfrom Pin
derek728-Feb-06 15:46
derek728-Feb-06 15:46 
Questiontake parameters from command line Pin
taoquandecor28-Feb-06 15:39
taoquandecor28-Feb-06 15:39 
AnswerRe: take parameters from command line Pin
Naveen28-Feb-06 16:02
Naveen28-Feb-06 16:02 
AnswerRe: take parameters from command line Pin
Nibu babu thomas28-Feb-06 17:04
Nibu babu thomas28-Feb-06 17:04 
QuestionMust I bind a port for server sock? Pin
derek728-Feb-06 15:21
derek728-Feb-06 15:21 
AnswerRe: Must I bind a port for server sock? Pin
Nibu babu thomas28-Feb-06 17:15
Nibu babu thomas28-Feb-06 17:15 
AnswerRe: Must I bind a port for server sock? Pin
Ryan Binns28-Feb-06 18:11
Ryan Binns28-Feb-06 18:11 
QuestionSir,Can any Help me ,I want to Know For What Generic Reason Will Applications Developed in VC++ Will Crash? Pin
CodeVarma28-Feb-06 14:58
CodeVarma28-Feb-06 14:58 
AnswerRe: Sir,Can any Help me ,I want to Know For What Generic Reason Will Applications Developed in VC++ Will Crash? Pin
mbue28-Feb-06 15:09
mbue28-Feb-06 15:09 
AnswerRe: Sir,Can any Help me ,I want to Know For What Generic Reason Will Applications Developed in VC++ Will Crash? Pin
QuickDeveloper28-Feb-06 17:15
QuickDeveloper28-Feb-06 17:15 
GeneralRe: Sir,Can any Help me ,I want to Know For What Generic Reason Will Applications Developed in VC++ Will Crash? Pin
Stephen Hewitt1-Mar-06 11:36
Stephen Hewitt1-Mar-06 11:36 
QuestionCan code be given exclusive CPU access in XP? Pin
Simon Steel28-Feb-06 14:16
Simon Steel28-Feb-06 14:16 
AnswerRe: Can code be given exclusive CPU access in XP? Pin
mbue28-Feb-06 14:40
mbue28-Feb-06 14:40 
AnswerRe: Can code be given exclusive CPU access in XP? Pin
Ryan Binns28-Feb-06 18:12
Ryan Binns28-Feb-06 18:12 
AnswerRe: Can code be given exclusive CPU access in XP? Pin
BadKarma28-Feb-06 20:29
BadKarma28-Feb-06 20:29 
QuestionDDX_Control and DDX_Text Pin
derek728-Feb-06 13:48
derek728-Feb-06 13:48 
AnswerRe: DDX_Control and DDX_Text Pin
mbue28-Feb-06 14:31
mbue28-Feb-06 14:31 
GeneralRe: DDX_Control and DDX_Text Pin
derek728-Feb-06 15:08
derek728-Feb-06 15:08 
GeneralRe: DDX_Control and DDX_Text Pin
mbue28-Feb-06 15:14
mbue28-Feb-06 15:14 
GeneralRe: DDX_Control and DDX_Text Pin
derek728-Feb-06 15:33
derek728-Feb-06 15:33 
Questionusing bitmap as logo in diaglog-based app Pin
swatgodjr28-Feb-06 13:22
swatgodjr28-Feb-06 13:22 
AnswerRe: using bitmap as logo in diaglog-based app Pin
mbue28-Feb-06 13:45
mbue28-Feb-06 13:45 
GeneralRe: using bitmap as logo in diaglog-based app Pin
swatgodjr28-Feb-06 14:33
swatgodjr28-Feb-06 14:33 
tried using the code and sayign hdc is undeclared and when i make it a hdc variable it says oen fo them was used without being initialized. how i set up my dialog was i made a picture control and from there not quite sure exactly what to do, the code you gave by its self wont just display my image as i am sure more code is needed but i get multiple assertions when i load my app and if i ignore them it loads but no image loaded.

this is my code so far(most commented out though) that would do the image loading, but i get multiple assertions.

afx_msg BOOL CPLoader::OnInitDialog()
{
/*CClientDC dc(this);
m_dcMem.CreateCompatibleDC(&dc);

m_hbmp = (HBITMAP) LoadImage(
AfxGetInstanceHandle(),
"plogo.bmp",
IMAGE_BITMAP,
300,
65,
LR_LOADFROMFILE);
m_st1.SetBitmap(m_hbmp);

if( m_hBmpNew == NULL )
{
AfxMessageBox("Failed to Load Image");
}
else
{
m_st1.GetClientRect( &rectStaticClient );
rectStaticClient.NormalizeRect();
m_size.cx=rectStaticClient.Size().cx;
m_size.cy=rectStaticClient.Size().cy;
m_size.cx = rectStaticClient.Width();
m_size.cy = rectStaticClient.Height();

m_st1.ClientToScreen( &rectStaticClient );
ScreenToClient( &rectStaticClient);

m_pt.x = rectStaticClient.left;
m_pt.y = rectStaticClient.top;
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );
//VERIFY(m_hBmpOld = (HBITMAP)SelectObject(m_dcMem, m_hBmpNew ) );
offsetx= m_pt.x;
offsety=m_pt.y;
InvalidateRect(&rectStaticClient);
}*/
return true;
}

afx_msg void CPLoader::OnPaint()
{
HDC mdc, hdc;
HGDIOBJ obmp;
BITMAP bmi;

if(m_hbmp && GetObject(m_hbmp,sizeof(bmi),&bmi))
{
mdc = CreateCompatibleDC(hdc);
obmp = SelectObject(mdc,m_hbmp);

BitBlt(hdc,offsetx,offsety,bmi.bmWidth,bmi.bmHeight,mdc,0,0,SRCCOPY);

SelectObject(mdc,obmp);
DeleteDC(mdc);
}
/*if(IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1)/2;
int y = (rect.Height() - cyIcon +1)/2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this);
dc.BitBlt(offsetx, offsety, m_size.cx, m_size.cy,
&m_dcMem, sourcex, sourcey, SRCCOPY);
CDialog::OnPaint();
}*/
}

this is based off of an article i read on this site that seemed to do as i wanted but i guess i did not set up right.
GeneralRe: using bitmap as logo in diaglog-based app Pin
mbue28-Feb-06 14:51
mbue28-Feb-06 14:51 

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.