Newbie in C++

This is a discussion on Newbie in C++ within the C++ Programming forums, part of the General Programming Boards category; Hi there.. i am a newbie in C++. I need to do a DLL for Win32. I have been informed ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    5

    Newbie in C++

    Hi there.. i am a newbie in C++.

    I need to do a DLL for Win32. I have been informed that C++ is the best tool to create DLLs.

    Anyway, this is how it goes. I need a DLL that contains a function. That function is supposed to Open the Select Folder Dialog Box and whatever folder is selected in the dialog box, the return value would be a string that contains the full path for the selected folder.

    I am in a bind in doing this.. so i do need some experts help.

    thanks a lot.

    John



    ps.

    by the way, i must stress that i am totally new into c++ programming and i basically know so little on the process of writing the codes as well as compiling it. please advise on the steps i needed to take so as to be able to do the DLL. thanks.

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    361
    Well, you start by taking the dewhicky, putting it into your compiler and in 30 seconds you have copmpleted you task.

    Really...start by reading the tutorials on this site, there really isn't a better place to start. Once you get the hang of C++ then and only then can you move on young one.

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    5
    well, i was hoping someone could show me a way.. on how to do that.. since i need it very badly..

    still hoping someone could show me some example and way to do that.

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,807
    Here you go
    Code:
    #include <windows.h>
    
    makeMyWin32DLL();
    Done and done
    But seriously search google with how to make dlls c++ or something like that.
    Woop?

  5. #5
    Registered User
    Join Date
    May 2005
    Posts
    5
    too bad for me that instead of constructive and helpful replies that i was hoping to get, i get a lot of goofy replies.

    i tried to search the net. google, yahoo and other search engines, no success in finding a code that is similar to the function that i need. besides, i have very little understanding of C++, and as i have said and stressed out, i need the dll very very badly.

    i hope some kind hearted fellow would be able to help me out..

  6. #6
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,807
    Look here,
    We are not a code posting service. You put in time, show effort we help out. I don't even know how to make a dll and I have been doing this a while. Not saying that I couldn't ever make one but it takes time and effort to learn how to program. So A) Learn something or B) Stop whining that we aren't going to do your work for you.
    Woop?

  7. #7
    Registered User
    Join Date
    Jan 2003
    Posts
    361
    The reason you are getting replis is because you are basically asking us to tell you how to do it exactly, as if it was very easy and could be done in 5 minutes.

    Just learn the basics and go from there...kinda hard to make a DLL if you don't know what your doing.

    If you want to learn to make a DLL, head over to MSDN and look it up.
    Last edited by Glirk Dient; 05-12-2005 at 08:47 AM.

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    forum_aaa,

    I think I made a DLL once... (?)

    Windows programming is not THAT easy! It is generally considered an advanced topic. There is a fair amount of "overhead". For example, Petzold's "Hello Windows" program is about two pages of code! And, it's almost all Windows specific (non-standard) code.

    You don't need all of that overhead code in your DLL, but it might be required in the "main" program that calls the DLL.

    I suggest that you get the program working as a regular non-DLL program first. Then, you can split-off the DLL portion and compile it to a DLL.

    Your compiler should have an option to "compile as DLL".

    Here's a link to a Windows tutorial.

  9. #9
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    too bad for me that instead of constructive and helpful replies that i was hoping to get, i get a lot of goofy replies.
    What your situation requires is that you hire a c++ programmer. Your challenge appears to be to convince a c++ programmer that providing free programming services to you is somehow in their best interests. Seems like a tough sell to me.
    Last edited by 7stud; 05-12-2005 at 05:08 PM.

  10. #10
    Registered User renurv's Avatar
    Join Date
    May 2005
    Posts
    8
    Hello, I am a newbie too so you are not alone. I took an intro to C++ programming class back in high school and was always generally interested in computers and software but I went on to major in Creative Writing in college because the math was just too damn hard in computer science courses. But anyway, I'm glad you're a newbie like me because this board can be pretty intimidating.


  11. #11
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    http://www.functionx.com/visualc/libraries/win32dll.htm
    If you really need to have it spelled out this site might be helpful. In the future try and be more diligent in looking on the web as this was very easily found using google.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  12. #12
    Registered User
    Join Date
    May 2005
    Posts
    5
    Ok. before i start, my apologies first. It was due to the urgent necessity to do a dll that perhaps i went a bit too far.

    anyway, as per people's advice here in this forum, i have somehow made a little code which perhaps is the closest i can muster to opening a GetFolder dialog box. What i need now is some advice on how to re-do this code to make it return a string value that contains the path of the selected folder in the dialog box.

    Also, there is very little knowledge i have in creating dll.. please advise..,

    thanks..


    @manofsteel972: thanks for the link... i wish to state that i am using a free c++ compiler.. devC++..
    Attached Files Attached Files

  13. #13
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589
    What your situation requires is that you hire a c++ programmer. Your challenge appears to be to convince a c++ programmer that providing free programming services to you is somehow in their best interests. Seems like a tough sell to me.
    you are correct. this type of question should be addressed by a paid c++ programmer
    do not get me wrong, i'm not against newbies learning.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  14. #14
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722
    A Dll is like an aplication. It has it's own main that is called each time a process loads it in memory
    The most basic DllMain would be
    Code:
    #include <windows.h>
    HINSTANCE g_hInst = NULL;
    BOOL APIENTRY DllMain( HINSTANCE hModule,DWORD  ul_reason_for_call,LPVOID lpReserved){
    	if(ul_reason_for_call == DLL_PROCESS_ATTACH)
    		g_hInst = hModule;
    	return TRUE;
    }
    Please refer here for more info when loading Dlls
    http://msdn.microsoft.com/library/de...oadlibrary.asp
    If the module is a DLL not already mapped for the calling process, the system calls the DLL's DllMain function with the DLL_PROCESS_ATTACH value. If DllMain returns TRUE, LoadLibrary returns successfully. If DllMain returns FALSE, the system unloads the DLL from the process address space and LoadLibrary returns NULL.

    It is not safe to call LoadLibrary from DllMain. For more information, see the Remarks section in DllMain.
    To compile a dll you need to refer to your compiler manual. For Dev-Cpp or MS Visual C++ create a new project and select Win32 Dynamic-link library (dll).
    Then inside your source add all the functions you need
    and declare then this way
    Code:
    return_type __declspec(dllexport)__stdcall  CALLBACK function_name(arguments){...}
    then in your main program you can acess the function inside the dll like this
    Code:
    HINSTANCE  my_dll_handler = LoadLibrary("my_dll.dll" );
    
    return_type (*my_func)(arguments) = (return_type (*)(arguments))GetProcAdress(my_dll_handler,"function_name");
    //OR SIMPLER
    
    typedef return_type (*func_type)(arguments);
    
    func_type my_func = (func_type)GetProcAdress(my_dll_handler,"function_name");
    func(...);//call the function
    As you can see it isn't very simple.
    Search http://msdn.microsoft.com/ for info on the windows API functions.
    Good luck

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  2. getting to grips with allegro and ms vc++ (newbie)
    By jimjamjahaa in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2005, 06:49 PM
  3. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 11:53 AM
  4. Some help for a newbie?
    By Ilmater in forum C++ Programming
    Replies: 23
    Last Post: 04-19-2004, 07:44 PM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21