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
A

Andraw Tang

@Andraw Tang
About
Posts
133
Topics
40
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to update the Document generated by server COleServerDoc
    A Andraw Tang

    Hi, dear all, Maybe my title make you confused, but I really don't know how to express it. The project was created by other people before, inside the project there is a server called XXXX which inherite from COleServerDoc class. There are two containers that invoke the methods in the sever. Everything works fine. Until now, before it only handle 4 types of materials, now it needs to handle 8 types of mateials, so I need to modify the server, otherwise it will cause array overflow. I modify the server and compile it, but when I run the container program, I still get the material overflow error, it totally didn't use the latest server I just compiled. I check the container project and find it invode the server use the code: CreateDispatch(_T("XXXX.Document")), then I got to the Registry editor and find it was registered there before. So even I modify the server and recompile it, but the registered XXXX .Document is not updated, what should I do? how can I make the container project call my latest server? Thank you very much!

    C / C++ / MFC question sysadmin windows-admin docker data-structures

  • Project Converted From VS2003 to VS2008, get exception when call dialog.doModal
    A Andraw Tang

    I told you everything works fine in VS2003. Also in VS2008 Release mode. Yes,my dialog inherits from Dialog class, and in instructor, I do something like the following:

    CEditDlg::CEditDlg( System::Object * mainApp, NCGenericCompont* pCompont, UINT menuSel, CString type,CWnd* pParent /*=NULL*/)
    : CDialog(CEditDlg::IDD, pParent)

    The codes should have no problem, the problem should be it cannot locates the resource file, there are a lots of people ask this questions about this in internet, but seems cannot find answer.

    Managed C++/CLI help c++ tutorial question

  • Project Converted From VS2003 to VS2008, get exception when call dialog.doModal
    A Andraw Tang

    CEditDlg *m_editDlg = new CEditDlg(this,propComp,propComp->Getbitmap(), propComp->GetType(),pWnd);
    m_editDlg->SetEditComp(propComp);
    m_editDlg->DoModal();

    Error happens when call DoModal(). I debug inside the codes and see the error occurs becuase afxCurrentResourceHandle is NULL. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle() { ASSERT(afxCurrentResourceHandle != NULL); return afxCurrentResourceHandle; } It seems the resouce doesn't attache to the project, right, how can I solve it?

    Managed C++/CLI help c++ tutorial question

  • Project Converted From VS2003 to VS2008, get exception when call dialog.doModal
    A Andraw Tang

    Hi, dear all, I have a C++ project created in VS2003, now I convert it to VS2008, after fix some compile errors and setting change, it compiles ok and can be started. This project application is an EXE file, not DLL file. When I create a dialog object and call dlg.doModal(), get afxwin1.inl ASSERT error in AfxGetResourceHandle(). But the project works fine in VS2003. Can anybody tell me what causes this issue and how to fix it? Thanks!

    Managed C++/CLI help c++ tutorial question

  • Resource Issue after Convert C++ program from VS 2003 to VS2008
    A Andraw Tang

    Thanks everybody, my problem is solved. it's the problem of path setting for .resx file.

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

  • Resource Issue after Convert C++ program from VS 2003 to VS2008
    A Andraw Tang

    Thanks for reply, The error message is: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "XXXXXApp.resources" was correctly embedded or linked into assembly "ProjeceName" at compile time, or that all the satelite assemblies requried are loadable and fully signed How can I check it? is XXXXXApp.resources a physical file? I cannot see it?

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

  • Resource Issue after Convert C++ program from VS 2003 to VS2008
    A Andraw Tang

    Hi, dear all, I have a C++ project created in VS2003, now I need to create another project based on it, but need VS2008. I open this project from VS2008, and the system did some conversion for it. After did some small change about it, the project can be built in VS2008, but when I run it, get exception. For example, my application class named as XXXXXApp (file name is XXXXXApp.cpp), the resurece file name as XXXXXAPP**.resx**. System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(SHXStiffLibNet::SHXStiffLibApp)); this->AppImageList->ImageStream = (__try_cast(resources->GetObject(S"AppImageList.ImageStream"))); the GetObject() call causes the error. I open the .resx file and I can see the "AppImageList.ImageStream" node is there, but why cause exception? Thanks!

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

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Thanks, David. After I remove calling WaitForExit() and ReadToEnd(), the progressbar works now, but the Exited event function OnProcesited is not called, so the progressbar is always shown. How can I make OnProcesited() be called?

    Private Sub OnProcesited(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim p As System.Diagnostics.Process
    p = sender

        Dim rtnStr As String = String.Empty
        rtnStr = p.StandardOutput.ReadToEnd()
    
        If rtnStr.Contains(" FAST terminated normally.") = True Then
            rtnStr = rtnStr & vbCrLf & "Please click Postprocess -> View Output File in menu to view the file."
            updateViewMenu()
        End If
        progBarFrm.Close()
        progBarFrm.Dispose()
    
        Dim frm As New FormShowFASTResult
        frm.txtFASTResult.Text = rtnStr
        frm.Button1.Select()
        frm.ShowDialog()
    
    End Sub
    
    
    Private Sub Run\_Tool()
    
        Dim sAppPath As String = ".\\XXXXX.exe"
        Dim fileName As String = "XXXXX.txt"
        Dim p As New System.Diagnostics.Process()
    
    
    
        p.StartInfo.FileName = Application.StartupPath & "\\" & sAppPath
        p.StartInfo.Arguments = fileName
    
        'Do not use the system shell to start the program this is so we can hide the command dos window
        p.StartInfo.UseShellExecute = False
        p.StartInfo.WorkingDirectory = strOutputFilePath
        ' Show no dos window if false
        p.StartInfo.CreateNoWindow = True
        p.StartInfo.RedirectStandardOutput = True
        p.EnableRaisingEvents = True
        AddHandler p.Exited, AddressOf OnProcesited
    
    
        progBarFrm = New FormProgressBar
    
        Try
            p.Start()
    
            progBarFrm.Show()
            progBarFrm.Refresh()            
        Catch ex As Exception
            ShowValidationMessage("Unexception error is caught, please close and try again.", "Error")
            
            Return
        End Try    
    

    End Sub

    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    If I don't start the process, the progressbar in the form works fine. So the p.Start action hang the progressbar form.

     Private Sub Run\_FAST\_Tool()
    
        Dim sAppPath As String = ".\\FAST.exe"
        Dim fileName As String = objFASTPrimaryData.FASTPrimaryFileName\_FST
        Dim p As New System.Diagnostics.Process()
    
        Dim rtnStr As String = String.Empty
    
        p.StartInfo.FileName = Application.StartupPath & "\\" & sAppPath
        p.StartInfo.Arguments = fileName
    
        'Do not use the system shell to start the program this is so we can hide the command dos window
        p.StartInfo.UseShellExecute = False
        p.StartInfo.WorkingDirectory = strOutputFilePath
        ' Show no dos window if false
        p.StartInfo.CreateNoWindow = True
        p.StartInfo.RedirectStandardOutput = True
    
        Dim progBarFrm As New FormProgressBar
        progBarFrm.Show()
    end sub
    
    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Sorry calculation error, I already comment out that line. Now I modify the source codes, also remove the event. When "Run" menu is clicked, it will call Run_Tool() inside which it start a precess and open a form, I also show the codes for progressbar form below, but the progressbar color is grayed, no value is shown. Would you please take a look where is wrong? thanks!

      Private Sub Run\_Tool()
    
        Dim sAppPath As String = ".\\xxxx.exe"
        Dim fileName As String = "XXXXXX.TXT"
        Dim p As New System.Diagnostics.Process()
    
        Dim rtnStr As String = String.Empty
    
        p.StartInfo.FileName = Application.StartupPath & "\\" & sAppPath
        p.StartInfo.Arguments = fileName
    
        'Do not use the system shell to start the program this is so we can hide the command dos window
        p.StartInfo.UseShellExecute = False
        p.StartInfo.WorkingDirectory = strOutputFilePath
        ' Show no dos window if false
        p.StartInfo.CreateNoWindow = True
        p.StartInfo.RedirectStandardOutput = True
    
        Dim progBarFrm As New FormProgressBar
        progBarFrm.Show()
    
    
        Try
            p.Start()
        Catch ex As Exception
            ShowValidationMessage("Unexception error is caught, please close and try again.", "Error")
            'p.Kill()
            progBarFrm.Close()
            Return
        End Try
    
    
        rtnStr = p.StandardOutput.ReadToEnd()
    
        ''p.WaitForExit(120000)   '= 1.5 min: 1000 millisecond = 1 second
        ' if the process doesn't complete within 5400 seconds, kill it
        ''If Not p.HasExited Then
        ''p.Kill()
        ''End If
    
        If rtnStr.Contains(" FAST terminated normally.") = True Then
            rtnStr = rtnStr & vbCrLf & "Please click Postprocess -> View Output File in menu to view the file."
            updateViewMenu()
        End If
        progBarFrm.Close()
    
        Dim frm As New FormShowFASTResult
        frm.txtFASTResult.Text = rtnStr
        frm.Button1.Select()
        frm.ShowDialog()      
    
    End Sub
    

    Source code for the progressbar form as the following

    Public Class FormProgressBar

    Private Sub FormProgressBar\_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        Timer1.Stop()
    End Sub
    
    
    
    Private Sub FormProgressBar\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CenterToScreen()
        ProgressBar1.Mi
    
    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Progressbar value should be updated using timer inside the form, after call SHOW of the form, the timer will be started, sure you cannot see these codes from inside the function which create the form.

    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    That's the whole codes when "Run" is clicked. Yes, I need to waiting for the process to exit, I need to get the return string and display them in the form. That's why I use p.WaitForExit(5400000). But use p.WaitForExit(5400000) will hang progressbar form, if don;t use p.WaitForExit(5400000), when should I close the progressbar form?

     Private Sub OnProcesited(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim p As System.Diagnostics.Process
        p = sender
    
        Dim rtnStr As String = String.Empty
        **rtnStr = p.StandardOutput.ReadToEnd()**
    
        If rtnStr.Contains(" FAST terminated normally.") = True Then
            rtnStr = rtnStr & vbCrLf & "Please click Postprocess -> View Output File in menu to view the file."
            updateViewMenu()
        End If
        '''progBarFrm.Close()
        '''progBarFrm.Dispose()
        **
        Dim frm As New FormShowFASTResult
        frm.txtFASTResult.Text = rtnStr
        frm.Button1.Select()
        frm.ShowDialog()**
      End Sub
    
    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    I found only if I clearly call p.Kill(), the Exited event will be triggered, but when I should call the .Kill() for a process? if I use p.WaitForExit(5400000), the program will be hanged to wait for process to exit, the progressbar form will be hanged.

    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    I thought I already give all the information needed. The Run_Tool() will be called when user click "Run" item in the menu. Inside Run_Tool(), a process will be created to run an exe file, at the same time, a form with progress bar will be created and displayed (let's forget about the progress bar value at this time), I also add an event Exited for the procee, when the event is called, close the form with progress bar, that's it. Now the problem is that the Exited event is never called, so form progBarFrm is never closed.

     Dim progBarFrm as FormProgressBar
    
     Private Sub OnProcesited(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim p As System.Diagnostics.Process
        p = sender
    
        progBarFrm.Close()
        progBarFrm.Dispose()
    
      
    End Sub
    
    
    Private Sub Run\_Tool()
    
        Dim sAppPath As String = ".\\XXXX.exe"
        Dim fileName As String = "DDDDDDDDDDDDDDDD.txt"
        Dim p As New System.Diagnostics.Process()
    
    
    
        p.StartInfo.FileName = Application.StartupPath & "\\" & sAppPath
        p.StartInfo.Arguments = fileName
    
        'Do not use the system shell to start the program this is so we can hide the command dos window
        p.StartInfo.UseShellExecute = False
        p.StartInfo.WorkingDirectory = strOutputFilePath
        ' Show no dos window if false
        p.StartInfo.CreateNoWindow = True
        p.StartInfo.RedirectStandardOutput = True
        p.EnableRaisingEvents = True
        AddHandler p.Exited, AddressOf OnProcesited
    
    
        progBarFrm = New FormProgressBar
    
        Try
            p.Start()
    
            progBarFrm.Show()
            progBarFrm.Refresh()
    
        Catch ex As Exception
            ShowValidationMessage("Unexception error is caught, please close and try again.", "Error")
            'p.Kill()            
            Return
        End Try
    
    
    
    
        ''Shell(sAppPath, vbNormalFocus) 'other options for starting with
    
    End Sub
    

    modified on Tuesday, May 24, 2011 2:21 PM

    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Thanks for reply, I modify the code, but still don't work

    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Hi, Now I modify the code to as the following, but OnProcesited is never called, why?????

    Dim progBarFrm as New FormProgressBar
    
    Private Sub Run\_Tool()
    
        Dim sAppPath As String = ".\\XXXX.exe"
        Dim fileName As String = "xxxxxxxxxxxx"
        Dim p As New System.Diagnostics.Process()  
    
    
        progBarFrm = New FormProgressBar
    
        Try
            p.Start()
            p.EnableRaisingEvents = True
            AddHandler p.Exited, AddressOf OnProcesited
    
            progBarFrm.Show()
            progBarFrm.Refresh()
    
        Catch ex As Exception
            ShowValidationMessage("Unexception error is caught, please close and try again.", "Error")          
            Return
        End Try
    
    
    
    
        ''Shell(sAppPath, vbNormalFocus) 'other options for starting with
    
    End Sub
    Private Sub OnProcesited(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim p As System.Diagnostics.Process
        p = sender
    
        progBarFrm.Close()
        progBarFrm.Dispose()        
    End Sub
    
    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Davd and Luc, Thanks for your reply. Acutally my code is like the following, I didn't use thread, I am not familiar with it.

        Dim progBarFrm As New FormProgressBar
        progBarFrm.Show()
    
        try
            p.Start()
        Catch ex As Exception
            ShowValidationMessage("Unexception error is caught, please close WinTAP and try again.", "Error")
            progBarFrm.Close()
            Return
        End Try
    
    
        rtnStr = p.StandardOutput.ReadToEnd()
    
        p.WaitForExit(5400000)       
        If Not p.HasExited Then
            p.Kill()
        End If
    
        progBarFrm.Close()
    
    Visual Basic csharp linux question

  • VB.NET Progress status while run a EXE file
    A Andraw Tang

    Hi, I have a project created using vb.net 2005. I need to collect data and generate a input file for a EXE file which will take 2 min to execute the exe file. I also create a form with progressbar and Stop button, since I cannot get status of the EXE file, I just set the value of the progressbar from 1 ~ 100 then repeat. codes as the following Dim p As New System.Diagnostics.Process() p.StartInfo.FileName = Application.StartupPath & "\" & sAppPath p.StartInfo.Arguments = fileName 'Do not use the system shell to start the program this is so we can hide the command dos window p.StartInfo.UseShellExecute = False p.StartInfo.WorkingDirectory = strOutputFilePath ' Show no dos window if false p.StartInfo.CreateNoWindow = True p.StartInfo.RedirectStandardOutput = True Dim progBarFrm As New FormProgressBar progBarFrm.Show() p.Start '''''''''''''' But when I run the above code, the progressbar value doesn't change. But if I comment out p.Start line, the progressbar works fine. How can I show the progressbar while the process is running, if you have some sample, that's best. Thanks!

    Visual Basic csharp linux question

  • Align Long String in DataGridView Cell to Show String End
    A Andraw Tang

    Luc, Thanks for give me the good suggestion.

    Visual Basic question csharp

  • Align Long String in DataGridView Cell to Show String End
    A Andraw Tang

    Dave, Thanks for reply, The file path string is just for display purpose.

    Visual Basic question csharp
  • Login

  • Don't have an account? Register

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