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
D

Doug Knudson

@Doug Knudson
About
Posts
13
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to execute methods from ATL/COM base class
    D Doug Knudson

    Hi Mike, Thanks! I will give that a try. I am doing the bulk of my drawing in OnDraw() but I need to drag a selection rectangle during the MouseDown, MouseMove, MouseUp events so I need to (or at least I think I need to :)) have the DC outside of what is handed to me in OnDraw() ?? Thanks again, Doug

    Doug Knudson

    COM c++ com docker help tutorial

  • How to execute methods from ATL/COM base class
    D Doug Knudson

    Thanks for the reply. I didn't ask my question very well, but basically I am writing a windowless ATL component and need the Device Context from the Parent/Container so that I may draw in event handlers (for example, in MouseMove()). During my length time searching, all I could find was people saying that I needed to just execute the GetDC() method of the IOleInPlaceObjectWindowless interface like this:

    HDC hDC = NULL;
    HRESULT hr = IOleInPlaceObjectWindowless::GetDC(myRect,myFlags,&hDC);

    The compiler interprets the above as trying to execute a static member function, which, of course, GetDC() isn't. If I just use:

    GetDC();

    I get the API GetDC() that expects there to be a m_hWnd, which there isn't (windowless control), so I am pretty lost as to how to do this. Thanks, Doug

    Doug Knudson

    COM c++ com docker help tutorial

  • How to execute methods from ATL/COM base class
    D Doug Knudson

    In VS6 C++, I have a windowless ATL control. To get a Device Context from the container, I belive I need to execute the GetDC() method of one of the base classes for the control, specifically IOleInPlaceObjectWindowless. I tried to do this: CDC *pDC = IOleInPlaceObjectWindowless::GetDC(); But it doesn't work so I am at a loss as to how to execute a method on the IOleInPlaceObjectWindowless interface. Any help would be greatly appreciated, Thanks, Doug

    Doug Knudson

    COM c++ com docker help tutorial

  • VC++ 6 - > VS2005 ATL Compile Errors
    D Doug Knudson

    Hi, I have tried allowing VS2005 to convert several existing 'VC++6 compilable' projects and with each the results are the same. Tons of ATL related compile errors. None of the projects that I am trying to convert even use ATL! I am assuming this is some sort of compiler/preprocessor setting? The errors occur in: atlalloc.h atlconv.h atldebugapi.h atltrace.h I have included below, the first part of the Output display from the compile. Any help, ideas or a pointer to an answer would be greatly appreciated! Thanks, Doug

    ------ Build started: Project: TPC, Configuration: Debug Win32 ------
    Compiling...
    StdAfx.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    NOTE: WINVER has been defined as 0x0500 or greater which enables
    Windows NT 5.0 and Windows 98 features. When these headers were released,
    Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
    For this release when WINVER is defined as 0x0500 or greater, you can only
    build beta or test applications. To build a retail application,
    set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
    to see if retail Windows NT 5.0 or Windows 98 headers are available.
    See the SDK release notes for more information.
    d:\microsoft visual studio 8\vc\atlmfc\include\afxv_w32.h(228) : error C2065: 'DWORD_PTR' : undeclared identifier
    d:\microsoft visual studio 8\vc\atlmfc\include\afxv_w32.h(228) : error C2143: syntax error : missing ';' before 'GetWindowThreadProcessId'
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(80) : error C2065: 'LLONG_MIN' : undeclared identifier
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(80) : error C2057: expected constant expression
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(81) : error C2065: 'LLONG_MAX' : undeclared identifier
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(81) : error C2057: expected constant expression
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(89) : error C2065: 'ULLONG_MAX' : undeclared identifier
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(89) : error C2057: expected constant expression
    d:\microsoft visual studio 8\vc\atlmfc\include\atlalloc.h(603) : error C3861: '_resetstkoflw': identifier not found
    d:\microsoft visual studio 8\vc\atlmfc\include\atlconv.h(92) : error C2061: syntax error : identifier 'LONG_PTR'
    d:\microsoft visual studio 8\vc\atlmfc\include\atlconv.h(92) : error C2146: syntax error : missing '(' before identifier 'LONG_PTR'
    d:\micro

    C / C++ / MFC c++ help csharp visual-studio com

  • Excel Automation Using C++ #import
    D Doug Knudson

    Hi Roger, Thanks very much for the response. In answer to your questions... msp_excel is a pointer to the "Application Object" defined as _ApplicationPtr and yes, though strange and at least in the wrapper files (.tlh and .tli) generated by the #import, the Selection is associated with the Application Object, not the sheet. Another strange thing to me is that a Selection does not seem to be an object at all when using #import (no ISelectionPtr or equivalent) whereas in in the documentation (99.99% for VB, as I'm sure you know :)) it appears to be an object with VB syntax like: appObject.Selection.Font.Style = "bold" I would expect to be able to use something like the following to get a range that corresponded to the selection: msp_excel->GetSelection()->GetRange(); Since it seems that you need a range for nearly everything that you do in Excel, getting a range for the current selection seems like such a common and trivial thing to do, I can't help but feel I am really missing something fundamental here... :-( Thanks, Doug

    Doug Knudson

    C / C++ / MFC c++ testing tools help question

  • Excel Automation Using C++ #import
    D Doug Knudson

    Hi All, Very new to Excel Automation but have done a lot with Word Automation. Using VC++ V6 and Excel 2000. I simply need to get a range object that corresponds to the current user selection. This is what I thought would work: Excel::IRangePtr spRange = msp_excel->GetSelection(); There is an active sheet and a selection of cells but spRange (the smart pointer) is always returned as null??? I am also puzzled by the fact that there doesn't seem to be a Selection object, per se, something that could be returned and worked with via ISelectionPtr or the like??? Any help greatly appreciated! Thanks, Doug

    Doug Knudson

    C / C++ / MFC c++ testing tools help question

  • Pasting into a CEdit Control on a Dialog
    D Doug Knudson

    Thank you very much! Works like a charm! Doug Doug Knudson

    C / C++ / MFC visual-studio performance

  • Pasting into a CEdit Control on a Dialog
    D Doug Knudson

    Hi All, In VS 6 I copy data from a custom control on a dialog using my own clipboard management (see code below) and would like to paste it into a CEdit on the same dialog. I believe I am getting it to the clipboard correctly, in CF_TEXT format because I can paste the text into WordPad or Notepad just fine. I am unable, however, to paste my clipboard contents to the CEdit either with the CEdit context menu or Ctrl+V. Making this all the more confusing is that if I copy text from Wordpad, which presumably is in CF_TEXT format, I am able to paste into the standard CEdit just fine. Any ideas would be greatly appreaciated! Thanks, Doug // This just simulates the text I want to get to the clipboard CString cellText = "This is a test"; // Open the clipboard and empty it OpenClipboard(); EmptyClipboard(); // Get a chunk of memory for the formatted text int dataStringLen = cellText.GetLength(); HANDLE dataHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,dataStringLen + 1); char *memPtr = (char *)GlobalLock(dataHandle); // Copy the data to our mem block memcpy(memPtr,(char *)(LPCTSTR)cellText,dataStringLen + 1); memPtr[dataStringLen] = '\0'; // Unlock the handle, place the data on the clipboard and then free the // handle GlobalUnlock(dataHandle); SetClipboardData(CF_TEXT,dataHandle); GlobalFree(dataHandle); CloseClipboard(); Doug Knudson

    C / C++ / MFC visual-studio performance

  • Problem With Message Handling in Modeless Dialog
    D Doug Knudson

    Hi All, I'm really baffled and having struggled for several days, I need to bare my soul and ask for help :-) With C++ VS 6, I have created a COM component, added an ATL (Full Control), added methods and events to the appropriate interfaces and then created a modeless dialog (CDialog) in the component. The control has no CWnd so when I create the modeless dialog, I use Create (IDD,NULL) where the NULL indicates, I think, that the parent is the main app window, of which there is none, at least not in the COM component itself. Things all work well so far and I have added a bunch of standard dialog controls, buttons, statics, edit controls, etc all working fine EXCEPT I am unable to use the TAB key to move between edit controls. In general, it seems that mouse messages are sent to the dialog where I can handle them but most keyboard messages (WM_CHAR, WM_KEYDOWN, WM_KEYUP, etc. are not. In fact, I even added a PreTranslateMessage handler to the dialog, but it never even gets called? In desperation, I added a PreTranslateMessage handler to the "MFC host app" that instantiates and uses the COM component and indeed I can capture the messages of interest from the CDialog in the COM component, WM_CHAR, WM_KEYDOWN, WM_KEYUP, etc but of course it doesn't do me much good to have the messages at this high level. My guess is that the messages get to the MFC host app because, to a COM component, the host app "is" the main application window?? Either way, I really need to have the dialog in the COM component allow the user to tab between edit controls. Any help would be greatly appreciated. Thanks, Doug Doug Knudson

    C / C++ / MFC c++ help visual-studio com question

  • Windows XP - Not Responding
    D Doug Knudson

    Hi all, Oh, how I miss the days of my youth when there was only one "correct" way to solve every problem... and I was always sure what the "correct" solution was to everyone's problems, even when I had no idea of the circumstances of the other person's problem. Oh well, those days are gone and I am much older now :-) At any rate, the winner is... Ravi Bhavnani for his excellent reference to the article on periodically pumping messages to keep the dialog alive. My sincere thanks to Ravi! Doug Doug Knudson

    C / C++ / MFC c++ help learning

  • Windows XP - Not Responding
    D Doug Knudson

    Hi, I have a problem with a VC++ (6.0) dialog based application running under Windows XP. From a modal dialog, the user initiates some long-running activity, in a loop, that can take as much as 10 - 15 minutes to complete. If during the processing, the user covers the modal dialog with another window, even for a second or two, and then re-exposes it and clicks in the dialog, on Windows XP, "Not Responding" is displayed in the window title bar, causing the user to believe the app has died... but of course it hasn't. This behavior does not seem to occur under Windows 2000 or NT. There are a whole host of reasons why it would not be a good idea, in this particular situation, to start a new thread to do the processing, freeing up the dialog to respond to whatever messages XP is sending to determine if it is alive.... so.... Short of a separate thread... any ideas would be really, really appreaciated :) Thanks, Doug Doug Knudson

    C / C++ / MFC c++ help learning

  • COM Component Returning An Array to VBScript
    D Doug Knudson

    Hi All, In VC++ 6, I have created a simple COM component that contains a single method on a single interface that returns a 2 dimensional SafeArray (3 columsn, variable number of rows) wrapped by a VARIANT. I tested the component from a C++ test app and the data is returned in the Variant/SafeArray and can be extracted using conventional means, and all is well. This whole process took about 3 hours. I have spent the last 4 days trying to get the component to work when instantiated in ASP code (VBScript). Sorry for this long post but I want to include as much info as I can in hopes that some kind soul will help. The component was created with a single control (Simple Object). The function looks like this... STDMETHODIMP CSiteSearch::SearchHTM(BSTR searchPath, BSTR searchPhrase, VARIANT *pSearchResults) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) .................. Guts of function here to generate three CStringArrays (documentTypeArray,documentPathArray and documentContextArray) to be packed into the SafeArray and then wrapped by the Variant .................. // Now stuff the safe array and return the data DWORD numElements[2]; numElements[0] = 3; numElements[1] = documentTypeArray.GetSize(); COleSafeArray sa; sa.Create(VT_BSTR,2,numElements); long elementIndex[2]; BSTR bData; for (int row = 0; row < documentTypeArray.GetSize(); row++) { // Insert each column into the SafeArray elementIndex[0] = 0; elementIndex[1] = row; bData = _bstr_t(documentTypeArray.GetAt(row)); sa.PutElement(elementIndex,bData); elementIndex[0] = 1; elementIndex[1] = row; bData = _bstr_t(documentPathArray.GetAt(row)); sa.PutElement(elementIndex,bData); elementIndex[0] = 2; elementIndex[1] = row; bData = _bstr_t(documentContextArray.GetAt(row)); sa.PutElement(elementIndex,bData); } // Return the array in a variant CComVariant cVar; cVar.Attach(pSearchResults); cVar.Copy(sa); cVar.Detach(pSearchResults); } return S_OK; } This works fine when called from a VC++ dialog based, client app (importing the type library). The ASP/VBScript code that does not work looks like this... ' The creation of the control and the call of the method works without error Set searchControl = Server.CreateObject("WebSiteSearch.SiteSearch.1") theResults = searchControl.SearchHTM ( "C:\SomeFolderToSearch", searchPhrase )

    COM help c++ com sysadmin data-structures

  • Adding Text With Superscript to Dialog Title Bar
    D Doug Knudson

    Hi, My current task is to find a way to add superscripted text to the title bar of a CDialog based window, as in "MyWindowsuperscript". My first thought was that there must be some control characters to embed in a CString that when sent to CWnd::SetWindowText(superscriptedText)would cause the text to be rendered. No luck on this front. Undaunted, I thought about making the superscripted text a graphic and drawing it in the Title Bar. I haven't been able to find any guidance on this approach for a CDialog derived class. Any help greatly appreciated! I'm working in Visual C++ Version 6. Thanks, Doug Doug Knudson

    C / C++ / MFC c++ graphics help announcement
  • Login

  • Don't have an account? Register

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