embedded-resource

IllegalArgumentException Input == null

心已入冬 提交于 2019-12-14 03:12:00
问题 I am trying to read an Image as an InputStream . But for some reason I always get an IllegalArugmentException . Here is my code: BufferedImage i = null; i = ImageIO.read(getClass().getResourceAsStream("/res/graphics" + path)); 回答1: Reason: Your resource evaluates to null and that is why the exception API doc Throws: IllegalArgumentException - if input is null . Solution: If res/graphics/whatever is in classpath at root then it will return not null 回答2: Basically, the resource with the name

ASP.NET using embedded resources in Bundling

混江龙づ霸主 提交于 2019-12-13 12:59:02
问题 I'm trying to implement a generic approach for providing the possibility for different assemblies in my web solution to use embedded JavaScript and CSS files from embedded resources. This blog post shows a technique using a VirtualPathProvider. This works fine, but the VirtualPathProvider needs to be included in each assembly containing embedded resources. I tried to enhance the VirtualPathProvider from the blog post, so that an assembly can be passed into it and it loads the resource from

Embedding background images in an e-mail

大憨熊 提交于 2019-12-13 12:06:45
问题 I'm trying to use an embedded image in an e-mail as the background image, i've got the following code to embed it: LinkedResource backgroundLink = new LinkedResource("..\\..\\background.gif"); backgroundLink.ContentId = "BackgroundImage"; backgroundLink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64; htmlView.LinkedResources.Add(backgroundLink); m.AlternateViews.Add(htmlView); Then in the e-mail body i've got the following code to test: <table background='cid:BackgroundImage'> <tr

Displaying a dialog resource from a different DLL in MFC application

南笙酒味 提交于 2019-12-13 10:17:17
问题 I have a Win32 resource DLL (No MFC), which has a dialog in it. I can load the Win32 dll using LoadLibrary from the MFC application. After loading the DLL, how do I bring up the dialog to show it to the user? I Would appreciate if someone can share the code to do this. I remember using AfxGetResourceHandle to do this kind of stuff, but don't remember it now. 回答1: The basic steps are: LoadLibrary (as you have done) FindResource (gives you an HRSRC) LoadResource (gives you an HGLOBAL)

PHP - Embed Generated Image from External File into HTML email

那年仲夏 提交于 2019-12-13 07:27:22
问题 I have a sign-up form. When someone signs up, they immediately receive an email (in HTML format) with the following information: 1) Their sign-up information (Name, P#, Email, etc.) What I need is the following: 1) After sign-up, in the email the user receives, there needs to be a png-image that is generated by an external script. At the moment, I am using PEAR to generate/send the email (AOK) and Mail_Mime::addHTMLImage() to add the image, but alas, with no luck. All I get when I send the

Reading a resource file from within jar

亡梦爱人 提交于 2019-12-13 05:57:27
问题 I would like to read a resource from within my jar like so: File file; file = new File(getClass().getResource("/file.txt").toURI()); BufferredReader reader = new BufferedReader(new FileReader(file)); //Read the file and it works fine when running it in Eclipse, but if I export it to a jar the run it there is an IllegalArgumentException: Exception in thread "Thread-2" java.lang.IllegalArgumentException: URI is not hierarchical and I really don't know why but with some testing I found if I

Binding image to property in wpf with image from resources

别来无恙 提交于 2019-12-13 05:02:12
问题 i have some pictures included to my project. this line of code works fine: <Image Stretch="UniformToFill" Source="/Images/OffsetSituations/offsetsituation1.jpg" but i have to change the picture from the VM so i made a property to bind to: private ImageSource _image; public ImageSource Image { get { return _image; } set { if (_image == value) return; _image = value; RaisePropertyChanged("Image"); } } from another post here on stackoverflow i got this code and changed it a bit: string picture =

Issue with gif animation in Java swing

扶醉桌前 提交于 2019-12-13 02:23:20
问题 When I try to load a gif animation I am just getting an empty frame. Do you know what is wrong? The file is located within extras/loading.gif: package an1; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class An1 { public static void main(String[] args){ JFrame frame = new JFrame("Test"); ImageIcon loading = new ImageIcon("extras/loading.gif"); frame.add(new JLabel(loading, JLabel.CENTER)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame

Replacing Bitmap Resource in exe

北城以北 提交于 2019-12-12 19:16:29
问题 I have a program created using WinAPI. Within the program, I embedded a bitmap as a resource and the program loads that resource and displays it as a background image via bitblt. Below, I created a console program to replace the background in the WinAPI program. It successfully replaces the bitmap but now the WinAPI program does not display a background anymore. I know the replacement worked because using ResourceHacker, I can click on the resource and it display it fine. This screenshot

FindResource gives error 1813 on exe file

浪子不回头ぞ 提交于 2019-12-12 18:19:41
问题 I have been trying this for like the last 3 days and I still can't make it work. The WINAPI FindResource function throws and error 1813: this means that the resource type is not found. I am using eclipse so there is no .RC file or resource.h file so I have loaded my exe file with LoadLibraryA and then used the HANDLE in FindResourceA . Here is my code: HRSRC hRsrc; HMODULE hExe; /** Loading resource file in the program */ if (!(hExe = LoadLibraryA(TEXT(filename)))) { printf("Cannot load