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

Dave Bryant

@Dave Bryant
About
Posts
245
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Modal dialogs shown in the alt-tab window list
    D Dave Bryant

    I was thinking more along the lines of not showing the dialog in the alt-tab list in the first place, rather than preventing alt-tab use altogether - that would be extremely annoying to some people.

    Dave http://www.cloudsofheaven.org

    .NET (Core and Framework) csharp winforms help question

  • Modal dialogs shown in the alt-tab window list
    D Dave Bryant

    Hi all, I've got a C# WinForms application where the top-level form displays a modal dialog to allow the user to set some options. I create it very simply as follows:

    using (MyForm form = new MyForm())
    {
    form.ShowDialog(this);
    }

    I've turned off the ShowInTaskbar property for the dialog, so it doesn't show up in the taskbar. However, if you press Alt-Tab, it appears in the window list. That itself is not too much of a problem (it just looks bad and can be a little annoying if you're trying to switch between two apps). However, you can use Alt-Tab to switch back to the parent form even though it is currently showing the modal dialog. I'm unable to use the mouse to do anything with the parent form, BUT I can use keyboard accelerators to use menus on the parent form (with bad consequences). I've worked around this by explicitly disabling and enabling the parent form while displaying the dialog. So I have two questions: 1) Any ideas for how I can stop my modal dialog appearing in the Alt-Tab window list? I presume it appears there because it is a top-level form, but .NET doesn't seem to like showing non-top-level forms as modal dialogs. 2) Is the approach of disabling and enabling the parent the best approach here? Or am I just missing something obvious? Thanks, Dave

    Dave http://www.cloudsofheaven.org

    .NET (Core and Framework) csharp winforms help question

  • Problem using separate types linker option
    D Dave Bryant

    I have a set of C++ static libraries that is released as part of my product, and used by other developers to build their applications. Someone using these libraries is gettings an error linking in debug mode (missing debugging information for referencing module) which only occurs when the separate types linker option is turned off - when it is on the program links successfully. Does anyone know how to resolve this so that linking can still be done successfully in debug mode without having to use separate types? Do I need to distribute the .pdb files along with the static libraries or something like that? Dave http://www.cloudsofheaven.org

    C / C++ / MFC help c++ debugging tutorial question

  • assembly versioning
    D Dave Bryant

    My applications use a large number of components (DLLs and EXEs) which previously (using VC6.0) we built using a big build script, and then at the end we ran a program over all the modules which stamped them all with exactly the same version. This made it very easy to tell if a customer has a consistent version of all the components. Recently I've just created a .NET component that will be released with the rest of the applications. My question is: Is there any way to set the assembly version of an assembly that has already been generated? With the normal Win32 modules I can load then and then modify the resources using the appropriate APIs - but will this work for a .NET component - particularly since the version is part of the strong name of the component? Dave http://www.cloudsofheaven.org

    C# question csharp sales tools json

  • Does it have some memory leak?
    D Dave Bryant

    No - the array has been allocated on the stack, so there is no need to delete it (in fact deleting it is an error). Dave http://www.cloudsofheaven.org

    C / C++ / MFC c++ performance question

  • Change String Table ID
    D Dave Bryant

    Both VC 6.0 and 7.1 allow you to change the mnemonic (the IDS_... value) within the string table editor, and VC 7.1 also allows you to change the number that it is mapped to within the editor. I think for VC 6.0 you need to change the number within the resource.h file if you want to change the mapper resource number. Dave http://www.cloudsofheaven.org

    C / C++ / MFC question

  • IsWindow(m_hwnd) returns 0.
    D Dave Bryant

    Well that's your problem then. When mainfunc() terminates, your class will be destroyed, and so will the window. Then your other thread will be calling IsWindow() on a random piece of memory (the HWND has been destroyed, and so now is just a random number), so it will not work. You need to ensure that your class is not destroyed for the lifetime of the other thread. Dave http://www.cloudsofheaven.org

    C / C++ / MFC help question

  • Any Experts Like to Challange This Questions???
    D Dave Bryant

    The first three lines of the function, handle the case where the code is less than zero. According to MSDN for the get message hook, in that case we must immediately call CallNextHookEx() without doing anything else. Then we retrieve the MSG structure (which defines a windows message). It is stored in the lParam passed to our callback function (again details from MSDN - look up SetWindowsHookEx() and follow the link for the get message hook). Next we check that it is the WM_CHAR message - everything else we are ignoring. Once we have the WM_CHAR message, we know that the character is stored in the wParam of the message (check MSDN for WM_CHAR), and so can retrieve it from there. If we wanted to modify the character, then we just set the value of pMsg->wParam at this point. e.g. ... if ( 'A' == ch ) {   // Modify the character   pMsg->wParam = 0x1234; // Some random unicode character } ... Dave http://www.cloudsofheaven.org

    C / C++ / MFC tutorial question

  • IsWindow(m_hwnd) returns 0.
    D Dave Bryant

    The remarks in MSDN for IsWindow() actually say that a thread should not call IsWindow() for a window that it did not create because the window could be destroyed after the function is called - so that's not a promising start... Anyway, here's a couple of likely reasons for your problem: 1) Does the call to CreateWindow() succeed? If not, then obviously IsWindow() will not succeed either. 2) When does the window get destroyed? If it is destroyed in the MyClass destructor, then this will be called at the end of the scope of the MyClass object (since it is created on the stack). From the code snippet above, that means that it will be called when mainfunc() terminates, which, unless you have some sort of syncrhonisation, will be before your thread function terminates. Consequently, the window will be destroyed before the thread gets around to using it. Dave http://www.cloudsofheaven.org

    C / C++ / MFC help question

  • Any Experts Like to Challange This Questions???
    D Dave Bryant

    LRESULT CALLBACK MyGetMsgProc(int code, WPARAM wParam, LPARAM lParam) {   if ( code < 0 ) {     return ::CallNextHookEx( hHook, code, wParam, lParam );   }   MSG* pMsg = reinterpret_cast<MSG*>( lParam );   if ( WM_CHAR == pMsg->message ) {     TCHAR ch = static_cast<TCHAR>( pMsg->wParam );     // Do something with it   }   return ::CallNextHookEx( hHook, code, wParam, lParam ); } Dave http://www.cloudsofheaven.org

    C / C++ / MFC tutorial question

  • FILETIME compilation error
    D Dave Bryant

    Here's two options: 1) Qualify FILETIME as being in the global namespace as: ::FILETIME, so that the compiler knows you are not refering to the one in System::Runtime::InteropServices. 2) Instead of importing the entire InteropServices namespace, either qualify them explicitly, or just include the classes that you actually need (e.g. using System::Runtime::InteropServices::Blah). Dave http://www.cloudsofheaven.org

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

  • upgrading vc6 c++ project to .net
    D Dave Bryant

    Only if you turn on the /CLR compiler switch which generates managed rather than unmanaged code. Visual Studio .NET can still generate native windows executables (only using C++) that do not use the .NET framework. Dave http://www.cloudsofheaven.org

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

  • Moving Windows
    D Dave Bryant

    GetWindowRect() retrieves the window position in screen co-ordinates (i.e. 0,0 is the top-left corner of the screen. MoveWindow() moves the window to the specified client co-ordinates of its parent window (i.e. 0,0 is the top-left corner of the parent window). You need to peform a conversion between the screen and client co-ordinates before moving the window as follows: MyWindow->GetWindowRect( &WindowRect ); ScreenToClient( &WindowRect ); // Adjust the position here... MyWindow->MoveWindow( &WindowRect ); Dave http://www.cloudsofheaven.org

    C / C++ / MFC question help lounge

  • Passing a vector of pointers
    D Dave Bryant

    Since you are actually trying to use the vector as a vector (instead of just an array as you indicated in your previous message), you should pass a reference to the vector into the function. The last parameter should be: vector< PhoneRecord*>& records - then you will be able to use the push_back member. Dave http://www.cloudsofheaven.org

    C / C++ / MFC graphics help

  • Why do some API calls not work with my windows service?
    D Dave Bryant

    A little more information would be useful here... What do you mean when you say that you cannot use all the same API calls? Is it not compiling? Or not running? If it isn't running, what error is produced? What APIs aren't working? Dave http://www.cloudsofheaven.org

    C / C++ / MFC json help question

  • Passing a vector of pointers
    D Dave Bryant

    Try: addPhoneRecord( &phonerecs.front() ); Dave http://www.cloudsofheaven.org

    C / C++ / MFC graphics help

  • operator != for iterators
    D Dave Bryant

    I suspect it is because you are comparing an iterator with a const_iterator. Since the list passed in as a parameter is constant, it will only return a const_iterator, so you could either make the list non-cost, or pass in a const_iterator instead of an iterator as the first parameter (the better option as you do not appear to be modifying the list here). Alternatively, you could pass in the end iterator as a parameter rather than passing in the entire list - this is the approach used by STL, as then the type of container can be changed without modifying the function itself. Dave http://www.cloudsofheaven.org

    C / C++ / MFC help c++ tutorial question

  • operator != for iterators
    D Dave Bryant

    Can you please repost the code, using < and > for the angle brackets so that we can see the template parameters? Dave http://www.cloudsofheaven.org

    C / C++ / MFC help c++ tutorial question

  • Frustration levels mounting.
    D Dave Bryant

    I've got this a number of times when trying to use template functionality that isn't supported in VC6.0. In particular, whenever i've used a member function template, if i implemented it outside of the class definition (in a .inl file for eg) i would always get this problem - that one was resolved by moving the implementation into class itself. If you post the code, i might be able to help further, otherwise i would suggest selectively commenting stuff out until it compiles :-) Dave http://www.cloudsofheaven.org

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

  • Linked List Question
    D Dave Bryant

    I don't think there is any way you could 100% guarantee that a node passed to one of the member functions was valid. However, you could add an extra member to the NODE that was a pointer back to the linked list. This would reduce the chances of a node being passed in from another list, but even that is still not a guarantee that it is valid. Dave http://www.cloudsofheaven.org

    C / C++ / MFC question data-structures regex performance tutorial
  • Login

  • Don't have an account? Register

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