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
C

Coremn

@Coremn
About
Posts
51
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Capturing key presses with WinProc
    C Coremn

    I have an app that is controled using keypresses. Currently I use WinProc to capture the key presses and process them. My problem is non US layout keyboards. Example: If I wanted to test for a '?' key press on a US layout keyboard, I get a 'Shift' keypress and a '/' keypress. Most other international layouts do not have the '/' and '?' on the same key so this does not work. Is there anyway to capture a '?' or any other non-alphanumeric keys that require either shirt or alt to be presses. I.e returning the unicode of the key. Can this be done using windows API or should I be looking elsewhere? SDL or something?

    ---

    C / C++ / MFC json help tutorial question

  • CPropertySheet Minimize button
    C Coremn

    Hi, I have an dialog based app that has an initialisation dialog and a main dialog (property sheet). I have to switch between these dialogs and keep the non active one hidden. My problem is how do I put a minimize button on a Property Sheet dialog? Thanks ---

    C / C++ / MFC question help

  • MFC Chart
    C Coremn

    It simply does not exist with my install of MSVC or any of the other work computers with MSVC. I have a lot of other activeX controls that I can include, just not MSChart. Did I miss it on the install? ---

    C / C++ / MFC c++ question

  • MFC Chart
    C Coremn

    Hi all, I need to add a chart control to my dialog. I can find references to MSChart on the web but as far as I can tell I do not have that object on my system. Is MSChart something that is included with VB installation? The only charting objects I can find are Microsoft Office Chart 9 and 11. I need to add data to the chart from user input one point at a time. What can I do? ---

    C / C++ / MFC c++ question

  • CATCH_ALL and OnCtlColor
    C Coremn

    Appart from not knowing how to get infomation from an unknown exception, I have fixed my code problem. COLORREF Clr = GetDC()->GetPixel(Rect.left-1, Rect.top-1); This line does not like being called so often.(why??) So I just set Clr to the background color as it actually does not change after initilising it. Clr = RGB(m_bkR, m_bkG, m_bkB); cheers ---

    C / C++ / MFC question dotnet debugging help

  • CATCH_ALL and OnCtlColor
    C Coremn

    First thing I tried, it seems it does not throw a CException at all. I am sure it is a memory resource overflow problem, even though I am deleting my HBRUSH object. ---

    C / C++ / MFC question dotnet debugging help

  • CATCH_ALL and OnCtlColor
    C Coremn

    Hello I was trying to debug this code (see below), because after a few minutes it crashes. So I used a try{ }catch(...) to catch the exception but I dont know what type of exception it was. Is there a way to tell? I tried using TRY{} CATCH_ALL() but it dod not catch anything?? try{   DeleteObject(hbr); //must be deleted or eventually mem overflow    hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);    if (nCtlColor == CTLCOLOR_STATIC )    {      CWnd *Ctrl = GetDlgItem(pWnd->GetDlgCtrlID());      if (Ctrl)      {        CRect Rect;        Ctrl->GetWindowRect(&Rect);        this->ScreenToClient(&Rect);        COLORREF Clr = GetDC()->GetPixel(Rect.left-1, Rect.top-1);        hbr = CreateSolidBrush(Clr);        ASSERT(pDC);        if(!m_staticTextBgd)                 pDC->SetBkColor(Clr);        pDC->SetTextColor(RGB(m_fntR,m_fntG,m_fntB));        pDC->SetBkMode(m_staticTextBgd?OPAQUE:TRANSPARENT);      }   } } catch(...) { printf("Error"); } I tried catching CResourceException and CMemoryException and many others but it did not catch anything? How do I know what exception is being thrown? ---

    C / C++ / MFC question dotnet debugging help

  • Setting default directory for OnFileOpen
    C Coremn

    Mike Dimmick wrote: You could override CDocManager::DoPromptFileName Yep thats what I have done, and that works fine (as long as CDocManager doesnt change) Thanks ---

    C / C++ / MFC question

  • Setting default directory for OnFileOpen
    C Coremn

    Hi, I have SDI app that load files through CWinApp::OnFileOpen. When the file dialog opens it is in the last opened directory. Normally this is the wrong directory.:( When My program starts and File open is selected I want it to open in my default directory. How can I set this without overriding OnFileOpen and using a CFileDialog :confused: Thanks ---

    C / C++ / MFC question

  • CWnd Object
    C Coremn

    Thanks, that was rather stupid of me :) ---

    C / C++ / MFC question

  • CWnd Object
    C Coremn

    How can you tell if a CWnd object is displayed or not. I can never figure this one out. If you initilise the object but not displayed as a window what function can I call to test it? ---

    C / C++ / MFC question

  • C++ class typecasting
    C Coremn

    Thankyou, that was easy and quick. (quick *slap* to the forehead) (and yes I do actually have a return type) ---

    C / C++ / MFC c++ question announcement learning

  • C++ class typecasting
    C Coremn

    Sorry about a non MFC question, but I thought we should have some good C++ Programmers here. I have a base class and a inherited class. class base { base() Initialise(); }; class derived : public base { derived(); Initialise(); } base *root; Within my view class I want to initialise root as either the base or derived class. I do this with the following code. switch(version) { case 0 : root = new base; break; case 1 : root = new derived; break; } root->Initialise(); This howerver always calls base::Initialise instead of the derived even for case 1. What can I do to call derived::Initialise :confused:? Of course I could create a pointer to derived and typecast chamber_root, but I dont want to do that. Also I could derive another class from base and use that instead of base. ---

    C / C++ / MFC c++ question announcement learning

  • OnFIleOpen Current Directory
    C Coremn

    I have a SDI and I dont override the standard file open ( i.e CWinApp::OnFileOpen() ), I do however use a separate CFileDialog to open a particular type of file. When I use the CFileDialog to open my files I set the initial directory to open from (different from the executable dir). Then when I use File->Open it uses the CWinApp::OnFileOpen and the initial directory is the last directory from my CFileDialog, I expect this. However I used SetCurrentDirectory to reset this directory but it still uses the previous value. It also uses this value when I retart the program and choose file->open. How can I set this to always open in the executable directory for file->open. I dont want to override the OnFileOpen and use a CFileDialog. ---

    C / C++ / MFC question

  • CStatic background color problem
    C Coremn

    Mr.Prakash wrote: return hbr; You retruning the brush with the old screen color rite, then how is the color going to change ? hbr is the background screen color, in my case black. This colors in the excess space in the CStatic where there is no text, I.E making the unused space blend in with the background, I want the space behind the actual text to be colored, this is done by not using pDC->SetBkColor(Clr); in the method OnCtlColor. But I dont know how to change this from light gray. ---

    C / C++ / MFC dotnet help question

  • CStatic background color problem
    C Coremn

    I am writing a program that displays static text on a black background. I can change the CStatic object backgound color to black or I can set the space behind the text to the standard light grey color I.E the space directly behind the text not the entire CStatic area (toggle m_staticTextBgd see below). I want to change this light grey to another color. I tried SetSysColors but I dont want to change this at a system level. Thanks if (nCtlColor == CTLCOLOR_STATIC ) { CWnd *Ctrl = GetDlgItem(pWnd->GetDlgCtrlID()); if (Ctrl) { CRect Rect; Ctrl->GetWindowRect(&Rect); this->ScreenToClient(&Rect); COLORREF Clr = this->GetDC()->GetPixel(Rect.left-1, Rect.top-1); DeleteObject(hbr); hbr = CreateSolidBrush(Clr); if(!m_staticTextBgd) pDC->SetBkColor(Clr); pDC->SetTextColor(RGB(m_fntR,m_fntG,m_fntB)); pDC->SetBkMode(m_staticTextBgd?OPAQUE:TRANSPARENT); } } return hbr; ---

    C / C++ / MFC dotnet help question

  • Memory usage for SetWindowText
    C Coremn

    I have a simple program used for a video overlay where I use a CStatic object to display the time. I was looking at the memory usage for the program and discovered that it was increasing by 4k every 3-4 seconds:(. I found that the following code was the culprit, to be more specific, the SetWindowText line. (The code is called every second) CTime t1 = CTime::GetCurrentTime(); std::string time_str = (LPCTSTR)t1.Format("%H:%M:%S %d/%m/%y"); m_timeStatic.SetWindowText(time_str.c_str()); //memory increase I swapped over to use a CString object instead but the same problem was encountered. m_timeString = time_str.c_str(); UpdateData(FALSE); Please Help me!!!! Can anyone explain this!!!:confused::confused: ---

    C / C++ / MFC help performance

  • Detection of OCX File
    C Coremn

    bryce wrote: why not do a cocreateinstance and catch any errors/exceptions Ok How do I do that???? ---

    C / C++ / MFC help com

  • Detection of OCX File
    C Coremn

    It crashes at TRY { CModelessMain::Create(...) } CATCH_ALL { ... } END_CATCH_ALL Never tried CoCreateInstance - will give it a go ---

    C / C++ / MFC help com

  • Detection of OCX File
    C Coremn

    Hi all, I have a problem. I have written a program that uses a commercial activeX component. I need to distribute this program on other machines and in order to do that I need to also distribute the commercial .ocx file and register it. This is no problem. What I want to do is for my program to send a popup error message if the ocx file is not installed/registered with windows. Currently it just crashes. X| thanks ---

    C / C++ / MFC help com
  • Login

  • Don't have an account? Register

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