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
  • How to send data with method POST in cgi ???

    c++ com help tutorial question
    5
    0 Votes
    5 Posts
    15 Views
    R
    The POST messages are sent by the Web Server as part of the applications environment variables. So you would use routines like getenv to retrieve these variables. Rajiv
  • Register Class in a Dialog Based Application

    question help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • I need table convert color string to RGB in HTML

    html
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • RegisterWindowsMessage

    com debugging help question
    3
    0 Votes
    3 Posts
    0 Views
    M
    The problem is this line: SendMessage(gnStartMsg, 0, 0); This sends the message right back to the CDialog that this code is in. You want to do: ::SendMessage ( hwndOtherDlg, gnStartMsg, 0, 0 ); where hwndOtherDlg is the HWND of the receiving dialog. Or, if you have a CWnd* to it, you can do: pOtherDlg->SendMessage ( gnStartMsg, 0, 0 );
  • Font size problem ???

    help question
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • tapi

    2
    0 Votes
    2 Posts
    5 Views
    L
    ================== The original message was: I would appreciate any info on tapi. I wish to write a simple app to enable me to send wave files to modem eg. simple answer phone. I struggled to understand examples in MSDN so if anybody can assist it would be much appreciated.blabla
  • Who had focus. Any high level suggestion would be helpful.

    com tutorial
    2
    0 Votes
    2 Posts
    6 Views
    U
    If you haven't switched to any other windows, then it'll happen automatically when the dialog box is closed. That's the way Windows works and I advice that you let it work that way. If you want to override that behavior then before showing the dialog box, get the handle of the foreground window (using GetForegroundWindow) and then restore it when the dialog closes (SetForegroundWindow). Cheers! Alvaro
  • read jpg

    c++ help
    2
    0 Votes
    2 Posts
    11 Views
    D
    The source is available at www.jpeg.org Regards, Dmitriy ================== The original message was: I try find source for read JPEG icon like MakeBmpFromFile function in VC++ 5 but I need this for VC++ 4 project Thank you for your help Roni
  • How to know that file .gif is animated or not ???

    tutorial question
    3
    0 Votes
    3 Posts
    19 Views
    L
    If you know how to parse the header section of the GIF file, then look for the 0xFF flag indicating an application-specific extension, and if found and you have a buffer, check for the string "NETSCAPE2.0" -- that's the indication for an animated GIF. ================== The original message was: Hello I have to know that file .gif is animated or not !!! because my library display Gif not support Animated Gif it will crash when open Animated. My idea is do check myself that is Animated or not !!! but I don't know what to do ??? Any Idea ??? Thank you
  • How do I use stl in a static lib?

    c++ question testing beta-testing help
    5
    0 Votes
    5 Posts
    21 Views
    L
    Sorry the '<' & '>' in my orriginal post were treated as html; < string > is #included in the stdafx.h. 1. I do not use 'using namespace std' because that I want to use the namespace and not just ignore it, therefor I scope all of the stl strings with std::. This works very well. 2. I am not using CString because I don't want to use MFC for this and because I am using string in this example when I also want to use stl vector and map classes. 3. No one has addressed my original problem which is multiple defines. The code for the static library builds just fine. I am getting the multiple defines in the application that also uses stl and links with my static library. Brad ================== The original message was: For one, you aren't directly including the header file as far as I can tell...that might have something to do with it. Of course, it might just be easier to use CString instead of string (it is what MFC uses anyway and it basically offers the same functionality). ================== The original message was: I'm trying to create a static lib with a simple class that has a single method that returns a std::string. I can build the static library just fine but when I link my application against the static library I get an error about multiple defines of std::basic_string. Has anyone done this successfully? Thanks, Brad ------------------------------------------------------- My header file:#if !defined( __CTest_h__ ) #define __CTest_h__ class CTest { public: CTest(); ~CTest(); std::string Try( void ); }; #endif ------------------------------------------------------ The corresponding .cpp file: #include "StdAfx.h" #include "CTest.h" CTest::CTest( void ) { } CTest::~CTest( void ) { } std::string CTest::Try( void ) { std::string strResult = "testing"; return strResult; } -------------------------------------------------------- is #included in StdAfx.h
  • SHAppBarMessage Wrapper

    question
    3
    0 Votes
    3 Posts
    20 Views
    A
    Hi John, There was a very good article on this topic in MSJ (it was published in 1996, unfortunately I don't remember the month). Anyway you can find the copy of the article on MSDN CD. You just have to search the library for: "SHAppBarMessage" or "Jeffrey Richter". The title of the article is "Extend the Windows 95 Shell with Application Desktop Toolbars" Regards, Andrei Zenkovitch Dundas Software ================== The original message was: Does a SHAppBarMessage wrapper exist? I would like to implement a ApplicationBar, and was just wondering before I go and write one myself. Thanks in Advance John Mancini
  • External program execution

    c++
    6
    0 Votes
    6 Posts
    26 Views
    L
    STARTUPINFO si; PROCESS_INFORMATION pi; BOOL bResult; // Initialise the STARTUPINFO structure memset(&si, 0, sizeof(si)); si.cb = sizeof(si); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; bResult = ::CreateProcess(NULL, // no executable module name (use command line) "WordPad.Exe", // command line, file name in same directory as the DLL NULL, // process handle not inheritable NULL, // thread handle not inheritable FALSE, // handle inheritance 0, // no creation flags NULL, // use parent's environnement block NULL, // use parent's starting directory &si, // pointer to STARTUPINFO structure &pi); // pointer to PROCESS_INFORMATION structure if (!bResult) { TRACE("Can't start WordPad.Exe\n"); } regards, Jean-Claude.
  • montior browser activity

    question
    2
    0 Votes
    2 Posts
    8 Views
    E
    Attach to the iexplore.exe process and event sink to the web browser events. Then when the event occurs, like the url changing, you will recieve the event and can do what you want with it. There is an example on how to do this in an MSJ article back aroudn July 98 I also have experience doing this and could help you directly, just let me know. -Erik ================== The original message was: How do I monitor browser activity such as Explorer Netscape and AOL etc like ICQ doe to get the current users URL? TIA Shaun Wilde
  • C++ Development Time Tracking

    c++ question workspace
    5
    0 Votes
    5 Posts
    20 Views
    D
    Sure is not so difficult. Rather it can be done by way automation - throw Application object. ================== The original message was: That wouldn't be much harder. Just enumerate the windows to search for a title contianing "Microsoft Visual C++" on one of them, and then store the window's HWND value and use a thread to constantly check the status of the window and update the time (maybe every minute or so, so that it doesn't take up too much proccessor time...or every 5 seconds or so...it all depends on how accurate you really want to be). The title comes in something like the following format: "PROJECT NAME - Microsoft Visual C++ [CURRENT FILE INFORMATION]". When the PROJECT NAME part changes, or the window is closed, or the window and its children are not active, the clock stops counting for the listed project. On program exit and entrance, it would load past project values and save new project information. A simple combo-box interface could allow you to view the status of each project, reset timers, etc. ================== The original message was: I think he means something different. No everybody will remember to press the buttons. It should work automatically - when your open a project it should start, when you close - finish. Also take care abourt right counting time while your another application is active and VC++ is sleeping ================== The original message was: I don't know if there is an add-in, but it wouldn't be that hard to write yourself a quick little program that tracks the time (select the project from a dropdown list or something and then hit the start button to start tracking, hit the stop button when you go on break etc.). It might take 15 minutes or so to write. ================== The original message was: I write a lot of "smallish" custom C++ apps and am always interested in understanding the actual amount of time spent on each project. (Perhaps similar to the File-Properties information provided in Microsoft Word.) Is there a DevStudio Add-In that tracks time in a project/workspace? If not, I'd be interested in other (preferably automated) approaches.
  • "Code keeper" type program in VC++

    c++ question
    2
    0 Votes
    2 Posts
    8 Views
    U
    I don't exactly know what you're referring to but it sounds an awful lot like a DLL. In other words, when you have some common code that other apps may need to use, you put it in a DLL and presto. Alvaro ================== The original message was: Is there a "code keeper / code bank" type program written in VC++ w/source code available? Thanks, Marc
  • Explorer.exe

    question c++ windows-admin
    4
    0 Votes
    4 Posts
    18 Views
    M
    Ah, I found it after all! HWND hwnd = FindWindow( _T("Progman"), NULL ); PostMessage( hwnd, WM_QUIT, 0, 0 ); ShellExecute( NULL, NULL, _T("explorer.exe"), NULL, NULL, SW_SHOW );
  • array[-1]

    data-structures question
    3
    0 Votes
    3 Posts
    13 Views
    J
    It would only be useful in a small number of cases. Say, if you wrote a peice of code like this: char text[100]; char *ref = text[1]; if(*ref == ref[-1]) return FIRST_EQUALS_SECOND; However, I don't see why you would want to do that in any normal case. ================== The original message was: this is certainly beyond my knowledge to learn that array[-1] is valid in some cases. i am shocked, stunned and desparate ! i am now examing an existing project and i am suspecting this is the cause of all evils. but now somebody said this is perfectly legal. okay okay.. let me draw the picture bigger. there is this array of struct defined like this.. struct someStruct array[100] and i am assigning like this array[-1].field1 = something. so so..is this so called access the return address or read parameter directly ?? arghhh !!! what am i talking about ?? some1 pls resurrect me !!
  • How do you use a Rich Edit Control in a dialog?

    help question
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Modeless Dialog Boxes

    help question
    3
    0 Votes
    3 Posts
    14 Views
    L
    If you dont't want to overwrite all the func (OnCancel, OnOk, ... (and don't forget Alt+F4), you can overwrite the PreTranslateMessage func and try catching ESC, Return ... BOOL CSelectToolDlg::PreTranslateMessage(MSG* pMsg) switch (pMsg->message) { case WM_KEYDOWN: switch (pMsg->wParam) { case VK_RETURN: pMsg->wParam = 0; break; case VK_ESCAPE: pMsg->wParam = 0; break; } break; Hope this helps erni
  • Rich Edit Ctrl in dialog?

    c++ help question learning
    3
    0 Votes
    3 Posts
    13 Views
    A
    Hi Steve, The problem has to do with the fact that when CDialog tries to create a dialog window from the resource template internally it does by calling ::CreateWindowEx() function. The most important argument in this function is the name of the window class (like "Static" for static control or "Edit" for edit control). It is required that before window is created its window class must be registered. MFC does it internally for common controls but not for rich edit control which implementation resides in different dll. So when you call DoModal() function the internal Windows implementation will fail to create the rich edit control and therefore the creation of the dialog will fail as well. Now how to fix the problem. You just have to load the dll that contains rich edit control implementation in your InitInstance() function: HINSTANCE hRichEdDLL=::LoadLibrary(_T("RICHED32.DLL"); if(g_hRichEdDLL==NULL) TRACE(_T("Cannot load library to display RichEditTextControl")); Regards, Andrei Zenkovitch Dundas Software P.S. I assumed you were using MFC. If it is not the case then above mentioned explanations are still valid. ================== The original message was: I'm using VC++5. I find that when I use the resource editor to put a Rich Edit control in a dialog that is used either as part of a property sheet or as a dialog started from a menu option that the DoModal dialog callreturns -1 indicating that the box could not be created. (The same thing happens in VC++6). I searched the help and found no mention of any such limitation - it seems logical to be able to do it as the control is in the toolbar in the resource editor. I guess I must be doing something wrong. Any ideas? Steve