|
-
Aug 30th, 2000, 12:20 PM
#1
When I hear people talking about using VB to subclass windows that arent yours, they say you need a C++ DLL,
but I heard somebody say on this forum that you still need a DLL to do it in C++....
is there ANY WAY to subclass any window in C++ without using a DLL???
Thanks,
Dennis
-
Aug 30th, 2000, 12:39 PM
#2
Frenzied Member
Nope. The reason you need a dll is that the foreign procedure can't access the memory of a standard exe. but it can get at the memory in a standard dll. It's not too hard, just make the dll to subclass it (put in all the stuff you'd put in a standard module in VB) then call the functions in the dll. windows will automaticly inject the dll into the foreign procedure.
-
Aug 30th, 2000, 01:39 PM
#3
Ok, I see now....
How would I go about doing that?
would I have to have a specific DLL for each thing I want to subclass?
or could I just have a universal one???
and on the subject of DLL's. how do you make one?
I tried making a simple message box DLL, but when I tried to use it from VB it said that it couldnt find the DLL entry point.
-
Aug 30th, 2000, 01:57 PM
#4
Monday Morning Lunatic
Some function names are a bit dodgy - what name did you use for your function?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 30th, 2000, 02:04 PM
#5
You can call the built-in SubClass routine.
Code:
CTestDlg dlg;
dlg.SubclassWindow(m_hWnd);
-
Aug 30th, 2000, 02:10 PM
#6
Parksie, I named the function MsgBBox.
Megatron, is that part of MFC??
because I dont want to use MFC.
-
Aug 30th, 2000, 02:11 PM
#7
Monday Morning Lunatic
I think that's only for MFC.
Dennis - you can't create standard DLLs in VB - you have to use C++ or another language that makes them. Also, make a .def file, with this in it:
Code:
LIBRARY yourdll.dll
DESCRIPTION 'My DLL'
EXPORTS
Function_A
Different_function
Add it to your project, and it should work...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 30th, 2000, 02:27 PM
#8
I know I cant create standard DLL's in VB, I was talking about in C++,
I made one with a fucntion of MsgBBox, and when i tried accessing it from vb, It said it couldnt find the DLL entry point.
-
Aug 30th, 2000, 03:12 PM
#9
Monday Morning Lunatic
You need to specifically export the function. This is for VC++:
Code:
__declspec(dllexport) long MsgBBox(HWND hWnd, ...) {
return 0;
}
then put this into the .def file, which tells the DLL creation process what to export:
Code:
LIBRARY yourdll.dll
DESCRIPTION 'My DLL'
EXPORTS
MsgBBox
If you add it to your project, it will export the named functions.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|