Help me understand this code

Reply

Join Date: Aug 2004
Posts: 140
Reputation: Mahen is an unknown quantity at this point 
Solved Threads: 2
Mahen Mahen is offline Offline
Junior Poster

Help me understand this code

 
0
  #1
Oct 1st, 2005
1. typedef int (*MYPROC)(LPTSTR);
2. hinstLib = LoadLibrary(TEXT("myputs"));
3. ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("myPuts"));
Want a new website for free:
http://indigo.kjots.com/
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,362
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 241
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Help me understand this code

 
0
  #2
Oct 1st, 2005
>1. typedef int (*MYPROC)(LPTSTR);

This declares an alias MYPROC which is a pointer to a function taking an LPTSTR as a parameter and returning an int.

>2. hinstLib = LoadLibrary(TEXT("myputs"));

This is a call to the function LoadLibrary, which is passed the parameter of TEXT("myputs") -- TEXT is likely a macro that may be used to make it a string of wide characters if applicable. The return value of the function is assigned to hinstLib.

>3. ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("myPuts"));

This is a call to the function GetProcAddress, which is passed the parameters of hinstLib and TEXT("myPuts"). The return value of the function is cast to a pointer to a function taking an LPTSTR as a parameter and returning an int, and this result is assigned to ProcAdd.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC