| | |
Help me understand this code
![]() |
•
•
Join Date: Aug 2004
Posts: 140
Reputation:
Solved Threads: 2
1. typedef int (*MYPROC)(LPTSTR);
2. hinstLib = LoadLibrary(TEXT("myputs"));
3. ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("myPuts"));
2. hinstLib = LoadLibrary(TEXT("myputs"));
3. ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("myPuts"));
Want a new website for free:
http://indigo.kjots.com/
http://indigo.kjots.com/
>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.
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
![]() |
Similar Threads
- VBA source code (Visual Basic 4 / 5 / 6)
- Need to Sum up this code (PHP)
- Code analysis (C++)
- Get ride off extra features in code (Pascal and Delphi)
- interesting code......Help (C++)
- Error while compiling but not in the code itself???? (Java)
- asp code generated as text, needed to be seen as asp code again. databses backup (ASP)
- I am trying to get this code to work. Please help. (C++)
- Need help with DirectX code (C)
Other Threads in the C Forum
- Previous Thread: Help! Beginner here
- Next Thread: Multiline Story String
| Thread Tools | Search this Thread |
* ansi api array arrays bash binarysearch calculate centimeter changingto char character convert copyanyfile copypdffile createcopyoffile createprocess() directory dynamic execv fflush file floatingpointvalidation fork forloop frequency function getlasterror getlogicaldrivestrin givemetehcodez grade graphics gtkgcurlcompiling gtkwinlinux hardware highest histogram homework i/o ide inches infiniteloop initialization input intmain() iso keyboard km license linked linkedlist linux list looping loopinsideloop. lowest matrix microsoft mysql oddnumber open opendocumentformat openwebfoundation pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string suggestions test testautomation threads unix urboc user variable whythiscodecausesegmentationfault win32api windows.h windowsapi






