Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
V

VCProgrammer

@VCProgrammer
About
Posts
235
Topics
140
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • how to calculate size for printing?
    V VCProgrammer

    can u please provide me any sample please if possible.

    C / C++ / MFC question help tutorial

  • how to calculate size for printing?
    V VCProgrammer

    Hi all, I want to print image. I have a paper size and the num of image to be print on page. if one image print over the page its working fine but how can I identify the size of new image to print on page if multiple num of image print over the page, like: if 40*40 is image size its print on 40*40 paper finally if only one image print over 1 page, if 2 image print on the page the image size should be 20*20 each print perfectly on page and occupy the whole area of page. and also tell me how to arrange the images in printing like left to right or top to bottom ,to occupy the whole paper area by providing num of images on page. please help me for this, thanks.

    C / C++ / MFC question help tutorial

  • Ho to add auto scroll feature on Dialog box?
    V VCProgrammer

    the dialog is not too big and its display normal and properly for normal screen resolution and DPI.

    C / C++ / MFC question help

  • Ho to add auto scroll feature on Dialog box?
    V VCProgrammer

    Hi all, on higher resolution or large DPI the dialog box of my application is not fully visible. i want to add the auto scroll option for higer resolution in my dialog box,so the dialog is accessible and fully visible. pleae help me how can i do this thanks in advance.

    C / C++ / MFC question help

  • icon on button not displayed in XP.
    V VCProgrammer

    yes sir thanks... i am using now NM_CUSTOMDRAW and its solve my problem...

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    sir i already told so many times os version upper than XP, my code also working fine, the problem is just about XP and lower version...

    C / C++ / MFC help

  • Can i get text color of title bar?
    V VCProgrammer

    oops sorry its my mistake...its done now..

    C / C++ / MFC question

  • Can i get text color of title bar?
    V VCProgrammer

    i m tyring COLOR_CAPTIONTEXT and COLOR_INACTIVECAPTIONTEXT but it return some other color...

    C / C++ / MFC question

  • Can i get text color of title bar?
    V VCProgrammer

    hi all, i am DrawText on My Cdialog, i want to set color according to the Text Color of Title bar caption. so is there any option to get the color of text of Title Bar. i also chk the GetSysColor but no success is in hand.. thanks in advance.

    C / C++ / MFC question

  • icon on button not displayed in XP.
    V VCProgrammer

    sir you tested this on XP?

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    according to the documentationt set icon on button use CButton:SetIcon method,that have i already used...as you know also is not working fine...

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    thanks for your guidance and support ,but please help me what function use to display text and icon on button....

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    i set icon style to FALSE,coz i dont want only icon on button is display i want icon and text both are display on button....

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    in my test application for button icon: i have 2 Icon,load them in resource with id IDI_ICON1,and IDI_ICON2 2 buttons :CButton m_btn; CButton m_btn2; on which i wan to set the icon if i set the icon style true for buth buttons its working fine and display the icon on button in XP. but when i FALSE the ICON style for button and run this application,only text of button is display not the icon on button. now please help,if want something more please tel me what information i provide you to better assist me...

    BOOL CBtnIconDlg::OnInitDialog()
    {

        HICON hIcon = AfxGetApp()->LoadIcon(IDI\_ICON1);
    
    AfxMessageBox(ErrorMsg());//here i get GetLastError =0 (The operation completed successfully.)
    if(hIcon)
    {
    	//ok valid icon found
    }
    else
    {
    	AfxMessageBox(\_T("NULL hIcon"));//this not popup
    }
    	
    m\_btn.SetIcon(hIcon);	
    AfxMessageBox(ErrorMsg());//here i get GetLastError =87 (The parameter is incorrect.)
    
    HICON icon =NULL;
    HINSTANCE	hInstResource	= NULL;	
    hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(IDI\_ICON2), RT\_GROUP\_ICON);
    
    AfxMessageBox(ErrorMsg());//here i get GetLastError =0 (The operation completed successfully.)
    
    if(hInstResource)
    {
    	//ok valid hInstResource found
    }
    else
    {
    	AfxMessageBox(\_T("hInstResource null"));//this not popup
    }
    
    icon = (HICON) LoadImage(hInstResource,
    						MAKEINTRESOURCE(IDI\_ICON2),
    						IMAGE\_ICON,
    						16,
    						16,
    						LR\_DEFAULTCOLOR); 
    
    
    AfxMessageBox(ErrorMsg());//here i get GetLastError =0 (The operation completed successfully.)
    if(icon )
    {
    	//valid icon 
    }
    else
    {
    	AfxMessageBox(\_T("NULL icon "));//this not popup
    }
    	
    m\_btn2.SetIcon(icon);
    
    AfxMessageBox(ErrorMsg());//here i get GetLastError =87 (The parameter is incorrect.)
    
        return TRUE;
    

    }

    CString CBtnIconDlg::ErrorMsg()
    {
    CString ret_msg=_T("");

    LPVOID lpMsgBuf;
    HRESULT hr;
    
    hr = GetLastError();
    
    ret\_msg.Format(\_T("%d :: "),GetLastError());
    
    FormatMessage( 
    	FORMAT\_MESSAGE\_ALLOCATE\_BUFFER | 
    	FORMAT\_MESSAGE\_FROM\_SYSTEM | 
    	FORMAT\_MESSAGE\_IGNORE\_INSERTS,
    	NULL,
    	hr,
    	0, // Default language
    	(LPTSTR) &lpMsgBuf,
    	0,
    	NULL 
    );
    
    ret\_msg+=(LPCTSTR)lpMsgBuf;	
    LocalFree( lpMsgBuf);
    
    return ret\_msg;
    

    }

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    please sir tell me what other information you required to help me.

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    but when i set Button style BS_ICON ,than its also working on XP.it means ids are not invalid,i think so... i really cant get it whats going wrong here, is there any other method to display icon on button with text.

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    i am checking GetLastError for LoadIcon and LoadImage, both are return 6 (The Handle is invalid). i dont understand why this fails only on xp otherwise its working fine. even if i set Button style BS_ICON ,than its also working on XP,but my requirement to display both icon and text on button. please help me how can i resolve this. thanks.

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    i am using this to set icon on button only on xp i found this problem.

    HICON hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
    m_btn2.SetIcon(hIcon);

    HICON icon =NULL;

    HINSTANCE	hInstResource	= NULL;	
    
    hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(IDI\_ICON2), RT\_GROUP\_ICON);
    
    icon = (HICON) LoadImage(hInstResource,
    						MAKEINTRESOURCE(IDI\_ICON2),
    						IMAGE\_ICON,
    						16,
    						16,
    						LR\_DEFAULTCOLOR); 
    
    m\_btn3.SetIcon(icon);
    

    on other os like Vista and Windows 7 the icon on button with button caption display properly, but in case of XP the icon not display only the button caption is visible.

    C / C++ / MFC help

  • icon on button not displayed in XP.
    V VCProgrammer

    Hi all, i am set icon on button and display the caption in front of icon. but in XP the icon not displayed if icon and text both are using,if only icon i want to display its working fine. i dont wahts going wrong here please help me.

    C / C++ / MFC help

  • How to load a png image in PictureControl?
    V VCProgrammer

    LPCTSTR szResourceName =MAKEINTRESOURCE(IDB_PNG1);
    LPCTSTR szResourceType=_T("PNG");
    HMODULE hresModule=AfxGetResourceHandle();

    HRSRC hPicture = FindResource(hresModule,szResourceName,szResourceType);
    HGLOBAL hResData;
    
    // Load the dialog box into global memory.
    if (!hPicture || !(hResData = LoadResource(hresModule,hPicture)))
    {
    	TRACE(\_T("Load (resource): Error loading resource %s\\n"),szResourceName);
    	return ;
    };
    DWORD dwSize = SizeofResource(hresModule,hPicture);	
    
    // hResData is not the real HGLOBAL (we can't lock it)
    // let's make it real
    
    HGLOBAL hGlobal = GlobalAlloc(GMEM\_MOVEABLE | GMEM\_NODISCARD,dwSize);
    if (!hGlobal)
    {
    	TRACE(\_T("Load (resource): Error allocating memory\\n"));
    	FreeResource(hResData);
    	return ;
    };
    
    char \*pDest = reinterpret\_cast (GlobalLock(hGlobal));
    char \*pSrc = reinterpret\_cast (LockResource(hResData));
    if (!pSrc || !pDest)
    {
    	TRACE(\_T("Load (resource): Error locking memory\\n"));
    	GlobalFree(hGlobal);
    	FreeResource(hResData);
    	return  ;
    };
    
    //IStream\* pStream;
    ULONG ulWritten=0;
    ulWritten = 0;
    
    CopyMemory(pDest,pSrc,dwSize);
    
    HRESULT hr = ::CreateStreamOnHGlobal(hGlobal,FALSE,&pStream);
    pStream->Write(pDest, dwSize, &ulWritten);
    
    FreeResource(hResData);
    GlobalUnlock(hGlobal);
    
    Bitmap oBmp(pStream,0);
    
    m\_Image\_ics.Load(pStream);
    HDC memdc;
    CRect rect;
    this->GetClientRect(&rect);     
    //=====
    HBITMAP hBmp;
    oBmp.GetHBITMAP(0, &hBmp);
    ::SendMessage(png\_bnr->GetSafeHwnd(),STM\_SETIMAGE,IMAGE\_BITMAP,(LPARAM)hBmp);
    
    C / C++ / MFC question learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups