Click here to Skip to main content
16,005,141 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: FILE_ATTRIBUTE_READONLY Pin
elephantstar9-Jun-05 7:06
elephantstar9-Jun-05 7:06 
GeneralRe: FILE_ATTRIBUTE_READONLY Pin
normanS9-Jun-05 19:15
normanS9-Jun-05 19:15 
GeneralRe: FILE_ATTRIBUTE_READONLY Pin
David Crow7-Jun-05 10:59
David Crow7-Jun-05 10:59 
QuestionIs MS-SDK needed for building a media player? Pin
s99288637-Jun-05 10:25
s99288637-Jun-05 10:25 
AnswerRe: Is MS-SDK needed for building a media player? Pin
Christian Graus7-Jun-05 12:19
protectorChristian Graus7-Jun-05 12:19 
GeneralObtaining USB device serial numbers Pin
Anonymous7-Jun-05 10:10
Anonymous7-Jun-05 10:10 
GeneralRe: Obtaining USB device serial numbers Pin
Cedric Moonen7-Jun-05 20:40
Cedric Moonen7-Jun-05 20:40 
GeneralUsing WNetGetUserA Pin
kozu7-Jun-05 9:17
kozu7-Jun-05 9:17 
I am trying to dynamically load MPR.DLL and use WNetGetUserA in a dialog-based app.
Here's my code:

typedef DWORD (*LPDLLUSER_FUNC)(LPCTSTR,LPTSTR,LPDWORD);

char name[MAX_PATH]="";
DWORD size=MAX_PATH;

HINSTANCE hLib=LoadLibraryEx("mpr.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (hLib)
{
LPDLLUSER_FUNC lpDllEntryPoint = (LPDLLUSER_FUNC) GetProcAddress(hLib,"WNetGetUserA");
if (lpDllEntryPoint)
{
DWORD ret=(*lpDllEntryPoint)(NULL,name,&size);
char buf[10];
_itoa( ret, buf, 10 );
AfxMessageBox(buf);
AfxMessageBox(name);
}
FreeLibrary(hLib);
}

I get the following error:
"The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

I assume my LPDLLUSER_FUNC define is wrong. But WNetGetUserA has the same definition.

Any ideas what to do here? Linking statically to MPR.LIB is unfortunatelly not an option.
GeneralRe: Using WNetGetUserA Pin
Carsten Zeumer7-Jun-05 10:15
Carsten Zeumer7-Jun-05 10:15 
GeneralCreating ToolBar with enabled buttons Pin
Budric B.7-Jun-05 9:16
Budric B.7-Jun-05 9:16 
GeneralRe: Creating ToolBar with enabled buttons Pin
PJ Arends7-Jun-05 12:32
professionalPJ Arends7-Jun-05 12:32 
GeneralRe: that fixed the problem Pin
Budric B.8-Jun-05 3:59
Budric B.8-Jun-05 3:59 
GeneralAfxBeginThread and threadproc question Pin
Steve Messer7-Jun-05 7:28
Steve Messer7-Jun-05 7:28 
GeneralRe: AfxBeginThread and threadproc question Pin
Tom Archer7-Jun-05 7:32
Tom Archer7-Jun-05 7:32 
GeneralRe: AfxBeginThread and threadproc question Pin
Tom Archer7-Jun-05 7:34
Tom Archer7-Jun-05 7:34 
GeneralRe: AfxBeginThread and threadproc question Pin
Steve Messer7-Jun-05 7:35
Steve Messer7-Jun-05 7:35 
GeneralRe: AfxBeginThread and threadproc question Pin
David Crow7-Jun-05 7:46
David Crow7-Jun-05 7:46 
GeneralRe: AfxBeginThread and threadproc question Pin
Steve Messer7-Jun-05 7:59
Steve Messer7-Jun-05 7:59 
GeneralRe: AfxBeginThread and threadproc question Pin
Bob Stanneveld7-Jun-05 9:29
Bob Stanneveld7-Jun-05 9:29 
GeneralRe: AfxBeginThread and threadproc question Pin
Steve Messer7-Jun-05 9:32
Steve Messer7-Jun-05 9:32 
QuestionHow to create a new file with fstream? Pin
heng09877-Jun-05 6:51
heng09877-Jun-05 6:51 
AnswerRe: How to create a new file with fstream? Pin
David Crow7-Jun-05 7:10
David Crow7-Jun-05 7:10 
GeneralRe: How to create a new file with fstream? Pin
heng09877-Jun-05 7:15
heng09877-Jun-05 7:15 
GeneralRe: How to create a new file with fstream? Pin
David Crow7-Jun-05 7:34
David Crow7-Jun-05 7:34 
GeneralMatlab interface Pin
gobar7-Jun-05 6:01
gobar7-Jun-05 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.