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
A

ashtwin

@ashtwin
About
Posts
75
Topics
31
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem with SetWindowExtEx()
    A ashtwin

    Hi all, the function SetWindowExtEx() is returning false for me sometimes. I am using MM_ANISOTROPIC mapping mode. GetLastError() is returning error code 50(The request is not supported). This is happening very rarely and only during print operation. Can size may be a problem.

    C / C++ / MFC help

  • Problem with ScrollBar(MFC VC6)
    A ashtwin

    Thanks a lot, it worked after doing the changes suggested by you.

    C / C++ / MFC c++ help

  • Problem with ScrollBar(MFC VC6)
    A ashtwin

    Hi, I am using default scrollbar for window. In OnSize i am calling SetScrollInfo() function whenever i am resizing the window. But in some situation the scrollbar is getting hidden, if i reduce or increase the size again scrollbar is becoming visible again. I checked the min and max position values but they are correct.

    C / C++ / MFC c++ help

  • Overflow in LPtoDP function
    A ashtwin

    Hi, You are correct the x value is the root cause of the problem but i can't avoid this value. Is there any way to avoid overflow by doing some changes.

    C / C++ / MFC help

  • Overflow in LPtoDP function
    A ashtwin

    Thanks for replying. Actually this error occured only twice and i am not able to reproduce it. I have the following traces Conversion from LPtoDP failed.

    >::LPtoDP(dc.GetSafeHdc(), points, noPoints);

    noPoints = 2. ViewportExt.cx: 1000 ViewportExt.cy: 616 ViewportOrg.x: 0 ViewportOrg.y: 0 WindowExt.cx: 500 WindowExt.cy: 1000 WindowOrg.x: 68207250 WindowOrg.y: 0 points[0]: x = 68207250 y = 0 points[1]: x = 68207742 y = 1000. But i am not able to find out which parameter value is exceeding.

    C / C++ / MFC help

  • Overflow in LPtoDP function
    A ashtwin

    Hi, while using the function LPtoDP i am getting the error "Arithmetic result exceeded 32 bits". I am not able the find the root cause of the problem. I am using x = 1000 in SetViewportExt and x = 500 * (some dynamic value) in SetWindowExt. Is it Ok if i reduce x = 100 in SetViewportExt and x = 50 * (some dynamic value) in SetWindowExt.

    C / C++ / MFC help

  • Problem with SelectObject()
    A ashtwin

    I understood. Thanks you all for your replies.

    C / C++ / MFC graphics help

  • Problem with SelectObject()
    A ashtwin

    But if we restore the temporary pointer returned from SelectObject in the DC immediately, the DC may be having some dangling references after the current call. Means if we store the current DC for some other call there are chances of using incorrect memory.

    C / C++ / MFC graphics help

  • Problem with SelectObject()
    A ashtwin

    Thanks for the reply. But if i want to use the same DC after this call wiil it be ok.

    C / C++ / MFC graphics help

  • Problem with SelectObject()
    A ashtwin

    Hi, I am using SelectObject() in my code but confused with the MSDN description.

    CFont font;
    font.CreateFont(-12, 0, 0, 0, 400, FALSE, TRUE, FALSE, ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, _T("Courier New"));
    CFont* oldFont = pdc->SelectObject(font);
    pdc->TextOut(0, 0, str);
    pdc->SelectObject(oldFont);
    font.DeleteObject();

    As per MSDN we should not use the object return by SelectObject because it is a temporary one. But if we are restoring the old GDI object in the above way will it cause any problem because the same dc can be used in some other place.

    C / C++ / MFC graphics help

  • Error during print
    A ashtwin

    Actually at one place i am using the follwing code and dcRef is NULL in my case so it is going to the else part.

    mDC = new CMetaFileDC();
    if (mDC != 0)
    {
    HDC myhdl;
    if (dcRef != 0)
    {
    myhdl = dcRef->m_hAttribDC;
    }
    else
    {
    myhdl = getDC();
    dcRef = CDC::FromHandle(myhdl);
    }

    	mDC->CreateEnhanced(dcRef, 0, bounds, description);
    	mDC->SetAttribDC(myhdl);
    
    	// Set default mapmode to MM\_HIMETRIC
    	mDC->SetMapMode(MM\_HIMETRIC);
    }
    

    Is there any problem in passing a pointer acquired from CDC::FromHandle to CreateEnhanced.
    At some other place i am using

    mMetaFileHandle = mDC->CloseEnhanced();
    delete mDC;
    mDC = 0;
    do something .....
    if (mMetaFileHandle != 0)
    {
    // Release metafile handle if existing
    ::DeleteEnhMetaFile(mMetaFileHandle);
    mMetaFileHandle = 0;
    }
    HDC myhdl = getDC();
    CDC dc;
    dc.Attach(myhdl);
    dc.DeleteDC();

    In the above code getDC is returning a handle to the device context.

    C / C++ / MFC help

  • Error during print
    A ashtwin

    Actually in my system it is not crashing. The logs i got from the client machine. I checked on the net and got the clue that it may the problem with installed drivers.

    C / C++ / MFC help

  • Error during print
    A ashtwin

    Hi, While performing the print operation my application is crashing(only some times). In logs i have found the following error: Violation address: 0x7c93426d Exception code: 3221225477 Description: EXCEPTION_ACCESS_VIOLATION: The thread tried to read from or write to a virtual address for which it does not have the appropriate access. Access violation error at READING from 0x0. Can somebody suggest me what may be the possible cause of error.

    C / C++ / MFC help

  • Problem in transform function
    A ashtwin

    Ok, so the problem is with vc6. Thanks for the help.

    ATL / WTL / STL help graphics debugging question

  • Problem in transform function
    A ashtwin

    Does it mean that whatever i was doing earlier was not correct.

    ATL / WTL / STL help graphics debugging question

  • Problem in transform function
    A ashtwin

    The program is getting build properly if i use a function insted of make_pair in the last parameter of the function transform and return a pair from that function.

    pair<PC::PC_type, PC> MyFunction(PC::PC_type pcType, PC pc)
    {
    return make_pair(pcType, pc);
    }
    transform( kind, kind+num_appliances, v.begin(),inserter( stock, stock.end() ),MyFunction);

    ATL / WTL / STL help graphics debugging question

  • Problem in transform function
    A ashtwin

    Sorry, the declaration before main is

    template std::pairPC::PC\_type,PC std::make_pairPC::PC\_type,PC(PC::PC_type,PC);

    ATL / WTL / STL help graphics debugging question

  • Problem in transform function
    A ashtwin

    Hi, i tried the declaration before main

    template std::pair<PC::PC_type,PC> std::make_pair<PC::PC_type,PC>(PC::PC_type,PC);
    int main( ){

    but still getting the same error. May be some problem in project settings.

    ATL / WTL / STL help graphics debugging question

  • Problem in transform function
    A ashtwin

    Hi, Thanks for replying. I am using VS98(VC6.0) :) . The headers file and defination of PC is as follows

    #include <algorithm>

    #include <functional>

    #include <iomanip>

    #include <iostream>

    #include <map>

    #include <string>

    #include <utility>

    #include <vector>

    using namespace std;

    class PC

    {

    public:

            enum PC\_type { Dell, HP, IBM, Compaq };
    
            
    
            PC( PC\_type appliance = Dell, int model = 220,
    
                        int serial = 0 );
    
            
    
            bool operator<( const PC& rhs ) const;
    
            
    
            PC\_type appliance() const;
    
            int model() const;
    
            string name() const;
    
            
    
            void print() const;
    
            
    
            int serial() const;
    

    private:

            PC\_type appliance\_;
    
            int model\_;
    
            int serial\_;
    

    };

    ATL / WTL / STL help graphics debugging question

  • Problem in transform function
    A ashtwin

    Hi, i am using transform function to transform a vector to a map but getting the following error. multiMapType.obj : error LNK2001: unresolved external symbol "struct std::pair<enum PC::PC_type,class PC> __cdecl std::make_pair(enum PC::PC_type const &,class PC const &)" (?make_pair@std@@YA?AU?$pair@W4PC_type@PC@@V2@@1@ABW4PC_type@PC@@ABV4@@Z) Debug/MultiMapType.exe : fatal error LNK1120: 1 unresolved externals The code snippet is as follows

    int main( )
    {
    const PC::PC_type kind[] = { PC::IBM,PC::IBM, PC::Dell, PC::HP,PC::HP, PC::HP };

    const int num\_appliances = 3;
    
    vector<PC> v;
    for( int i = 0; i < num\_appliances; ++i )
    	v.push\_back( PC( kind\[i\], i, i ) );
    
    
    // work with a multimap. key is appliance type, value is PC
    typedef multimap<PC::PC\_type,PC> PC\_multimap\_type;
    
    PC\_multimap\_type stock;
    const PC desired( PC::HP );
    
    // load the appliances into the multimap
    **transform( kind, kind+num\_appliances, v.begin(),inserter( stock, stock.end() ),make\_pair<PC::PC\_type,PC> );**	
        PC\_multimap\_type::const\_iterator stock\_end = stock.end();
    
    // search for first occurrence of key
    PC\_multimap\_type::const\_iterator spot = stock.find( desired.appliance() );
    
    if( spot != stock\_end )
    	spot->second.print();
    else
    	cout << "Don't have a " << desired.name() << " in stock\\n";
    return 0;
    

    }

    Please help. Thanks

    ATL / WTL / STL help graphics debugging question
  • Login

  • Don't have an account? Register

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