By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

Using a Win32 resource DLL in VB.NET?

P: n/a
Nak
Hi there,

This might sound like a dumb question but how would I use a Win32
resource DLL in VB.NET? I presumed there were API's for this purpose but am
unsure which ones, my API guide has nothing of relevance in the "Resources"
section and I've never actually done this in the past.

Thanks loads in advance!

Nick.
Nov 21 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
"Nak" <a@a.com> schrieb:
how would I use a Win32 resource DLL in VB.NET? I presumed
there were API's for this purpose but am unsure which ones


You will have to use p/invoke...

Resources
<URL:http://msdn.microsoft.com/library/en...wsuserinterfac
e/resources.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2

P: n/a
"Nak" <a@a.com> schrieb:
how would I use a Win32 resource DLL in VB.NET? I presumed
there were API's for this purpose but am unsure which ones


You will have to use p/invoke...

Resources
<URL:http://msdn.microsoft.com/library/en...wsuserinterfac
e/resources.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3

P: n/a
Hi Nak,

...using the pinvoke to call the API LoadLibrary to load your resource DLL,
then call the FindResource or LoadResource to load the variours resources,
or call the follwing APIs tto load specific resouce:
FormatMessage
LoadAccelerators
LoadBitmap
LoadCursor
LoadIcon
LoadMenu
LoadString

and when your program terminates, don't forget to call the API FreeLibrary
to free that resource DLL..
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 21 '05 #4

P: n/a
Hi Nak,

...using the pinvoke to call the API LoadLibrary to load your resource DLL,
then call the FindResource or LoadResource to load the variours resources,
or call the follwing APIs tto load specific resouce:
FormatMessage
LoadAccelerators
LoadBitmap
LoadCursor
LoadIcon
LoadMenu
LoadString

and when your program terminates, don't forget to call the API FreeLibrary
to free that resource DLL..
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 21 '05 #5

P: n/a
Nak
Cheers Herfried, I shall go take a read up!

Nick.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ui**************@TK2MSFTNGP09.phx.gbl...
"Nak" <a@a.com> schrieb:
how would I use a Win32 resource DLL in VB.NET? I presumed
there were API's for this purpose but am unsure which ones


You will have to use p/invoke...

Resources
<URL:http://msdn.microsoft.com/library/en...wsuserinterfac
e/resources.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #6

P: n/a
Nak
Cheers Herfried, I shall go take a read up!

Nick.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ui**************@TK2MSFTNGP09.phx.gbl...
"Nak" <a@a.com> schrieb:
how would I use a Win32 resource DLL in VB.NET? I presumed
there were API's for this purpose but am unsure which ones


You will have to use p/invoke...

Resources
<URL:http://msdn.microsoft.com/library/en...wsuserinterfac
e/resources.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #7

P: n/a
Nak
Hi Gary,

Thanks for the very informative answer, just what I needed, much
appreciation your way!

Nick.

"Gary Chang[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Gc**************@cpmsftngxa10.phx.gbl...
Hi Nak,

..using the pinvoke to call the API LoadLibrary to load your resource DLL,
then call the FindResource or LoadResource to load the variours resources,
or call the follwing APIs tto load specific resouce:
FormatMessage
LoadAccelerators
LoadBitmap
LoadCursor
LoadIcon
LoadMenu
LoadString

and when your program terminates, don't forget to call the API FreeLibrary
to free that resource DLL..
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------

Nov 21 '05 #8

P: n/a
Nak
Hi Gary,

Thanks for the very informative answer, just what I needed, much
appreciation your way!

Nick.

"Gary Chang[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Gc**************@cpmsftngxa10.phx.gbl...
Hi Nak,

..using the pinvoke to call the API LoadLibrary to load your resource DLL,
then call the FindResource or LoadResource to load the variours resources,
or call the follwing APIs tto load specific resouce:
FormatMessage
LoadAccelerators
LoadBitmap
LoadCursor
LoadIcon
LoadMenu
LoadString

and when your program terminates, don't forget to call the API FreeLibrary
to free that resource DLL..
Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------

Nov 21 '05 #9

P: n/a
Nak
Hi again,

I'm having loads of fun with loading resources from a DLL, apparently
the module can't be found! What I'm trying to do is load a ".msstyles" file
(which is a Win32 resource DLL) and obtain resources from it.

So far, I have the following

Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryW"
(ByVal lpLibFileName As String) As IntPtr

Dim pIPrLibHandle As IntPtr = LoadLibrary(iFileName)
If (pIPrLibHandle.Equals(IntPtr.Zero)) Then
Throw New Win32Exception(Err.LastDllError)
Else
'Loaded!
End If

I've tried a few deformations of the LoadLibrary declaration, and even
tried LoadLibraryEx and GetModuleHandle, but they *all* return the same
error. The following URL shows basically what I am trying to do in C++,

http://www.winehq.org/hypermail/wine...4/02/0082.html

I have tried placing the file inside of the executable path too but
still I get an exception saying that the module cannot be found. Any ideas
on this one would be greatly appreciated!

Nick.

"Nak" <a@a.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
Hi there,

This might sound like a dumb question but how would I use a Win32
resource DLL in VB.NET? I presumed there were API's for this purpose but
am unsure which ones, my API guide has nothing of relevance in the
"Resources" section and I've never actually done this in the past.

Thanks loads in advance!

Nick.

Nov 21 '05 #10

P: n/a
Nak
Hi again,

I'm having loads of fun with loading resources from a DLL, apparently
the module can't be found! What I'm trying to do is load a ".msstyles" file
(which is a Win32 resource DLL) and obtain resources from it.

So far, I have the following

Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryW"
(ByVal lpLibFileName As String) As IntPtr

Dim pIPrLibHandle As IntPtr = LoadLibrary(iFileName)
If (pIPrLibHandle.Equals(IntPtr.Zero)) Then
Throw New Win32Exception(Err.LastDllError)
Else
'Loaded!
End If

I've tried a few deformations of the LoadLibrary declaration, and even
tried LoadLibraryEx and GetModuleHandle, but they *all* return the same
error. The following URL shows basically what I am trying to do in C++,

http://www.winehq.org/hypermail/wine...4/02/0082.html

I have tried placing the file inside of the executable path too but
still I get an exception saying that the module cannot be found. Any ideas
on this one would be greatly appreciated!

Nick.

"Nak" <a@a.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
Hi there,

This might sound like a dumb question but how would I use a Win32
resource DLL in VB.NET? I presumed there were API's for this purpose but
am unsure which ones, my API guide has nothing of relevance in the
"Resources" section and I've never actually done this in the past.

Thanks loads in advance!

Nick.

Nov 21 '05 #11

P: n/a
Nak
Ignore me, I should have read the initial posts correctly and used PInvoke
from the start. Cheers again!

Nick.

"Nak" <a@a.com> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
Hi again,

I'm having loads of fun with loading resources from a DLL, apparently
the module can't be found! What I'm trying to do is load a ".msstyles"
file (which is a Win32 resource DLL) and obtain resources from it.

So far, I have the following

Private Declare Function LoadLibrary Lib "kernel32.dll" Alias
"LoadLibraryW" (ByVal lpLibFileName As String) As IntPtr

Dim pIPrLibHandle As IntPtr = LoadLibrary(iFileName)
If (pIPrLibHandle.Equals(IntPtr.Zero)) Then
Throw New Win32Exception(Err.LastDllError)
Else
'Loaded!
End If

I've tried a few deformations of the LoadLibrary declaration, and even
tried LoadLibraryEx and GetModuleHandle, but they *all* return the same
error. The following URL shows basically what I am trying to do in C++,

http://www.winehq.org/hypermail/wine...4/02/0082.html

I have tried placing the file inside of the executable path too but
still I get an exception saying that the module cannot be found. Any
ideas on this one would be greatly appreciated!

Nick.

"Nak" <a@a.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
Hi there,

This might sound like a dumb question but how would I use a Win32
resource DLL in VB.NET? I presumed there were API's for this purpose but
am unsure which ones, my API guide has nothing of relevance in the
"Resources" section and I've never actually done this in the past.

Thanks loads in advance!

Nick.


Nov 21 '05 #12

P: n/a
Nak
Ignore me, I should have read the initial posts correctly and used PInvoke
from the start. Cheers again!

Nick.

"Nak" <a@a.com> wrote in message
news:uT**************@TK2MSFTNGP15.phx.gbl...
Hi again,

I'm having loads of fun with loading resources from a DLL, apparently
the module can't be found! What I'm trying to do is load a ".msstyles"
file (which is a Win32 resource DLL) and obtain resources from it.

So far, I have the following

Private Declare Function LoadLibrary Lib "kernel32.dll" Alias
"LoadLibraryW" (ByVal lpLibFileName As String) As IntPtr

Dim pIPrLibHandle As IntPtr = LoadLibrary(iFileName)
If (pIPrLibHandle.Equals(IntPtr.Zero)) Then
Throw New Win32Exception(Err.LastDllError)
Else
'Loaded!
End If

I've tried a few deformations of the LoadLibrary declaration, and even
tried LoadLibraryEx and GetModuleHandle, but they *all* return the same
error. The following URL shows basically what I am trying to do in C++,

http://www.winehq.org/hypermail/wine...4/02/0082.html

I have tried placing the file inside of the executable path too but
still I get an exception saying that the module cannot be found. Any
ideas on this one would be greatly appreciated!

Nick.

"Nak" <a@a.com> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl...
Hi there,

This might sound like a dumb question but how would I use a Win32
resource DLL in VB.NET? I presumed there were API's for this purpose but
am unsure which ones, my API guide has nothing of relevance in the
"Resources" section and I've never actually done this in the past.

Thanks loads in advance!

Nick.


Nov 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.