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
L

luedi

@luedi
About
Posts
13
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • rendering Buttons from SVG images?
    L luedi

    Hi, last week there was a new addition to codeproject, the CRoundButton2 class. This directly cought my attention, since I would like to add skinning and resizing capabilities to our application. But I have still a problem with this class. It can only handle text on the buttons and no overlayed bitmaps. Why isn't there any Button class with SVG rendering capabilities. I know, I can write one myself and perhaps I will do so, but I find it interesting, since SVG is an accepted standard. There is no basic SVG rendering library available for Windows. You have to make use of adobes product or of the internet explorer. Recently there was a note that the two libraries librsvg and libsvg will join, and with the cairo backend there is also a win32 based output target available. But I can't believe that there isn't anything currently available to render Buttons with SVG images wihin windows. Something, that is built into GTK/Gnome and QT/KDE since years. Or, can somebody point me to the right direction? I don't want to make use of all high level features of SVGs, CSS and whatever. Simply render a button from a SVG source and have all button styles like, hoover, pressed, inactive and so on assigned a different SVG. Best regards Dirk

    C / C++ / MFC css wpf help question

  • Trouble using WTL7.0 in a MFC project
    L luedi

    I wanted to use only the PrintPreview Feature from the WTL. I think this can also be easily rewritten in MFC. But it was available for a fast test. After I rewrote the problematic line to read: class CPrintDC : public WTL::CDC { } I could compile my project and everything is running fine. I was more astonished, that the lookup for typedef is first done in the global namespace and then in the local namespace. I think this is more a question concerning the compiler. Thanks Dirk

    ATL / WTL / STL help c++ question

  • Trouble using WTL7.0 in a MFC project
    L luedi

    Hi I wanted to deploy the CPrintPreviewWnd from the WTL in a MFC project, but got compiling errors due to wrong usage of the CPaintDC class in the WTL headers. The problem boils down to the fact, that a typedef'd class in a namespace does not honor the namespace. The following code is a demonstration of the problem. Compilation will fail with the following error error C2664: 'f' : cannot convert parameter 1 from 'char [6]' to 'int' class CPaintDC { public: void f (int i) {}; }; namespace WTL { template class CDCT { public: void f (char* i) {}; }; typedef CDCT CDC; class CPaintDC : public CDC { }; class Test { public: Test () { CPaintDC dc; dc.f ("world"); } }; }; What you can see from the code is, that the class CPaintDC is once declared in the global namespace (from MFC) and once in the WTL namespace. Both declarations of the class have a different signature for the function f (in the global namespace one int parameter, in the WTL namespace one char*). Then the CPaintDC is used in a new class, again in the namespace WTL. I expected the WTL::CPaintDC class to be used in this context, but I the compiling error tells me that the global class was used. Changing the local Variable to be of type WTL::CPaintDC doesn't help, since the problem is in the declaration of the class CPaintDC in the namespace WTL. Here the base class for the CPaintDC is taken from the global namespace, even if there is an appropriate type definition just infront the class. changing the declaration to read > class CPaintDC : public WTL::CDC or > class CPaintDC : public CDCT everything is ok. If there isn't any global class of the same name, as within the namespace, the namespace part of the code above will compile correctly. Is this a documented bug in the compiler, or did I miss something? I'm using the VisualStudio 6.0 with SP5. Any ideas? Dirk

    ATL / WTL / STL help c++ question

  • field evaluation in RTF files
    L luedi

    Hi, I wanted to use the RTF/CRichEditCtrl as a kind of report system, where the reports are generated from templates of rtf files. Consider a simple application, that needs to fill out a predefined form with some application dependant values. A first simple solution would be to search and replace Tags within the RTF file with the computed values. A better solution would be to use the field tag from the RTF specification directly. For example the author field from a word document would look like: {\field{\*\fldinst { AUTHOR \\* MERGEFORMAT }}{\fldrslt {Dirk}}} where fldinst is the specific field instruction and fldrslt is the latest evaluated result. Unhappily the CRichEditCtrl does not evaluate internal fields (like author) either, and I couldn't find any Interface in the ITextDocument specification to access the fields of the document. Does anybody know how to reevaluate the contents of fields programmatically? Something like a callback function with the fied instruction (fldinst) and the return value is the evaluated result? Another possibility would be to reparse the complete document again and aply the evaluated values into the result field (fldrslt) and then feed the document back to the Ctrl. Any ideas / code? Thanks Dirk

    C / C++ / MFC tutorial wpf question

  • How to supply a generated image to a HTML page in a CHtmlView
    L luedi

    MHTML, never heard of this... searching the web, this could be the solution, but it seems, that Outlook Express is required. Thanks for the idea. Dirk ... Web Archive When you save a Web page as "Web archive," the Web page saves this information in Multipurpose Internet Mail Extension HTML (MHTML) format with a .mht file extension. All relative links in the Web page are remapped and the embedded content is included in the .mht file, rather than being saved in a separate folder. The absolute references or hyperlinks on the Web page remain unchanged and the .mht file is viewed using Internet Explorer. MHTML enables you to send and receive Web pages and other HTML documents using e-mail programs such as Microsoft Exchange, Microsoft Outlook, and Microsoft Outlook Express. MHTML enables you to embed images directly into the body of your e-mail messages rather than attaching them to the message. NOTE: "Web archive" is available only if Outlook Express is installed. The ability to save a Web page as a Web archive file is provided by the Inetcomm.dll file (the Microsoft Internet Messaging API file), which is installed by Microsoft Outlook Express 5. ...

    C / C++ / MFC xml html wpf com help

  • How to supply a generated image to a HTML page in a CHtmlView
    L luedi

    Hi, I must add some report generation to our application. The reports should be customizable via templates. I thought about having some XML/XSL to generate HTML output and to display this output via a CHtmlView. The only problem I have (right now) is that I can't find a way to show the application generated images within the HTML page. Feeding the generated HTML source to the IE is possible via a technique used in the CHTMLWriter class (http://www.beginthread.com/Article/Ehsan/Adding HTML Content to the WebBrowser Control Dynamically/) Showing static images is possible via the res:// protocol, but what about generated images. Is there a simple solution to add callbacks to the IE, so that I can provide the image during the rendering stage? Writing the images to the disc is a solution, but not an elegant one. Any ideas? Thanks Dirk

    C / C++ / MFC xml html wpf com help

  • Marching Ants?
    L luedi

    Hi, does anybody have some code to draw a marching ants rectangle? I found two techniques on the web, one using the LineDDA (http://www.undu.com/DN960901/00000009.htm) function, and one using a specific brush (http://www.funducode.com/freevc/gdi/gdi3.htm). I would like to combine this with the CRectTracker. Does anybody have experiences with this? Thanks Dirk

    C / C++ / MFC com graphics question

  • reactivate the view in an SDI app
    L luedi

    Hi, because the CEditView can do FindText out of the box. I know, you can always implement that yourself, but why should I. Only because MFC does a tight coupling between Views and the Frame? There are thousands of reasons, why someone does this or that. I tried converting my application to an MDI app. With the result, that this is as much trouble, than sticking with an SDI app. Views are the same thing than Controls. Only that they have an attached document (which is no problem), and that they talk to the frame directly (which is a problem). There is no bad thing about using Views as Controls. Thing for example at the CScrollView. I can think of a lot of Controls that could need scrolling capabilites. Why shouldn't I use a CScrollView as the base class for such controls. And now think of a CFrameView that has these CScrollView derived controls on them. Boom, you get the same problem if you click on this control. I would have derived my controls from a CScrollCtrl if there was one, but there wasn't. I would have used a CEditCtrl that can do FindText, if there was one, but there wasn't ;-) Dirk

    C / C++ / MFC question csharp database visual-studio hardware

  • reactivate the view in an SDI app
    L luedi

    Hi, how can I reactivate the one and only view of the one and document in a SDI app? A little explanation why I must do this: I have a standard SDI application and added a ControlBar with an embedded CEditView latetly. The problem is, that this EditView will activate itself within the MainFrame if you click on it. I need the possibility to reactive the View of the main document programatically if I want to do some view dependant processing, for example closing the app. Closing the app e.g. will query the active view wether the underlying document has changed. If I have the wrong view active (e.g. the CEditView), this message is send to the wrong document. As a second example: The CEditView is a LogConsole for my application. If I have activated the CEditView, e.g. with a mouseclick I want to reactivate the main SDI view with the ESC key like the Output Control bar in the Visual Studio. But how do I find the document to send the Acitvation command to? In a MDI application there is the MDIGetActive() window, i think, but there seems to be no such window handle in a SDI application. I thought about hooking somewhere into the InitialUpdateFrame or OnCreateClient procedure, and safe the created view from there. But I'm sure wether this is safe, also when I have opened different documents. Thanks for any ideas. Dirk

    C / C++ / MFC question csharp database visual-studio hardware

  • Single Document in MDI app or....
    L luedi

    multiple Documents in SDI applications. Hi, I have an application that is mainly a SDI form based app. There is no sence in opening more than one document in a time. I use a technique to switch between 4 different views based on the state of the app and again, there is no need to see two of the views at the same time. I have a few ScrollView derived Ctrls on the FormView where I already had problems that mouseactivation on the ScrollView derived class will send a SetActiveView to the mainFrame. This results in unexpected program behavoir (mostly program crashes later on). For these problems I already have a workaround. Yesterday I tried to include debugging capablities using the CEditLog class with a CEditView ctrl in a CControlBar. Again I had the problem that upon activation the CeditView Window sends SetActiveView calls to the MainFrame and additionally will call CDocument::SetModified (). I choosed the EditView since I wanted to use the search / serialize capabilities, but the CEditView needs a Document, so I gave an empty CDocument to the CEditView. But this only leads to additional problems. Terminating the application while the focus is on the ControlBar leads to crashes since the View has changed and so on. I don't really want to switch to an MDI application, only to support edit capabilities or better a second CView derived window. Does anybody have similar experiences with something like this? Must I switch to an MDI app? Thanks in advance Dirk

    C / C++ / MFC help question

  • How to reload a modified CDocument
    L luedi

    Thanks Alvaro, I hoped there was a simpler solution. Perhaps only setting a flag or something ;-) I realized it now, not overriding the OpenDocumentFile member function, but the MatchDocType function. This results in a much cleaner solution, since I don't have to copy code from the CSingleDocTemplate implementation :-) class CSingleReloadDocTemplate : public CSingleDocTemplate { DECLARE_DYNAMIC(CSingleReloadDocTemplate) public: CSingleReloadDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass) : CSingleDocTemplate (nIDResource, pDocClass, pFrameClass, pViewClass) { } virtual Confidence MatchDocType(LPCTSTR lpszPathName, CDocument*& rpDocMatch) { Confidence confidence = CSingleDocTemplate::MatchDocType (lpszPathName, rpDocMatch); if (yesAlreadyOpen == confidence && rpDocMatch->IsModified()) { int answer = AfxMessageBox ("Do you want to reload the document", MB_YESNO); if (answer == IDYES) { // set the document modification state to "not modified" so the document template // will not complain during OpenDocumentFile () rpDocMatch->SetModifiedFlag(FALSE); // tell the DocumentManager, that no document with this title is already opened rpDocMatch = NULL; confidence = yesAttemptNative; } } return confidence; } }; IMPLEMENT_DYNAMIC (CSingleReloadDocTemplate, CSingleDocTemplate); For a MultiDocTemplate one should perhaps close the found document in some way (perhaps via CDocument::OnCloseDocument) since the CMultiDocTemplate::OpenDocumentFile() function will not reuse an existing open document like the CSingleDocTemplate. I'm not sure wether there is a combined method for this task that can be used for a SingleDocTemplate and a MultiDocTemplate (perhaps one can use CDocument::OnCloseDocument() already) Regards, Dirk

    C / C++ / MFC tutorial question

  • How to reload a modified CDocument
    L luedi

    Hi, in a SDI application I want to reload a document that was modified with CDosument::SetModified (TRUE) by clicking on the document in the MRU list. But the framework will recognize the document as already beeing loaded and only activates it as current active document again. There seems to be also no simple method to override to allow such a behavoir. Two functions are involved in this: CDocManager::OpenDocumentFile and CDocTemplate::MatchDocType Both are virtual but both are also non trivial. This function does not belong into the CDocTemplate, since I would like to have it for all Documents in a MDI Application. But this function isn't trivial at all. Finally I have CWinApp::OnOpenRecentFile. But this isn't a real option also. Is there any simple way to do this? Thanks Dirk

    C / C++ / MFC tutorial question

  • clipboard and CImage
    L luedi

    Hi, today I feel like a little child not understanding anything from the bitmap API. What I want to do is to fetch a large image via the clipboard using one of the CF_BITMAP of CF_DIB types. Since I need the data in an image processing application I must convert the data to some specific format, namely a 24 bpp DIB. Nothing special, but the format of the DIB in the clipboard can be anything. Additionally I need the data in my own data buffer and finally the image is tiled and must be composed back into one image using supsequent calls the the external application and ::GetClipboardData. Since the image is very large I don't want to copy memory around just to compose a DIB from the clipboard data, copy this DIB into a DDB with the desired new format and later copy the data into the user supplied buffer. As I said, I feel like a little child today, not understanding anything anymore from the DIB/BITMAP API. While trying to solve my problem I had the following questions: 1.) How can I wrap a user provided buffer into a DDB or DIB? It seems to me, that this is not possible, but why? 2.) What is the difference between a HBITMAP and a HANDLE or a HDIB? Or better, why does GetObject fail if I try to use it on a HANDLE returned from ::GetClipboardData (CF_BITMAP)? 3.) How do I wrap the data in the cipboard into a CImage? I cannot Attach to the HANDLE returned either from CF_BITMAP or CF_DIB and I can't use the API directly since there is no function to return the pointer to the start of the bits buffer. The function GetBits () returns a pointer to Pixel (0,0) which is in the most cases at the end of the bits buffer. 4.) What is the difference of a DIBSECTION and a DDB/DIB? The DIBSECTION seems to combine all the needs for a DDB and a DIB. It has BITMAP header and a BITMAPINFOHEADER. In the BITMAP header there is a member bmBits that points to the bitmap data. In the CImage::UpdateBitmapInfo this member is used as a pointer to the bits for a DIBSECTION image. But why is this member not valid for a BITMAP image? 5.) There are a lot of wrappers available for DIBs. One treats a DIB as an inherited CBitmap, another introduces a HDIB handle the next one only wraps the DIBSECTION API. All wrappers seem to be written before the existance of ATL7. But the CImage class still does not cover a good range of functions to deal with this problem. Is there a wrapper available that extends the CImage class for DIB/DDB conversion? Thanks a lot for your answers. Dirk

    ATL / WTL / STL question graphics docker json performance
  • Login

  • Don't have an account? Register

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