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
T

theFrenchHornet

@theFrenchHornet
About
Posts
49
Topics
20
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to set breakpoint to step through CTabCtrl draw ... [modified]
    T theFrenchHornet

    I'd like to step through the Microsoft code for dawing a CTabCtrl. In winctrl2.cpp, CTabCtrl::DrawItem consists only of ASSERT (FALSE); When I put a breakpoint here, it is not hit. If I put a break at CWnd::OnDrawItem it is hit, but stepping through doesn't land in the drawing code, and I don't know where to put a break to see the code that does the computations for the drawing. Can you tell me how to set a breakpoint so I can step through this code? Thanks.

    modified on Thursday, May 20, 2010 6:05 PM

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

  • Debugging null data adapter
    T theFrenchHornet

    PIEBALDconsult, Please see my response to Mika, and yes, if it gets revisted and I am involved in the revisit, I will look at the threading and try to get it narrowed down more. The code sits on an isolated system and is too complicated to reproduce here. The data adapter code is quite simple, but I think we're all agreed that that's probably just where another problem is manifesting itself. Thanks for your input.

    Database database csharp sql-server sysadmin question

  • Debugging null data adapter
    T theFrenchHornet

    Thanks Mika, It is the last bit about the trace flag that I was looking for. Setting it I believe requires access to the server machine which I don't have, but the person who does says they can help me do this next week and he thinks he knows how to set a trace. Maybe more information than you are interested in, but since you put so much time in, don't want you to think I was ignoring your ideas. This was a situation of you have today to figure it out and then things are moving on and you need to be working on something else. Not to say it won't get revisited, but these are decisions made 'above' me. The null data adapter came about after code was introduced to allow for possible deadlock. It is most likely a case of interference/timing - something hasn't been thought through well enough for when multiple clients are running at the same time. Removing some functionality removed the deadlock problem and thus the need for the code that caused the null data adapter. Other people were looking into it from the C# side, and I was just asked to help if I could. I knew you could query the database for number of deadlocks and I had the permissions to do this. I thought if it was possible that the database could give any information, then it might at least be a clue for where to look. Now I will know about the database trace flag - it will come in handy at some point. Thanks.

    Database database csharp sql-server sysadmin question

  • Debugging null data adapter
    T theFrenchHornet

    Thanks for the suggestions, Mika. By station I meant client. Via Debug/Exceptions is how null data adapter was determined. Adapter is instantiated on startup and disposed of when application quits - isolated in one class. Pretty simple in that respect. Agree it might be caused in some other area - since it happens sporadically and has been hard to pinpoint using the debugger, was just wanting to try another avenue. I was hoping the database might keep something like a 'last error' the way it tracks number of deadlocks. Have found a way around it for the time being. Thanks again ...

    Database database csharp sql-server sysadmin question

  • Debugging null data adapter
    T theFrenchHornet

    using C# and SQL Server 2005 Instantiate a data adapter on startup and re-use. No problems when 1 station running. When a number of stations running at the same time, data adapter goes null in the middle of the operation. i.e., It deletes some records from the database as it is supposed to do, but then goes null. Is there some way to query the database to get more information on why this is happening? Any debugging ideas? I don't have much experience with SQL Server, so if you have an idea please give me the specifics. Thanks.

    Database database csharp sql-server sysadmin question

  • OpenIcon not restoring window to former size
    T theFrenchHornet

    The documentation for OpenIcon says that it will restore a window to its previous size and location. This isn't happening - it is restoring the window but not to its previous size. Is there something extra that needs to be done when calling it from C#? The ReturnValue indicates success. [DllImport("user32.dll")] static extern bool OpenIcon(IntPtr hwnd); ... IntPtr wHandle = process.MainWindowHandle; bool ReturnValue = OpenIcon (wHandle);

    C# csharp question

  • Determining when application is running in debug mode
    T theFrenchHornet

    Your idea of getting the main window helped. Thanks.

    C# visual-studio question csharp hosting debugging

  • Determining when application is running in debug mode
    T theFrenchHornet

    Evidently, there is no easy way to access the same information as that in the applications tab of the task manager the way one can easily access the same information as that in the processes tab. Or, if there is, it isn't obvious to any of us. Instead, I used the method below (resulted from suggestion by Luc Pattyn) to determine whether the IDE simply had the application open or was running it. Note - non-relevant portions of code omitted (the ...'s).

    const string IDE_INDICATOR = ".vshost";
    Process current = Process.GetCurrentProcess();
    string IDE_Name;

    ...

    if (current.ProcessName.Contains(IDE_INDICATOR))
    {
    IDE_Name = current.ProcessName;
    }
    else
    {
    IDE_Name = current.ProcessName + IDE_INDICATOR;
    }

    ... (looping through all processes)

    if (process.ProcessName == IDE_Name)
    {
    IntPtr WindowHandle = process.MainWindowHandle;
    if (WindowHandle != IntPtr.Zero)
    {
    // then application is being run by the IDE
    }
    else
    {
    // IDE is open with the application loaded, but not currently running it - at least not in debug mode,
    // and non-debug mode can be detected because it has its own process
    }
    }

    C# visual-studio question csharp hosting debugging

  • Determining when application is running in debug mode
    T theFrenchHornet

    The window title would work fine - doesn't need to correlate with the process name. I was searching for task manager before - I'll try your system tray idea - do seem to remember seeing some items on that. Will also look into your idea of vshost characteristics - thanks.

    C# visual-studio question csharp hosting debugging

  • Determining when application is running in debug mode
    T theFrenchHornet

    Thanks for the suggestions - don't think they will solve this problem. Yes, both cases are "debugging" but I specified I was interested in the case where vshosting is enabled because I can detect what I need to know in the case where it isn't. Environment.CommandLine won't tell me because it is another instance of the application that needs to know. I do not need to determine between debug and release versions. What will tell me what I need to know sits in the Applications tab of the Task Manager - do you know how to access that info? The other way I see is if there is some property of the vshost process which indicates whether it is running the application currently or not. Seemed easier to me if I could access the Applications tab of the task manager.

    C# visual-studio question csharp hosting debugging

  • Determining when application is running in debug mode
    T theFrenchHornet

    As far as I can tell, if the Visual Studio hosting process is enabled, then when Start Debugging is selected, no new process is added. If you look at the Task Manager Processes tab, you see xxx.vshost.exe when the IDE is open and still only see that when the application is being run (debugged). The place where you _can_ tell a difference is the Applications tab of the Task Manager. I know how to get the list of processes that show up in the task manager Processes tab. How do I get the list of applications that show up in the Applications tab? Thanks ...

    C# visual-studio question csharp hosting debugging

  • Window doesn't stay hidden
    T theFrenchHornet

    Fix turned out to be: Application.DoEvents(); Hide();

    C# database debugging question announcement

  • Window doesn't stay hidden
    T theFrenchHornet

    For this design, there is. Note that 'the boolean' is in ClassB - not FormC. FormC does know when it closes, but method1 has already finished its execution by this time. FormC alerts others to its closing via an event. ClassB sets the boolean based on this event. ClassA can now access the information via a property provided by ClassB. ClassB has visibility to FormC. FormA does not. Thus, FormA cannot ask FormC are you open or closed.

    C# database debugging question announcement

  • Window doesn't stay hidden
    T theFrenchHornet

    This is a very good theory - especially from the excerpt I put out. I had greatly simplified UserSelection_Click. The selection comes from a VS 2003 data grid - the code is determining a double click based on MouseUp, etc. Things stop, i.e., the clock doesn't start for a second double click, until method1 has completed, so I don't think this is exactly the problem. Maybe something similar to what you are describing is happening earlier in the pipe, though. I just haven't been able to find it yet. And, your code suggestion is good to put in as a fail-safe. If nothing else, if the problem pops up again with this code in, then it will narrow down the possibilities some more. Thanks.

    C# database debugging question announcement

  • Window doesn't stay hidden
    T theFrenchHornet

    I realize it is not valid C# code - I said it was a "Description" of the code. I did not put it in red as the code tag would do, and I mentioned that it works most of the time. If this were truly the 'code', it would not be compiling far less working most of the time. The true code has been executed by 11 people, 6 hours a day, for 2 years. In that time the error situation I am describing has occurred about 4 times. The code itself sits on another computer and is too voluminous to reproduce here. This is not a syntax problem. If someone is on the level where they could answer this question, I think they are at the level they can fill in the blanks in the outline and perfect C# is not needed. I don't know what you mean by side-by-side and what that has to do with how code executes. The 3 items you mention serve different purposes. m_FormC is the class itself. m_FormCOpen is the boolean that tracks whether the form is dipslayed or not. Remember, the class can be instantiated but the form not necessarily displayed at a given time. FormCIsOpen is the property which allows other classes access to the member variable m_FormCOpen. Thus, you see, there are not several bools that try to keep track - there is only one. There are reasons why one class displays the form and another needs to know if it is displayed or not. The question is, that being the case, is there a safer way to accomplish it. Or, is there a known Windows/.NET problem where forms in hiding suddenly come out of hiding. You haven't given a meaningful alternative or any explanation for why the methodology here would fail. My impression is you were too quick to respond. Slow down. If you don't want to take the time to understand something that isn't immediately obvious to you, it would be better to not respond at all than to do so in a nonconstructive manner. Saying the code is a complete mess is not constructive. Confusing a class with a bool with a property is not constructive. But, if you were truly trying to be helpful, then thanks for taking the time. ;)

    C# database debugging question announcement

  • Window doesn't stay hidden
    T theFrenchHornet

    I have the situation where Form A is hidden when Form C is displayed and then when Form C is closed, Form A is displayed again. Almost all of the time it works as expected. Occasionally, though, both forms are seen displayed at the same time. For the most part, no one can tell me the steps they went through when it happens. It has been witnessed mostly in debug mode. The one time it happened in release mode was also the one time we knew the steps that led it to happen - a test procedure was being run. However, when the test procedure was repeated at a later date the 2 windows were correctly mutually exclusive. Any ideas? Description of the code: When ClassB is instantiated, it sets the member variable m_FormCOpen = false. Later, upon user selection, FormA will call method1 in ClassB. method1 instantiates FormC, subscribes to the closed event for FormC, sets m_FormCOpen = true, displays FormC, does some database updating, and returns. The method in FormA checks the property for m_FormCOpen and if it is true, hides FormA. The method in ClassB that is executed when FormC closes, triggers an event to which FormA has subscribed, and FormA is displayed.

    public class FormA
    {
    public FormA (ClassB)
    {
    m_ClassB = ClassB;
    }

    private void ClassA_Load ()
    {
    subscribe to ClassB ClosedFormC – routine to call: ClassB_ClosedFormC.
    }

    private void UserSelection_Click()
    {
    m_ClassB.method1();
    If FormCIsOpen
    {
    Hide();
    }
    }

    ClassB_ClosedFormC()
    {
    Show();
    }
    } // end of ClassA

    public class ClassB
    {
    public void ClassB()
    {
    m_FormCOpen = false;
    }

    public void method1()
    {
    FormC m_FormC = new FormC();
    subscribe to FormC.Closed – method to call FormC_Closed
    m_FormCOpen = true;
    m_FormC.Show();
    do some stuff
    }

    private void FormC_Closed
    {
    trigger ClosedFormC
    m_FormCOpen = false;
    }

    bool FormCIsOpen
    {
    get
    {
    return m_FormCOpen;
    }
    }
    }// end ClassB

    C# database debugging question announcement

  • How to send update text message with only standard windows library
    T theFrenchHornet

    Thank you, Prasad. Your method looks more intuitive.

    C / C++ / MFC question help tutorial announcement

  • How to send update text message with only standard windows library
    T theFrenchHornet

    Never mind. Figured it out.

    C / C++ / MFC question help tutorial announcement

  • How to send update text message with only standard windows library
    T theFrenchHornet

    Thank you, Mark. SetWindowText works. Can you tell me, if I used the WM_SETTEXT in a SendMessage, how would I specify the text?

    C / C++ / MFC question help tutorial announcement

  • How to send update text message with only standard windows library
    T theFrenchHornet

    I need to add a dialog to a project that only has available the Standard Windows Library. I am at the point where the dialog displays and the progress bar updates. I need to add changing the text in a Label. I don't know what command to send, and how to specify the text. The dialog is created with: HWND hwndProgressDialog = CreateDialog(hinstance, MAKEINTRESOURCE(IDD_DIALOG_EM), GetDesktopWindow(), EMProgressRoutine); Here is the code that updates the progress bar: hwndProgressBar = GetDlgItem(hwndProgressDialog, IDC_PROGRESS_EM); SendMessage(hwndProgressBar, PBM_SETPOS, (WPARAM)ProgressCount, 0); To update the lable text, I assume I get a handle to the Label ID in similar fashion and do another SendMessage. But, what is the comparable command to PBM_SETPOS for setting text and how to specify the text itself? Thanks for any help.

    C / C++ / MFC question help tutorial 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