| | |
Can't use a DLL inside my executable
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2007
Posts: 69
Reputation:
Solved Threads: 1
OK so I got my executable file that should load all the functions from
"message.dll" so I can use them.
But every time I run my executable file I am getting an error that say my executable is encountered problems and its should be closed than its being closed.
Here is my executable source
And this is what the hello function suppose to do
source from the dll
Any ideas why my exe crashes when I run it?
"message.dll" so I can use them.
But every time I run my executable file I am getting an error that say my executable is encountered problems and its should be closed than its being closed.
Here is my executable source
C++ Syntax (Toggle Plain Text)
#include <windows.h> #include <stdio.h> int main () { /*Typedef the hello function*/ typedef void (*pfunc)(); /*Windows handle*/ HINSTANCE HandleDLL; /*A pointer to a function*/ pfunc hello; /*LoadLibrary*/ HandleDLL = LoadLibrary("message.dll"); /*GetProcAddress*/ hello = (pfunc)GetProcAddress(HandleDLL,"hello"); /*Call the function*/ hello(); return 0; }
And this is what the hello function suppose to do
source from the dll
C++ Syntax (Toggle Plain Text)
__declspec(dllexport) void hello() { MessageBox (0, "Hello from injected DLL!\n", "Hi", MB_ICONINFORMATION); }
Last edited by laconstantine; Mar 25th, 2009 at 6:09 pm.
![]() |
Similar Threads
- Textbox: On Copy... (VBA in AC2003) (Visual Basic 4 / 5 / 6)
- Is there COM technology or so in Linux??? (IT Professionals' Lounge)
- Any alternative to the MS COM in Linux (IT Professionals' Lounge)
- from compiler to application (C++)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: array help
- Next Thread: Waiting till another exe file finishes
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





