CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 35
  1. #16
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    ON_BN_CLICKED(IDC_READ, OnRead);

    BOOL CReadDBDlg::OnInitDialog()
    {

    }

    I want to call ON_BN_CLICKED in OnInitDialog() how to do that. It will be great full if code example mention

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Access database with MFC, vc++ 6.0

    Code:
    BOOL CReadDBDlg::OnInitDialog()
    {
         ...
         OnRead();
    }
    Victor Nijegorodov

  3. #18
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Access database with MFC, vc++ 6.0

    Look at the CRecordset class. It does almost all of the work for you.

  4. #19
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    ON_BN_CLICKED(IDC_READ, OnRead)

    This is my button click event I want to call it in OnInitDialog() Method

    BOOL CReadDBDlg2::OnInitDialog()

    How to do this?

  5. #20
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Access database with MFC, vc++ 6.0

    Quote Originally Posted by [email protected] View Post
    ON_BN_CLICKED(IDC_READ, OnRead)

    This is my button click event I want to call it in OnInitDialog() Method

    BOOL CReadDBDlg2::OnInitDialog()

    How to do this?
    I wonder, don't you read the answers to your previous questions?
    There is the post#17:

    Quote Originally Posted by VictorN View Post
    Code:
    BOOL CReadDBDlg::OnInitDialog()
    {
         ...
         OnRead();
    }
    Victor Nijegorodov

  6. #21
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    I want to call BN_CLICKED it self

  7. #22
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Access database with MFC, vc++ 6.0

    Quote Originally Posted by [email protected] View Post
    I want to call BN_CLICKED it self
    Why?
    Note that BN_CLICKED is just some UINT constant, ON_BN_CLICKED(IDC_READ, OnRead) is a macro that show the compiler what function must be called in response to the IDC_READ button click.

    So if don't want to call this function directly then you should simulate the button click sending the WM_COMMAND message with corresponding WPARAM and LPARAM. See https://msdn.microsoft.com/en-us/lib...or=-2147217396
    Victor Nijegorodov

  8. #23
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Access database with MFC, vc++ 6.0

    Dear [email protected],
    please, don't delete the posts that were already answered! Otherwise you will break the logic!
    Victor Nijegorodov

  9. #24
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    Quote Originally Posted by VictorN View Post
    Dear [email protected],
    please, don't delete the posts that were already answered! Otherwise you will break the logic!
    Actually I did not see answer and posted question also on second page. After I saw that that's why I delete it. Sorry for that Sir.

    Please mention a code for That BN_CLICKED(...) macro. to call in initDiaog() method

  10. #25
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Access database with MFC, vc++ 6.0

    Quote Originally Posted by [email protected] View Post
    Please mention a code for That BN_CLICKED(...) macro. to call in initDiaog() method
    See the post#17, post#23
    Victor Nijegorodov

  11. #26
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    Ok,

    How we can close the open dialogbox through code at runtime

  12. #27
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    I want to display Logo on my document like other data which I retrieve from database are store into variable and then those are passes to print on document. I am storing path of related bitmap in database and it is also retrieve into variable I know following:


    hbit = (HBITMAP) LoadImage(AfxGetInstanceHandle(),
    // MAKEINTRESOURCE(IDB_BITMAP4),
    MAKEINTRESOURCE(IDB_BITMAPNAME),
    IMAGE_BITMAP,
    0,
    0,
    LR_CREATEDIBSECTION); SRCCOPY);



    IDB_BITMAPNAME is a BITMAP which File Name Property set to the logo's path.

    This is a static way to do means I already set FileName Property of BITMAP. I want to set it at runtime. please help
    Last edited by [email protected]; January 12th, 2016 at 12:14 AM.

  13. #28
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Access database with MFC, vc++ 6.0

    Quote Originally Posted by [email protected] View Post
    I want to display Logo on my document like other data which I retrieve from database are store into variable and then those are passes to print on document. I am storing path of related bitmap in database and it is also retrieve into variable I know following:


    hbit = (HBITMAP) LoadImage(AfxGetInstanceHandle(),
    // MAKEINTRESOURCE(IDB_BITMAP4),
    MAKEINTRESOURCE(IDB_BITMAPNAME),
    IMAGE_BITMAP,
    0,
    0,
    LR_CREATEDIBSECTION); SRCCOPY);



    IDB_BITMAPNAME is a BITMAP which File Name Property set to the logo's path.

    This is a static way to do means I already set FileName Property of BITMAP. I want to set it at runtime. please help
    Wait, did you solve the other problem with reading data from the database?

  14. #29
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    I tried as follows but not work,

    hbit = (HBITMAP) LoadImage(NULL,
    // MAKEINTRESOURCE(IDB_BITMAP4),
    sLogopath,
    IMAGE_BITMAP,
    0,
    0,
    LR_LOADFROMFILE);

    sLogoPath is CString type variable which contain C:\Users\Administrator\Desktop\cg_logoa.bmp path of bitmap

    I also tried for dilectly mention path instead of variable "C:\\Users\\Administrator\\Desktop\\cg_logoa.bmp"

    Also tried for this

    L"C:\\Users\\Administrator\\Desktop\\cg_logoa.bmp" but it gives following error

    error C2664: 'LoadImageA' : cannot convert parameter 2 from 'unsigned short [44]' to 'const char *'
    Last edited by [email protected]; January 12th, 2016 at 01:28 AM.

  15. #30
    Join Date
    Jan 2016
    Posts
    61

    Re: Access database with MFC, vc++ 6.0

    Please reply soon. kindly I am waiting
    Last edited by [email protected]; January 12th, 2016 at 02:00 AM.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

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