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
D

Donguy1976

@Donguy1976
About
Posts
29
Topics
21
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Vector as function return
    D Donguy1976

    I am working on a C++ application. In the header file:

    typedef vector<CMyInfo\*> CMyInfoBachelor;
    
    CMyInfoBachelor\* GetBachelorContained (ULONG MyID);
    

    Now in the Cpp file

    CMyInfoBachelor\* CMyCache::GetBachelorContained (ULONG MyID)
    {
    	// Lots of things done here
    
    	for (..........)
    	{
    		CMyInfo\* pS = GetMyInfo(RS.Get\_UL("ulid",i));
    		if (pS)
    		   pMyInfo->m\_pUsedInTheseBachelor->push\_back(pS);
    	}
    	return pMyInfo->m\_pUsedInTheseBachelor;
    }
    

    The loop goes twice and i can see 2 separate values are been added to the Vector. But for some reason it's not getting applied. So if i look at debug window:-

    m_pUsedInTheseBachelor->;***First*** has the correct value

    m_pUsedInTheseBachelor->;***Last*** doesn't have the correct value, it's bunch of junk.

    i.e., the Vector get's populated correctly only on the 1st loop iteration. The 2nd looping doesn't add the correct value to vector. I am new to vector and have no idea how to fix it. Also, how to make sure that it return properly? The code that i tried is as follow: In Header file:

    vector<CMyInfo\*> CMyInfoBachelor\* GetBachelorContained (ULONG MyID);
    

    And in Cpp file:

    vector<CMyInfo\*> CMyInfoBachelor\* CMyCache::GetBachelorContained (ULONG MyID)
        {
        	// Lots of things done here
        
        	for (..........)
        	{
        		CMyInfo\* pS = GetMyInfo(RS.Get\_UL("ulid",i));
        		if (pS)
        		   pMyInfo->m\_pUsedInTheseBachelor->push\_back(pS);
        	}
        	return pMyInfo->m\_pUsedInTheseBachelor;
        }
    

    But i got a bunch of errors. [edit] Tidied up the formatting for you. [/edit]

    C / C++ / MFC c++ graphics debugging help tutorial

  • Database Migration in C++ and Oracle
    D Donguy1976

    I have a very general question on database migration. Am pretty new to database development and have no ideas at all, so please bear with me.

    I am working on a VC++ MFC application using Visual Studio. This has a Oracle backend database.

    There's a table called T_SIGN_IN that has the following columns,

    1. USR_NAME
    2. USR_ID
    3. USR_ACCT_NUMBER
    4. USR_ADDRESS
    5. USR_SSN
    6. USR_LAST_LOG_IN
    7. USR_LAST_LOG_OFF
      ............and so on...

    Now as part of a new feature enhancement, we want to create a new table called T_SIGN_LOG and migrate some of the existing column data from T_SIGN_IN.

    For e.g., we want to move data from USR_ID, USR_LAST_LOG_IN and USR_LAST_LOG_OFF to the new table.

    How can this be achieved?

    I hear that there're 2 ways of achieving this.

    1. Stored Procedures.
    2. C++ function.

    Can someone give me a example of how this can be done via the above 2 approaches? Code snippet will be great!

    And also, which is the best way of doing it?

    ATL / WTL / STL c++ question csharp database oracle

  • Writing a Generic Function
    D Donguy1976

    I have 3 functions that do sorting on a CArray.

    CArrays are declared in header file:

    CArray<int*, int*>m_Integer;
    CArray<string*, string*>m_String;
    CArray<double*, double*>m_Double;

    void sortIntegers()
    {

    // Do sorting for m_Integer here
    }

    void sortStrings()
    {
    // DO sorting for m_String
    }

    void sortDouble()
    {
    // Do sorting for m_Double
    }

    Now what i want to do is, have one generic function and then pass the CArray to that.

    So far what i did is,

    in Header file:

    void sortAll(CArray<void*, void*> m_Array);

    in CPP file:

    void sortAll(CArray<void*, void*> m_Array)
    {
    int size = m_Array.GetSize();

    ............
    ............
    ............
    
    m\_Array.GetAt(0); // Error here
    ................
    ................
    

    }

    The error is that, it needs a class type and not a void type.

    I am not sure how to proceed with writing a generic function to handle all different data types in one.

    Any help is welcome!

    C / C++ / MFC help c++ algorithms tutorial

  • Checkbox: SetFocus() doesn't draw broken rectangle around it
    D Donguy1976

    I am working on a legacy Windows app written in Win32. There's a checkbox in the screen and i call the SetFocus() function to have the focus on it. I know that it works as far as setting the focus, because now i can use space button in keyboard to check and uncheck the checkbox. But the problem is, when a control get's the focus, it's supposed show a broken rectangle around it. In my case this broken rectangle is not drawn/shown all the time. Sometimes it shows the broken rectangle and some times it doesn't. I need to show some visual indication to user that this checkbox has the focus. I tried using WM_CTLCOLORSTATIC, but that creates some painting issues in the window. So am looking for a simpler solution, by which i could show some visual indicator to user that this checkbox is having focus. Like changing the text color or background color or even force draw a broken rectangle. But i have no idea how to do this without using the WM_CTLCOLORSTATIC. Is there a easier way to show some sort of visual indication on a checkbox in Win32? Thanks in advance!

    C / C++ / MFC help tutorial question

  • How to disable copy/paste in CEdit?
    D Donguy1976

    Hi there, Is there a way to disallow users from pasting anything to CEdit box control? Right now they can right click and select the PASTE menu option. And also do a Control + V. How to disable this? please give some sample code. Thanks in advance.

    C / C++ / MFC tutorial question

  • DeleteFile() Function Failure
    D Donguy1976

    Hey there In my VC++ application i see that this function fails in certain times, but was not able to reproduce it. So am trying to debug and have few questions. Does the DeleteFile() fails if multiple files are deleted quickly inside a loop and if some files are larger in size? What other possible causes can lead to DeleteFile() to fail?

    C / C++ / MFC c++ debugging question

  • Does DeleteFile function returns immediatly?
    D Donguy1976

    Hello there, If i call DeleteFile on a file that's pretty large, does the function wait until the entire file is deleted before returning? Or does it return immediately? i.e., the control is passed to OS to complete the task of deletion and then return immediately? For e.g., if i am deleteing 5 files inside a loop and 2 of them happen to be larger size, will it wait until each file is completely deleted before going to the next one? If it doesn't, then there's a probability that when the next file is called by DeleteFile the previous one might still be in the process of deletion and it could fail. Is there a possibility like that?

    C / C++ / MFC question

  • Using array of string values
    D Donguy1976

    Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

    C / C++ / MFC c++ question data-structures help

  • OnShowWindow() doesn't work on CPropertyPage
    D Donguy1976

    This function get's called only when the Propertypage is displayed, like while navigating through the tabs. I want it to be called when i go from ShowWindow(false) to ShowWindow(true) i.e., when the property page is displayed after it was hidden. And this function doesn't get called in that scenario. And you said override this, can you explain how to do that? Will that work for my scenario?

    C / C++ / MFC question

  • OnShowWindow() doesn't work on CPropertyPage
    D Donguy1976

    Hello all, I am using OnShowWindow() in CDialogs to do somethings when a dialog become visible after it was hidden. I want to do the same thing for a property page and then calling the function OnShowWindow() doesn't do anyhing, because this function doesn't get called when the property page becomes visible after it was hidden. I can use OnPaint() and that works fine. But i want to avoid using OnPaint() as that get called for so many reasons. Where as OnShowWindow() is exclusive when a window is displayed after it was initially hidden. So is there a different function i can use in CPropertyPage when it becomes visible? Thanks in advance.

    C / C++ / MFC question

  • Resizing dialog doesn't work if display changes
    D Donguy1976

    When i try to call SetProcessDPIAware from inside the InitInstance fucntion of the app, it says the fucntion - error C2065: 'SetProcessDPIAware' : undeclared identifier Why is it so? Btw, this is a MFC app being developed in Visual Studio 6. Is there a different way to set it DIPaware?

    C / C++ / MFC c++ css visual-studio question

  • Resizing dialog doesn't work if display changes
    D Donguy1976

    Hello all, I have a MFC app being developed on VS 6.0 I added code to dynamically change the size of the dialog when a check box is checked. i.e., it hides some controls and then resizes the dialog to show only less controls. And this works fine in one display setting. And i am running it on Windows 7 and mydisplay is Medium - 125% If i go to display settings and change the type to Smaller - 100% or Larger - 150%, then resizing completely screws up and some controls are not shown at all. I figured that with change in display setting the resizing takes the controls to different positions that it goes out of scope of dialog. Is there a way around? Any way of locking the controls irrespective of change in display settings? Thanks in advance.

    C / C++ / MFC c++ css visual-studio question

  • Changing position of a CButton
    D Donguy1976

    Hello All, I have a MFC app in VS 6.0 in which am trying to move the postion of a button during the run time. I am calling function SetWindowPos and for some reason it's not working. I tried MoveWindow and that too didn't work. The same code runs on a different dialog with a different (ID) button. But for some reason the SetWindowPos & MoveWindow functions are not working in this particular dialog. Is there any reason for that? like, all controls are locked or something.... How to resolve this issue? Thanks in advance.

    C / C++ / MFC c++ visual-studio help tutorial question

  • Handling Cdialog's in a App.
    D Donguy1976

    Hello All, I have a MFC app developed in VS 6.0 User can open multiple dialogs in this app. Is there a way of keeping track of how many dialogs are open at a given time? Also, is there a way of getting the handle to each dialog from a central location? Because the dialogs are opened from different parts of the app, i.e., different files its hard to keep track of all dialogs. Any sample code will help. Thanks in advance.

    C / C++ / MFC c++ visual-studio help question

  • Get all window hadles
    D Donguy1976

    Is it possible to get all dialog handles in a app? Or the number of dialogs that are open at a given time?

    C / C++ / MFC c++ visual-studio tutorial question

  • Get all window hadles
    D Donguy1976

    Hello All, I have a MFC app being developed in VS 6.0 This app has a main dialog and from there user can open multiple dialogs. There's a possibility that at any given point there could be 2 or more dialogs open. Now under a certain condition, i want to make all open dialogs invisible and just show up a LogIn dialog. I think in order for this to done i need to get the handle of all open dialogs and call ShowWindow(FALSE); How to get all dialog/window handle? Thanks in advance.

    C / C++ / MFC c++ visual-studio tutorial question

  • GetLastInputInfo getting system wide idle info
    D Donguy1976

    Hello All, I am using GetLastInputInfo in my MFC app to find the idle time for the app, but in my testing i found that it's giving system wide idle time. The reason i found that out is, i opened my app and let it stay on the background, and opened the outlook and started playing around with it. My app was supposed to be timed out after 1 min, but it didn't. Then i stopped playing with outlook for a minute, and then my app timed out. How to fix this?

    C / C++ / MFC c++ testing beta-testing help tutorial

  • How to use GetLastInputInfo?
    D Donguy1976

    Thanks This thread is done.

    C / C++ / MFC tutorial question

  • How to use GetLastInputInfo?
    D Donguy1976

    Hello all, Can someone post some sample code on using GetLastInputInfo? i.e., how to calculate the idle time of the application in MINUTES? Thanks in advance.

    C / C++ / MFC tutorial question

  • Error for GetLastInputInfo
    D Donguy1976

    Thanks all I got this fixed.

    C / C++ / MFC c++ visual-studio help tutorial 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