F
FFrozTT
I am having a problem creating a DLL with an entry point. I've been
trying sub Main, DllMain, and I get nothing. When I run dumpbin -
exports mydll.dll I see no entry points, also the dll when executed by
rundll32 is not giving expected results. I have the project set to
Class Library with Sub Main as the startup object, which I can't
change to anything else anyway without modifying the .vbproj file
which also seems to have no effect. Also there seems to be a circular
error where
I get
Sub Main = "No accessible 'Main' method witha n appropriate signater
was found in 'MyDLL'."
Public Sub Main = "No accessible 'Main' method witha n appropriate
signater was found in 'MyDLL'."
Public Shared Sub Main = "Cannot refer to an instance member of a
class from within a shared method or shared member initializer without
an explicit instance of the class" -- Where it is referring to the
call to MyFunction which I have tryed as subs and functions and can't
seem to get out of this error without moving all my code to a module,
instead of a class. I don't really care if it is a module or a class
because I don't have to instantiate this object, just execute it but
everywhere I read people say to use Classes now, modules are just for
backward compatability with VB6.
Here is basically my code...
Option Explicit On
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Reflection
Imports System.Threading
Imports System.IO
Public Class MyDLL
Public Const DLL_PROCESS_DETACH = 0
Public Const DLL_PROCESS_ATTACH = 1
Public Const DLL_THREAD_ATTACH = 2
Public Const DLL_THREAD_DETACH = 3
Public Function DllMain(ByVal hinstDLL As Long, ByVal fdwReason As
Long, ByVal lpwReserved As Long) As Boolean
Select Case fdwReason
Case DLL_PROCESS_DETACH
' No per-process cleanup needed
Case DLL_PROCESS_ATTACH
DllMain = True
Case DLL_THREAD_ATTACH
' No per-thread initialization needed
Case DLL_THREAD_DETACH
' No per-thread cleanup needed
End Select
Call MyFunction()
Do
Application.DoEvents()
Loop Until Not MyFunctionRunning()
End Function
Public Shared Sub Main()
Call MyFunction()
Do
Application.DoEvents()
Loop Until Not MyFunctionRunning()
End Sub
Public Sub MyFunciton()
....
End Function
Public Sub MyFunctionRunning()
.... Check if function still running.
End Function
Thanks in advance for any assistance with this problem.
trying sub Main, DllMain, and I get nothing. When I run dumpbin -
exports mydll.dll I see no entry points, also the dll when executed by
rundll32 is not giving expected results. I have the project set to
Class Library with Sub Main as the startup object, which I can't
change to anything else anyway without modifying the .vbproj file
which also seems to have no effect. Also there seems to be a circular
error where
I get
Sub Main = "No accessible 'Main' method witha n appropriate signater
was found in 'MyDLL'."
Public Sub Main = "No accessible 'Main' method witha n appropriate
signater was found in 'MyDLL'."
Public Shared Sub Main = "Cannot refer to an instance member of a
class from within a shared method or shared member initializer without
an explicit instance of the class" -- Where it is referring to the
call to MyFunction which I have tryed as subs and functions and can't
seem to get out of this error without moving all my code to a module,
instead of a class. I don't really care if it is a module or a class
because I don't have to instantiate this object, just execute it but
everywhere I read people say to use Classes now, modules are just for
backward compatability with VB6.
Here is basically my code...
Option Explicit On
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Reflection
Imports System.Threading
Imports System.IO
Public Class MyDLL
Public Const DLL_PROCESS_DETACH = 0
Public Const DLL_PROCESS_ATTACH = 1
Public Const DLL_THREAD_ATTACH = 2
Public Const DLL_THREAD_DETACH = 3
Public Function DllMain(ByVal hinstDLL As Long, ByVal fdwReason As
Long, ByVal lpwReserved As Long) As Boolean
Select Case fdwReason
Case DLL_PROCESS_DETACH
' No per-process cleanup needed
Case DLL_PROCESS_ATTACH
DllMain = True
Case DLL_THREAD_ATTACH
' No per-thread initialization needed
Case DLL_THREAD_DETACH
' No per-thread cleanup needed
End Select
Call MyFunction()
Do
Application.DoEvents()
Loop Until Not MyFunctionRunning()
End Function
Public Shared Sub Main()
Call MyFunction()
Do
Application.DoEvents()
Loop Until Not MyFunctionRunning()
End Sub
Public Sub MyFunciton()
....
End Function
Public Sub MyFunctionRunning()
.... Check if function still running.
End Function
Thanks in advance for any assistance with this problem.