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
F

Fredrik

@Fredrik
About
Posts
16
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • #How to get the file path of my finished program in the code?#
    F Fredrik

    NT

    C / C++ / MFC database help tutorial question

  • #How to get the file path of my finished program in the code?#
    F Fredrik

    Hi! When I have built my program and executes the exec file my program looks for a database file I have connected to my program. The problem here is that the path to the file is hard coded so it looks for it in a certain location on the HD. What I want to do is charnge where it looks for the database. But I don't know how to get a string of the executive file. Is there any function that can get the execution path of this file? I have found in the database file where it returns this path. I want to change it so that it gets the location where the .exe file is run. Thank you for reading, (or even more importantly responding! :)

    C / C++ / MFC database help tutorial question

  • Strings from a text file or database?
    F Fredrik

    Hi! I want to get string variables from a text file(.txt) how is this done? I want to be able to choose specific strings in the file when I know how the text file was formated. If there's a better way using data bases and that isn't too complicated, that could work too :) Thanks /Fredrik

    C / C++ / MFC database question

  • Help with colors in MFC, damn I'm bad at painting :)
    F Fredrik

    Thanks, that helped with the colors in the ComboBox, but my real problem is the color of the little thin line around the ComboBox and the little arrow for klicking on the combobox to bring down the choices in it. Does anyone know how to override the dialog from getting these colors from the system and how to set them? I have tried a lot of things but none seems to work. Also, how to paint the frame of the dialog window and how to override the menu colors, not just the fields in the menu, but I want contol over the whole menu and what color it has. I really need help with this, this problem is really killing me! :)

    C / C++ / MFC c++ help question

  • Help with colors in MFC, damn I'm bad at painting :)
    F Fredrik

    Hello! I have been trying to set the color of a slider I created with MFC. I managed to color it's background but didn't manage to change the slider "knob" or "path" color, how is this done? I also have a Combobox wich I would like to change the color of as well, but it didn't work out either. I tried to check the "owner drawn and with strings on the Combobox, but I still couldn't change the colors and over the text was the picture of my icon, hmm... Then there's the frame of the window, I beieve I should override OnNcPaint() function for this but either I'm wrong or doig it wrong. =) And changing the color of the entire application menu would be very nice if I could do this too. I tried to override OnPaint, but it didn't work... I could use some samples of code, since I seem to be doing something wrong when I don't get it to work. =) I heard something about "changeing the thumb and track colors using custom draw." how is this done in code? Thanks, /Fredrik

    C / C++ / MFC c++ help question

  • OnPaint overriding?
    F Fredrik

    Ah, I have tried to do custom draw but I don't get it to work, how do I make menu and the other things(mentioned earlier) with custom draw, I could use some samples of code, since I seem to be doing something wrong when I don't get it to work. =) Thanks, /Fredrik

    C / C++ / MFC c++ question

  • OnPaint overriding?
    F Fredrik

    Hi! How would the code for overriding the OnPaint() function look like? I have been trying to set the color of a slider I created with MFC. I managed to color it's background but didn't manage to change the slider "knob" or "path" color, how is this done? I also have a Combobox wich I would like to change the color of as well, but it didn't work out either. Then there's the frame of the window, I beieve I should override OnNcPaint() function for this but either I'm wrong or doig it wrong. =) And changing the color of the entire application menu would be very nice if I could do this too. Thanks in advance! /Fredrik

    C / C++ / MFC c++ question

  • Redirecting the registy.
    F Fredrik

    Ah, would have been real neat though =) Ok, could you help me with intercepting the WM_CTLCOLOR messages. I've tried this but I only managed to do it with te buttons, and used SetDialogBgColor() to chandge the dialogs "view" color, but a few things remain. The color of my slider, ComboBox, the menu, the boarder (or is it called frame) of the dialog window. Thx, most thankfull for help. =) /Fredrik

    C / C++ / MFC c++ windows-admin tutorial question

  • Colors in my dialog...
    F Fredrik

    Hi! I have a problem with colors in my C++ MFC application. The dialog window looks for what colors windows have in the registry and uses these colors to color the dialog. Thats the system colors that are located in the registry under the key: "MyComputer\HKEY_CURRENT_USER\Control Panel\Colors". These are the so called system colors, the colors the system sets for your dialog (if you don't draw it yourself). What I want to do is, I'd like my dialog window to look for it's own colors in the same kind of way, but at another location, wich I would have define. Maybe,"MyComputer\HKEY_CURRENT_USER\Software\MyProgram\Colors" where I can set the dialog window colors myself. To do this, I have to change where in the registry my dialog window looks for it's colors. Adding the necissary keys and colors is no biggie, but how do I redirect where\how the program looks for these colors? If you don't know how to do this, could you help me with how the overriding of the OnPaint function should look like for any of the following things: A slider, ComboBox, the menu, the dialog window and boarder. Thx, most thankfull for help. =) /Fredrik

    C / C++ / MFC c++ help question windows-admin tutorial

  • Some Color issues...redirecting the registry? =)
    F Fredrik

    Hi! I know how to do what you just described, but what I need to know is how to override the system colors for my dialog window only. I have no clue how to make my application to actually look for the colors elsewhere than at the place where windows has it's system colors. I know how to create the keys and set upp the palette values I need in my dialog, but when I have made my own palette in the registry, I have no clue how to make the dialog to actually be pointed to my own defined palette in the registry rather than the one it is pointing at by default (the system colors). Thanks a bunch, /Fredrik

    C / C++ / MFC c++ question windows-admin json help

  • Redirecting the registy.
    F Fredrik

    The dialog window looks for what colors windows have in the registry and uses these colors to color the dialog. Thats the system colors that are located in the registry under the key: "MyComputer\HKEY_CURRENT_USER\Control Panel\Colors". These are the so called system colors, the colors the system sets for your dialog (if you don't draw it yourself). What I want to do is, I'd like my dialog window to look for it's own colors in the same kind of way, but at another location, wich I would have define. Maybe, "MyComputer\HKEY_CURRENT_USER\Software\MyProgram\Colors" where I can set the dialog window colors myself. To do this, I have to change where in the registry my dialog window looks for it's colors. Adding the necissary keys and colors is no biggie, but how do I redirect where\how the program looks for these colors?

    C / C++ / MFC c++ windows-admin tutorial question

  • Redirecting the registy.
    F Fredrik

    Howdy! I was hoping that someone could tell me how to make my application get it's "fake" system colors (wich I define) on another place in the registry. I want to be able to redirect where my application(and mine only) gets its colors on another location in the registry. How would this be done in visual c++? And what would the code be like? Thankfull for any answers, /Fredrik

    C / C++ / MFC c++ windows-admin tutorial question

  • Some Color issues...redirecting the registry? =)
    F Fredrik

    Hi again! Thanks for the info John, and the site you gave me was good. I do need to change the colors though, even though it's sort of against my will, hehe. How do I direct the registry so that I can make my application get its own colors (true that they wouldn't be "system" colors no more, like you said, good point). I want the colors of the other applications running to still use the real system colors, and only my application to use the "fake" or call them "virtual" system colors. =) I would guess that this way would be the best since it would give me a better view of the colors than to override OnPaint code for all the controls. Thanks again, /Fredrik

    C / C++ / MFC c++ question windows-admin json help

  • Some Color issues...redirecting the registry? =)
    F Fredrik

    Howdy Folks! Is there a way to redirect my dialog to get its own system colors somewhere else in the registry? I know how to write the colors into the registry, but I want to know if there is a way to make my application only to look for the registry colors elsewhere. I would also like to know how to change the color of the Menu in my MFC application, I have tried to add code to my OnDrawItem when its called by the Menu, but I don't know if I use the right commands (I'm no ACE at C++ so far, hehe, learning fast though) Another "thingie", hmm... I have set my dialogs background with the SetDialogBkColor() but it seems like the (what do you call it, hmm... border, frame, nm) the outer edge of the window is still taking the colors from the system. How do I paint that area? Then there's the problem with my controls. I have a Slider that still takes the system color in it's "slider-path" and on the "slider-knob" (or whatever you call these, hehe). Where can I set those colors? Then theres my ComboBox wich has that little arrow, (you know, the one you klick on to bring down the ComboBox's menu) I want to set its color too =) If you happen to know how I can "redirect-the-registry-thingie" there's no hurry for the rest of the answers, but I'd like to know the other ways to do it too =) Thats all Folks, thanks for redin'! /Fredrik

    C / C++ / MFC c++ question windows-admin json help

  • Button color
    F Fredrik

    I am far from good at C++ but this is what I did after looking around on diffrnt sites, hope it helps/works =) First: I used MFC to make the button in my dialog, then I chose Properties with left mouse button on the button and set the button to ownerdrawn. Then use Classwizard to add the WM_DrawItem (Is it called a listener? Nm...hehe) to your dialog window. Then add the following code, with a few changes: void CAboutDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpdis) // (Change the name CAbotDlg to your Dialogs name (Classwizar should do this for you though)) { CBrush myBrush; CBrush m_brHollow; myBrush.CreateSolidBrush(RGB(178,196,213)); //Change the RGB color to what you want the color of the the button to be m_brHollow.CreateStockObject(NULL_BRUSH); const UINT& nAction = lpdis->itemAction; // Full redraw or selected (up/down) state changed CWnd* pCtl = CWnd::FromHandle(lpdis->hwndItem); CString sText; pCtl->GetWindowText(sText); // button text CRect rc; pCtl->GetWindowRect(&rc); // window rectangle.. pCtl->ScreenToClient(&rc); // ..client rectangle if (lpdis->itemState & ODS_SELECTED) // button is down: rc += CPoint(1,1); // shift southeast CDC* pDC = CDC::FromHandle(lpdis->hDC); // painting the background CBrush* pOldBrush = pDC->SelectObject(&myBrush); pDC->PatBlt(0, 0, rc.Width(), rc.Height(), PATCOPY); pOldBrush = pDC->SelectObject(pOldBrush); if (lpdis->CtlType==ODT_BUTTON) { // Draw button border using COLOR_BTNTEXT CBrush* pOldBrush = pDC->SelectObject(&m_brHollow); CPen pen(PS_SOLID, 2, GetSysColor(COLOR_BTNTEXT)); CPen* pOldPen = pDC->SelectObject(&pen); pDC->Rectangle(&rc); // Draw rectangle // Draw button text pDC->SetTextColor(GetSysColor(COLOR_BTNTEXT)); pDC->DrawText(sText,&rc,DT_CENTER|DT_VCENTER|DT_SINGLELINE); pDC->SelectObject(pOldBrush); pDC->SelectObject(pOldPen); } else { // Note: assumes static icon! pDC->DrawIcon(0, 0, AfxGetApp()->LoadIcon(IDR_MAINFRAME)); //I'll be honest to tell you I don't fully know what this line does =) } } Hope that helps, I'll be checking in here later for questions/remarks etc... /Fredrik

    C / C++ / MFC question

  • Colors in visual c++ MFC
    F Fredrik

    I have a problem setting the colors of my MFC application. I have set the background of my dialog window with SetDialogBgcolor(); but the border is still using the system colors. How do i set the color of the border? Another problem I have is that the little arrow on my ComboBox is also set by the system colors, and I can't find a way to change it. I have a slider in my application, wich background changed with SetDialogBgcolor(); but I also want to change the color of the thing you slide and the area witch it slides on, but I have no clue how and where to change these. I also need to know how I change the color om my menu. Thankful for any help =) /Fredrik

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