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
N

Nathan Holt at EMOM

@Nathan Holt at EMOM
About
Posts
139
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Only one Icon in my treeview!
    N Nathan Holt at EMOM

    CrocodileBuck wrote:

    SHGetFileInfo(sFile, 0, &sfi, sizeof(SHFILEINFO),SHGFI_SYSICONINDEX | SHGFI_SMALLICON);

    When you create the tree control, you need to call SHGetFileInfo with SHGFI_SYSICONINDEX | SHGFI_SMALLICON, and get the return value, which is a handle to the system image list. You then need to set your tree view's small icon image list to be the system image list. After that, your tree view should show the right icons. The code would be something like this:

    HANDLE hSystemImageList = SHGetFileInfo(sKnownFile, 0, &sfi, sizeof(SHELLFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
    trCtrl.SetImageList(CImageList::FromHandle(hSystemImageList), TVSIL_NORMAL);

    Nathan

    C / C++ / MFC php data-structures question

  • VB Client Crashes while using ATL COM build in C++
    N Nathan Holt at EMOM

    garammasala wrote:

    I made a mistake while giving the question i.e "g_CallMonitor" is nothing it is the global pointer "g_pTestATL" which is firing the event from the static function.... replace g_CallMonitor with g_pTestATL

    That makes perfect sense. :)

    garammasala wrote:

    I have found the solution to the problem but was not really able to understand the whole solution , Below is the link http://vcfaq.mvps.org/com/1.htm[^] May be you can through some light....

    I'm not sure what you don't understand. I assume that you've implemented one of the options and had it work, because otherwise you wouldn't know for sure it was a solution. I've used both the hidden window and the GIT solution, so I may be able to answer any more specific questions you might have about them. In general, using multiple threads well will require lots of studying and lots of practice. There are probably articles on CodeProject that can tell you a lot about it. Nathan

    ATL / WTL / STL c++ help com debugging announcement

  • Programmatic send copy command (CTRL+C)
    N Nathan Holt at EMOM

    yytg wrote:

    I tried to imitate the function DoEvents as so

    yytg wrote:

    But when I call the functions - it's not working... How do I do it in C++

    I've had a need to implement DoEvents in C++ myself, and wrote something that works. Here is what I came up with.

    namespace
    {
        void DoEventsPumpMessage()
        {
            CWinThread *pThread = AfxGetThread();
            if( !pThread->PumpMessage() )
            {
                int nResult = (int)AfxGetCurrentMessage()->wParam;  // value from PostQuitMessage
                ::PostQuitMessage(nResult);        // so the main message loop will get it.
                TRACE("DoEvents Received quit message\n");
                CQuitMessageException::Throw();
            }
        }
    }
    
    void DoEvents( bool bAtLeastOne )
    {
        if( bAtLeastOne )
        {
            DoEventsPumpMessage();
        }
    
        MSG message;
        while( ::PeekMessage( &message, NULL, 0, 0, PM_NOREMOVE ) )
        {
            DoEventsPumpMessage();
        }
    }
    

    Many message loops I've seen just assume there won't be a quit message, but in my case, I really wanted to avoid runaway background threads. Nathan

    C / C++ / MFC c++ html com question

  • How to run another object from another project
    N Nathan Holt at EMOM

    kanekcwu wrote:

    Both of my projects areMFC

    I assume that you mean MFC executable projects, as opposed to MFC extension dlls. I have never used MFC automation, but I think you can use that to make methods in one executable callable. Another possibility would be to convert one of your projects to an MFC extension dll project (which has some issues), or an ATL project (which would provide much better automation support than MFC). Nathan

    C / C++ / MFC question tutorial

  • Problem with "ActivationContext" and multithreading
    N Nathan Holt at EMOM

    Jürgen Jung wrote:

    I have an application(MFC), which should work with some "registration-free" com-components. I have extended the the application manifest and created a "com-manifest", as shown in the ms-examples. Everything works fine. BUT, one of my menuitems starts a userthread which needs one of the "registration-free" com-components, an ocx. The creation of the component succeeeds, but the QuickActivate() fails with an access violation. Some ideas what goes wrong? Hoping for help, thank you.

    A .ocx file sounds like an ActiveX control dll, and ActiveX controls can only run in the user interface thread. It seems likely that whatever object you need to access would need special thread safety additions. If the component you need is itself an ActiveX control, then your problem is more difficuld. You can either find some way to get the control accessed from the UI thread, or you could factor out whatever you need access to into a thread safe component. Nathan

    COM help c++ com question

  • How to use multi byte character set in vs2008 ATL
    N Nathan Holt at EMOM

    Robe wrote:

    when create atl project, then set multi-byte character, compile, I got error: DllInstall: error C2440: 'initializing' : cannot convert from 'const char [5]' to 'const wchar_t []'

    Another way to solve your problem would be to use the system function MultibyteToWideChar to convert your message to unicode when you call DllInstall. (If you're in charge of calling it, that is.) The other solution I can think of would be to just use a unicode project, depending on how much you would have to change for it. Nathan

    ATL / WTL / STL c++ help tutorial question

  • VB Client Crashes while using ATL COM build in C++
    N Nathan Holt at EMOM

    garammasala wrote:

    My VB Client using ATL COM works fine while running under Debug mode but in the release mode it gets crashed as ATL COM tries to fire event to the VB Client

    Do you have any code you depend on inside an ATLASSERT statement? These are removed in release builds. Another possibility is that the optomizer is breaking something. You may want to create a release build with debug information so that you can step through the code the compiler is actually generating for the release build. Also, unrelated to your problem, it looks to me like g_pTestATL and g_CallMonitor could be static member variables of CTest_ATL. Nathan

    ATL / WTL / STL c++ help com debugging announcement

  • error MIDL2025 : syntax error
    N Nathan Holt at EMOM

    Ganesh_T wrote:

    But while comiling getting an error error as: D:\Work_ganesh\MPlusSrvOpticalDevice\Work In Progress\Ganesh\Samples\DemoCOM\DemoCOM.idl(18):error MIDL2025 : syntax error : expecting a type specification near "IMyInterface1" D:\Work_ganesh\MPlusSrvOpticalDevice\Work In Progress\Ganesh\Samples\DemoCOM\DemoCOM.idl(18) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation Error executing midl.exe.

    Could you post the actual idl code? That would tell me much more about what went wrong. Nathan

    ATL / WTL / STL help c++ com

  • How to run another object from another project
    N Nathan Holt at EMOM

    kanekcwu wrote:

    So I am using the solution Explorer and I link two projects together. The question I want to ask is how do I run an object that is created from my second project on my first project? Is there any easy way to do that using include? I tried looking through the microsoft library on Project Dependencies but I am still confused. Thanks

    The answer depends on what kind of projects you are using. It's easiest if you are using an object in a static library. Then you need to use the include files from the library project and link the library into the calling project. With other kinds of projects, it becomes more complicated. Could you explain in more detail? Nathan

    C / C++ / MFC question tutorial

  • where is the type library for IDataObject ?
    N Nathan Holt at EMOM

    Vlasta_ wrote:

    Why do I need it: I have my own interface with IDataObject as an argument of one of its methods. The type library compiled from that .idl contains beside my own interface also IDataObject and a couple of others, which are referenced by it. As a consequence, the proxy for that interface is wrong and drag and drop stops functioning in my app . I tried to find a type library to put in importlib("") statement, but did not find it. There must be something obvious I am overlooking.

    I can think of a couple other options. One is to provide custom marshaling for your method. Another is to just pass an IUnknown and query for IDataObject in your code. I tried to find the tlb for IDataObject and I couldn't find it either. Nathan

    COM com question

  • Is it good to use ref Parameter with a COM Method in C#
    N Nathan Holt at EMOM

    madhankum wrote:

    Using C#, a COM Method uses ref Parameter and it works smoothly, But is it a good principle to use ref Parameters with COM Methods,

    That depends on what type you are referencing. Also, are you calling from C# to COM, or from COM to C#? Either way, is it possible for the data type you are referencing to chang on one side, but not the other? Nathan

    COM csharp com

  • Getting E_ACCESSDENIED when calling IPersistFile:Save
    N Nathan Holt at EMOM

    TClarke wrote:

    I'm calling IPersistFile:Save on my local machine logged in with administrator rights and I'm getting a security error any ideas would be very welcome. I'm using VS2005 on XP SP2

    Since it is a security error, I think it is important to know where you are saving to. Even as an administrator, there are parts of the system you aren't allowed to modify. Nathan

    COM database visual-studio security help announcement

  • can anybody tell me how i can call a vb activex dll from c++
    N Nathan Holt at EMOM

    philiptabraham wrote:

    can anybody tell me how i can call a vb activex dll from c++

    Find the physical location of the VB file on the disk and use the #import directive to get the declarations into your program. I think if you use a recent enough version of Visual C++, you can #import by lib id. Nathan

    C / C++ / MFC c++ com

  • Need some clarification
    N Nathan Holt at EMOM

    CPallini wrote:

    Does Linux support COM?

    Not as such. However the OP only needed it for his Windows UI. The Mozilla group did create a cross platform version of COM called XPCOM, which does work on linux. Nathan

    COM question csharp c++ com graphics

  • Need some clarification
    N Nathan Holt at EMOM

    Karl Hansson wrote:

    Thanks Nathan. Do you know of any good COM books to read then? Karl

    I learned a bit from Inside COM by Dale Rogerson, but mostly, I studied the MSDN library, particularly the COM section and the Visual Studio section. In Visual Studio, the compiler COM support classes are good if you're just using COM objects. ATL is better for making them. Nathan

    COM question csharp c++ com graphics

  • Need some clarification
    N Nathan Holt at EMOM

    Karl Hansson wrote:

    Hello Im new to this place and quite new to windows programming. I want to start to program with directx and I have read somewhere that you'll need to understand COM programming. And I also read somewhere that COM is getting replaced by .NET. Is it better then to learn .NET instead of COM? Or is it better to stick with COM? What is the difference between COM and .NET anyways? I'll be programming in C++ as I want parts of my application to be portable to linux. Will it be a problem to use C++ with .NET? Thanks Karl

    If you're using C++ for portability to linux, COM sounds like your best bet. COM provides a binery standard for using native code. .NET is based on a pcode system that is intended to be portable among windows systems. Nathan

    COM question csharp c++ com graphics

  • Zooming a selected point of an Bitmap Image using MFC and OpenGL
    N Nathan Holt at EMOM

    jagannathan thiruvengadathan wrote:

    Hello I have developed an application, which load the Bitmap Image as texture using openGL. My question is, how to zoom a particular point of an image when i click using the mouse left button. Will any body help by providing the suitable source code or Link , so that it help me a lot I am using VC++ ( MFC's MDI ) and OpenGL . Regards Jagannathan

    I had a similar problem when writing Clear Focus. I had to write code to reverse the OpenGL transform to convert a point on the screen to a ray in the 3D model. Then I used simple ray tracing to find which point on the 3D model I was pointing to. It helped to provide a marker object (in my case, just a glPoint) that always follows the mouse pointer so that you can see which point you'll be clicking. Nathan

    C / C++ / MFC c++ graphics game-dev help tutorial

  • about the dll and lib
    N Nathan Holt at EMOM

    wendyyue wrote:

    in a source file(.cpp and .h), how can I know it call the dll? if it calls the dll, how can I make it call the static lib instead of dll, can anyone give me specific instruction about this topic?

    The calling of a lib or dll is determined at link time. If you link with the dll's import library, the code will call the dll. If you link with the static library, your code will call that. Nathan

    C / C++ / MFC question c++

  • Accessing a method in the Dlg object from the App object.
    N Nathan Holt at EMOM

    LCI wrote:

    I have an MFC Dlg Application. Say the project is called Test. Visual Studio creates a TestDlg.cpp and a Test.cpp among others. I am finding that some initialization that i need to do in the Test.cpp involves me having to have access to a variable in the TestDlg.cpp. I cannot do a static cast of the TestDlg.cpp can I?

    I would add a CTestDlg member variable to CTestApp and change InitInstance to use that instead of one local to InitInstance. Nathan

    C / C++ / MFC c++ csharp visual-studio question

  • [RESOLVED]: Compile Error during project conversion from VC++6.0 to VC++ 2005 [modified]
    N Nathan Holt at EMOM

    Priya_Sundar wrote:

    Yes it did resolve my error. But now i am getting a warning. "warning C4310: cast truncates constant value" I need to assign a value between 0 - 127 to resolve the warning. But since the val for 0xb6 is 182, will i not be able to eliminate this warning? Any suggestions? Priya Sundar

    The actual range of acceptable values should be -128 to 127, and I think 0xB6 maps to -74. However, I think unsigned char is the right type for what you are doing, and CString requiring a signed character poses a problem. You may be able to use a string "\xB6" instead of a character to initialize the CString. Nathan

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

  • Don't have an account? Register

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