Thread: GetPrivateProfileString problem.

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    42

    GetPrivateProfileString problem.

    My program loads some things from a ini file using GetPrivateProfileString. One of the things it loads is the name of the current Color Scheme file (.ocl).
    Once it loads this name to a string, my program should use GetPrivateProfileString to load everything from this ColorScheme file.

    Code:
    int Ini_Read() {
    ...
    ...
      GetPrivateProfileString("ColorScheme", "current", "default.ocl", CurColorScheme, 60,  ".\\obs.ini");
    ...
    return 0;
    }
    
    int LoadColorScheme() {
    ...
    ...
      GetPrivateProfileString("mainwindow", "mwbgcolor", "0,0,0", (LPTSTR)mwbgcolorref, 12,  (LPCTSTR)CurColorScheme);
    ...
    return 0;
    }
    Ini_Read is working perfectly and loading all key values to the respective vars, I could see that through debugging.
    The problem is in this line of LoadColorScheme. GCC is telling me
    C:\project12\setcolors.c
    [Warning] passing arg 4 of `GetPrivateProfileStringA' makes pointer from integer without a cast
    [Warning] passing arg 6 of `GetPrivateProfileStringA' makes pointer from integer without a cast


    CurColorScheme is a global at main.h.
    char CurColorScheme[61];

    mwbgcolorref is a global COLORREF at main.h.
    COLORREF mwbgcolorref;

    Ini_Read is throwing ".\\SomeScheme.ocl" to CurColorScheme which is correct. It´s a totally acceptable path+filename for LoadColorScheme´s GetPrivateProfileString line...
    Does anyone knows how I can solve that problems?
    Thanks

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    42
    Ehr...The problem on loading the Color Scheme file is solved lol, i was beeing stupid.

    The real problem is on getting the values from the ColorScheme.ini to COLORREFs... GetPrivateProfileString is loading the values to strings like "RGB(100,100,100)". The question is how do I send that to a COLORREF now?

    Life would be really easy if I could just crTest=crString Or use sprintf or anything I know how to use lol

    Seriously, i got a string like
    crString="RGB(100,100,100)"

    and a COLORREF like
    COLORREF crTest;

    and I need to put the String value inside the COLORREF like
    crTest=RGB(100,100,100);

  3. #3
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    Originally posted by Templario
    Seriously, i got a string like
    crString="RGB(100,100,100)"

    and a COLORREF like
    COLORREF crTest;

    and I need to put the String value inside the COLORREF like
    crTest=RGB(100,100,100);
    Code:
    int r, g, b;
    
    sscanf(crString, "RGB(%d,%d,%d)", &r, &g, &b);
    
    crTest = RGB(r, g, b);
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM