[C++] Funktion aus DLL laden

11/25/2008 16:51 Pat Garrett#1
Ich möchte eine Funktion (URLDownloadToFile) aus einer DLL laden (urlmon.dll).
Dazu benutze ich LoadLibrary() und GetProcAddress().

Ich habe nun folgendes Problem...

Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <stdio.h>
using namespace std;

typedef VOID (*MYPROC)(LPTSTR);

int main(int argc, char *argv[])
{
    HINSTANCE hinstLib;
    MYPROC ProcAdd;

    BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; 
    hinstLib = LoadLibrary("urlmon.dll");
    if (hinstLib != NULL)
    {
      ProcAdd = (MYPROC) GetProcAddress(hinstLib, "URLDownloadToFile");
      cout << "procAdd: " << (MYPROC)ProcAdd << endl;
      fRunTimeLinkSuccess = (ProcAdd != NULL);
      if (fRunTimeLinkSuccess)
        (ProcAdd) ("message via DLL funtion\n");
      fFreeResult = FreeLibrary(hinstLib);      
    }
    cin.get();
    return EXIT_SUCCESS;
}
ProcAdd ist nun 0, d.h. die Funktion wird nicht gefunden ([Only registered and activated users can see links. Click Here To Register...]), bzw. kann nicht geladen werden. Ich bin mir zu ziemlich sicher, dass die Funktion URLDownloadToFile in der urlmon.dll vorhanden ist, aber ich habe einfach keine Ahnung, warum genau sie nicht geladen werden kann.
Hat jemand eine Idee, was genau ich falsch gemacht habe? (Außer die Wahl des Betriebssystems)

Greets,

Pat
11/27/2008 21:53 link#2
URLDownloadToFileA
11/27/2008 22:55 mr.rattlz#3
Quote:
Originally Posted by link View Post
URLDownloadToFileA
oder URLDownloadToFileW für UTF-16. Immer diese fiesen As und Ws am Ende von Funktionen, die haben mich sicher auch schon viel Zeit und Nerven gekostet :)
11/28/2008 14:06 Pat Garrett#4
Aaaaaaaaaaaaaaaaaaaaaaaaah... *an Kopf greif*

Dankeschön. Ich wär nie drauf gekommen. :&
11/29/2008 16:34 link#5
Quote:
Originally Posted by mr.rattlz View Post
oder URLDownloadToFileW für UTF-16. Immer diese fiesen As und Ws am Ende von Funktionen, die haben mich sicher auch schon viel Zeit und Nerven gekostet :)
lololololol, scheiß auf Unicode :P
11/29/2008 20:49 mr.rattlz#6
Quote:
Originally Posted by link View Post
lololololol, scheiß auf Unicode :P
うるさい