CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Aug 2011
    Posts
    21

    is it different to put the function in different place?

    Hi all ,
    I have written a program ,I want to realize the two different functions in respective Menu lists in MFC.one menu is "Init" to initiate the instrument ,the other is "zernike" to calculate something .
    there is nothing wrong after compiling , but the result is different when I put the code in the two menu response functions. in fact if I put them in either "oninit()"or "onzernike()", I can get the result I want , but then the two different functions mixed together.if I put the corresponding part of the code in each responding function . nothing is wrong with compiling. but the result is strange when execute .
    part of the code:
    Code:
    void CTest1View::OnInit() 
    {
       .....
       if(err = WFS_GetMlaCount (instr.handle, &instr.mla_cnt))
    		handle_errors(err);
      ....
    }
    
    void CTest1View::OnZernike() 
    {
       ......
      if(err = WFS_CalcBeamCentroidDia (instr.handle, &beam_centroid_x))
          handle_errors(err);
       ......
    }

    in the above code, instr is an object of a class I defined to put some variables. I define the object in C**view,public, why the result is different when the code is like this:
    Code:
    void CTest1View::OnInit() 
    {
       .....
       if(err = WFS_GetMlaCount (instr.handle, &instr.mla_cnt))
    		handle_errors(err);
      ....
        if(err = WFS_CalcBeamCentroidDia (instr.handle, &beam_centroid_x))
          handle_errors(err);
       ......
    }
    Last edited by Angela2010; September 8th, 2011 at 08:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured