473,320 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using a Win32 resource DLL in VB.NET?

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
12 7754
"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
"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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: tlviewer | last post by:
hello, The script below is a prototype for loading playing card images from the bitmap resource in cards.dll (WinXP) I like the idea of not keeping copies of the images as files. I'm able...
3
by: Christopher Burr | last post by:
I'm trying to retrieve a string resource from a Win32 file. In win32 world I would just use LoadLibrary and LoadString. What do I use in the .NET world? -- Chris Burr cburr@kcc.com
8
by: Dennis C. Drumm | last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost Win32 API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom...
2
by: Arne Schittenhelm | last post by:
Hello, How can I get access and read strings from a Win32 String Resource DLL with C#?
6
by: Klaatu | last post by:
I've seen plenty of examples of updating a resource using UpdateResource(). Has anyone actually used it to add a new resource? For example, a menu resource. If so, how is it done? I'm not quit...
1
by: Mythran | last post by:
I am attempting to read all of the resources from a Win32 executable, and load each of them to display them on a screen. So, please help figure out why I can't seem to get it right :) First...
3
by: Jared | last post by:
I'm using the first code sample below to play WAV files stored as embedded resources. For some reason I *occasionally* get scratching and crackling. I'm using a couple WAVs that ship with...
3
by: hsmit.home | last post by:
I spent way too much time on this and I must say, I was a little disgruntled with what has been posted on all the various Xalan C mailing lists. Everyone says there's a solution, but give next to...
5
by: JMurugesh | last post by:
I have created a VB DLL using the code given below. And then I tried to use that DLL in an VC++ Win32 application. Where the LoadLibrary/AfxLoadLibrary were working ok. But the GetProcAddress calls...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.