Skip to content

C / C++ / MFC

C, Visual C++ and MFC discussions

This category can be followed from the open social web via the handle c-c-mfc@forum.codeproject.com

111.5k Topics 465.7k Posts
  • SAPI ?

    asp-net com question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    3 Posts
    1 Views
    M
    Chris, this is a built-in feature of dialogs and doesn't require any code on your part. Just create a static control and put it next to the edit box, e.g.: P&rice: [edit box here] The &r will show up on the screen as an underlined "r". Make sure the static is right before the edit box in the tab order, and then pressing Alt-R will move the focus to the edit box. If you *really* have to support shortcut keys using Ctrl, not Alt, then you will have to do some code. But using Alt has been standard for years, so go with Alt.
  • How to Subclass PropertySheet buttons ?

    csharp tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    M
    Thank you, I tried to subclass the buttons in the classical way, the application runs without problems, but the buttons does not get painted. I sublcassed with CButtonST found on this site. www.usro.net
  • How to simulate/automate user input?

    tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    T
    Take a look at the SendInput Win32 API function. There also are commercial tools you can buy for automated testing that will do this too.
  • Modeless Dialogs

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • CFileDialog

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Close Application

    help question tutorial
    2
    0 Votes
    2 Posts
    0 Views
    A
    I would send WM_QUIT message to the main window of a running application if I wanted to close it. WM_CLOSE message might be a good choice as well. These are two messages that could be used to kill an application nicely. If application is still running then it is highly probable that some overkill solution like TerminateProcess() function is used. Regards, Andrei Zenkovitch Dundas Software
  • Notification, if dialog gains the focus?

    question
    2
    0 Votes
    2 Posts
    0 Views
    A
    Chris, Try to handle WM_ACTIVATE message. Dialog itself doesn't get focus. Instead when dialog window is deactivated it remembers the child window that had focus last and when it is activated the dialog will set focus to that child window. Regards, Andrei Zenkovitch Dundas Software
  • ATL and MFC simple data types

    c++ help question
    3
    0 Votes
    3 Posts
    0 Views
    A
    Hi, I think the best thing to do is to use Windows Template Library instead of MFC classes. WTL is a set of classes that extend ATL to support more complex user interfaces for either applications or various UI components, while maintaining the big advantage of ATL - small and fast code. It doesn't have all the data types you need but it has CString, CRect, CPoint, CSize and lot's of other useful things. So if the size of the code and performance are important to you - go with WTL. WTL is a part of Platform SDK and you can download it from http://www.microsoft.com/msdownload/platformsdk/setuplauncher.htm. Regards, Alex Gorev, Dundas Software.
  • Re: Simulate IE Post File to Web server

    c++ sysadmin tutorial
    3
    0 Votes
    3 Posts
    0 Views
    A
    Unfortunately I don't have any source code examples and I have no idea where you can get them. Alex.
  • Adding a dll to every Launched App

    6
    0 Votes
    6 Posts
    0 Views
    S
    Hi to all Suspicious People, My simple purpose for that is, that I have to launch a third-party application via automation, and due to some reasons that 3rd party application, crashes. In order to "avoid" that crash dialog box, and make the crash cleaner, I wanted to catch the 2nd try exception, and when caught, to shut-down that problematic application.... That's All.... Hope you can sleep better at night now... Jonathan P.S. Still intereted in answers please... thanks
  • Tab key not working on a property sheet

    question learning
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • SetWindowPos doesn't work?

    question com graphics help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Visual C++ and Delphi/C++ Builder

    c++ question delphi css
    3
    0 Votes
    3 Posts
    0 Views
    U
    Visual C++ is Microsoft. Uh, I think that's about it. :) Really, the fact that it's Microsoft means that they lead the technology, whether they should or not. When they come out with a new feature in the OS, support is rolled into all their application suites at the same time. When they come to market compititors have no choice but to play catchup. Other than that, I would say Delphi and/or C++ Builder are superior ways to program Windows. Both have well written, truly object-oriented class libraries to encapsulate the Windows API (unlike wierd hybrid thing that MFC is). You're right: you can get stuff done a lot faster with a lot less effort. Also, unlike VB, you suffer no gain in size or loss of speed. C++ Builder also happens to be one of the most ANSI compliant C++ compilers on the market. Much more compliant than MSVC++. I think Microsoft's compiler technology may be better though. One thing their compiler does that probably nobody else's does is to let you edit code and recompile while debugging without stopping the debugger! Pretty amazing.
  • Any Mp3 related C++ class?

    c++ question
    3
    0 Votes
    3 Posts
    3 Views
    U
    Check out the XAudio SDK. It does EVERYTHING (including streaming over the internet). It's super cleanly written, easy to use, and efficient. It's free. The only "problem" I could see is that it's big: over 200KB for the .lib. It doesn't really need to be that big, but you could chalk that up to the fact that it has a bunch of internet stuff built in too. I recently checked out about 10 different freeware MP3 decoders. XAudio was by far the best. Cheers, Eric
  • Preventing the movement of caret or focus

    question design help
    2
    0 Votes
    2 Posts
    0 Views
    A
    Hello! Include a handler for WM_KILLFOCUS message in your CWnd derived class that you use for subclassing edit box. in this handler you have to call SetFocus function to gain focus back to the control. Alternatively you can handle EN_KILLFOCUS notification in the edit box' parent window. In the handler for the notification you have to do the same - set focus back to the edit box using SetFocus() function. Regards, Andrei Zenkovitch Dundas Software
  • Band

    tutorial question
    2
    0 Votes
    2 Posts
    1 Views
    A
    Hi! You have to package your component and the best way to do this is to use the CAB files. In the .INF file of the package you will be able to specify which controls the browser should register. All this information is IE related I'm not sure how it will work in Netscape Navigator. See more details in the MSDN article "Packaging ActiveX Controls". Regards, Alex Gorev, Dundas Software.
  • Simulate IE Post File to Web server

    c++ sysadmin tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Metafile output on Win98 problem

    performance help question
    2
    0 Votes
    2 Posts
    0 Views
    G
    Chris, Had the same problem. It's a memory alignment thing. (prints fine on NT but had a problem on 95/98) Sorry to mail a bulk of code like this. Cheers, GBO. --- // Try something like this: // excerpt from my GO++ extension code. // I do not load the MetaFile from file, but from memory // (it is embedded in my DLLs) BOOL CGoSchemeMetaPict::DrawObject(CDC* pDC) //:draw this metafile { if (!CGoObject::IsVisible()) return TRUE; // allow for the MetaFileName() function to be overriden and actually // change the name behind our backs! if (myResID == 0) { TRACE0("CGoMetaFile with no ResourceID\n"); CGoObject::DrawObject(pDC); // call the base class default draw return TRUE; } CGoAppMixIn* theApp = (CGoAppMixIn*) AfxGetApp(); CGoView* pView; if (m_pDocument) pView = m_pDocument->GetCurrentDrawView(); else pView = m_pView; int nScale = 100; if (pView) nScale = pView->GetScale(); // only use the bitmap cache if the scale factor is 1:1 or smaller. If we are // scaling things larger, draw the metafile directly. CRect devRect = GetBoundingRect(); /* if (bPrintPreview) { CDC* pATC = CDC::FromHandle(pDC->m_hAttribDC); pATC->LPtoDP(&devRect); } else { pDC->LPtoDP(&devRect); } */ //GBO: does not work now ?? // for Win32 functions HDC hDCDrawSurf = pDC->GetSafeHdc( ); LPENHMETAHEADER pemh; if (hEnhMetaFile == NULL) { HRSRC HResourceInfo = ::FindResource( HCallingModule, // module handle MAKEINTRESOURCE(myResID), // pointer to resource name (LPCSTR) "WMFRES" // pointer to resource type ); if (HResourceInfo == NULL) { DWORD error = ::GetLastError(); _ASSERT(NULL); AfxMessageBox("HResourceInfo == NULL for MetaFileResource!"); return FALSE; } HGLOBAL HData = LoadResource( HCallingModule, // resource-module handle HResourceInfo // resource handle ); if (HData == NULL) { DWORD error = ::GetLastError(); _ASSERT(NULL); AfxMessageBox("HData == NULL for MetaFileResource!"); return FALSE; } void* pMapFile = HData; pemh = (LPENHMETAHEADER) HData; DWORD uiSize = 0; // CHECK FOR WMF FORMAT // // If it has an ALDUS header skip it // Notice: APMSIZE is used because the HANDLE and RECT of the structure // depends on the environment // if (*((LPDWORD)pemh) == ALDUS_ID) { AL
  • How to use ActiveX without dialog ?

    com help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    K
    Hi just add the ActivX to your project (Project / Add to project / Components / ActiveX. This will create a cpp and a header file and you can just call Create(..). No need for a dialog at all. Kurt