Resource add in compile time in MFC

Discussion in 'Win32' started by Akash, Jan 31, 2007.

  1. Akash

    Akash New Member

    Joined:
    Jan 31, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    First Import a .txt file in MFC
    and then give some name such as "A"
    So its adding as IDR_A1

    Then find IDR_A1, U will see #define IDR_A1 129 or different

    Then write the code which is given billow in OnInitDialog()

    HGLOBAL hResourceLoaded; // handle to loaded resource
    HRSRC hRes; // handle/ptr to res. info.
    char *lpResLock; // pointer to resource data
    DWORD dwSizeRes;
    int nResourceId;
    unsigned char vv[50000];

    ofstream outputFile;


    hRes = FindResource(NULL, MAKEINTRESOURCE(129),"A");


    hResourceLoaded = LoadResource(NULL, hRes);
    lpResLock = (char *) LockResource(hResourceLoaded);
    dwSizeRes = SizeofResource(NULL, hRes);
    strcpy(vv,lpResLock);
    //*vv=*lpResLock;
    outputFile.open("C:\\B.txt",1);
    outputFile.write((const char *) lpResLock, dwSizeRes);
    outputFile.close();

    //adding #include <fstream.h>
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Sorry I could not get what is your point??
     
  3. Akash

    Akash New Member

    Joined:
    Jan 31, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    basically it work as a installer . First U have to attach so many file ,
    such as txt,binary in compile time.
    When its run then will not depend to any other file for writing anywhere.
    Till now if u r not understand then batter to discus Hansaraj Das
    Akash Dutta
    Cellnext Solutions Limited.(DELHI)
    akashduttaj@gmail.com
    akash.dutta@cellnext.com
    Ph:09313773387(M),03325141429(R)
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    What I wanted to know is whats your query then.
     
  5. Akash

    Akash New Member

    Joined:
    Jan 31, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    dont understand your question.
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    This is a query and discussion forum and it looks like you are looking for something. isnt that true?
     
  7. Akash

    Akash New Member

    Joined:
    Jan 31, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    100% true
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Then if you are looking for something then whats your question??
     
  9. Akash

    Akash New Member

    Joined:
    Jan 31, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    actually right now I am working in win32 console application with dialogic
    also know some portion of MFC.
    want to know win32 application.

    so plz send me a simple programe of win32 application,
    which will create a button and when fire this then it will
    show a message box..........thats all

    thank U.
     
  10. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Have you tried writing something??
     
  11. Akash

    Akash New Member

    Joined:
    Jan 31, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    no no ,i can write anithig with DrawText()
    but cant create button
     
  12. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    But wehre have you stuck. Have you tried anything which we can help you upon. We cannot write everything for you unless you write your own code.

    Try reading [thread=168]Before you make a query[/thread].
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice