I'm loading a dll by using it's name like this:
HANDLE hlib = LoadLibrary("Winfax.dll");
Now I want to know from which path the dll was loaded. Is there a way to get the full path and file name for a dll handle?
Check out GetModuleFileName: GetModuleFileName Function using hlib as the HMODULE.
Related
I am running an unpackaged app and manually loading objects across a Proxy-Stub Server using base.h. I have a Window.Xaml with a Microsoft::UI::Xaml::Frame as the root element, in a WinUI component. I have tried both calling to get the IActivationFactory to the Xaml resource and creating it using:
auto oMyWindow = oObj.ActivateInstance<Window>();
or getting a runtime class to make<MyWindow>() the resource, but Initialize() fails both ways with:
WinRT originate error - 0x80004005 : 'Cannot locate resource from 'ms-appx:///MyWindow.xaml'.'.
Is there something I am unaware of that can be done to fix this so I can proceed? My alternative is using separate .exe processes to encapsulate, but this requires a lot of IPC work. It's not that I won't have to use other IPC options, it's just that I'd like to keep my late bound modules, tightly bound. And no, I have no intention of manually loading an entire interface with multiple pages.
Your application seems to be unable to find the file you're referencing. Make sure the application has the correct path. Using an absolute path instead of a relative path should work.
I am trying to load both external and internal property files for my app but I am having an issue with it. I have two property files, one is inside /src/main/resources, let's call it p1.properties. The second file is located at my c:\poc\p2.properties. So when I declared spring.config.location = file:c://poc/p2.properties. It will only load the external one. then I try to add the classpath:myapp/src/main/resources but still it only loads the external file only. And throws an exception saying not able to find p1.properties. I don't want to use PropertyPlaceholderConfigurer to hard code my external file path. Any ideas? Thanks!
If you are still facing the issue you can specify the internal property to be loaded like below from the command line argument.
-Dspring.config.location=file:c://poc/p2.properties,classpath:p1.properties
Hope this helps!
I am currently writing a Ruby custom type for Puppet and I must load the content of a file which is located in the same module in the 'files' folder. Is there a function accessible from the provider that can give me the content of the file addressed by "puppet:///modules/my_module/test.yaml"?
I found a way to get it working... Is this a proper solution?
file = Puppet::Parser::Files.find_file("my_module/my_file",
Puppet::Module.find('my_module').environment)
File.open('/tmp/test', 'w') { |f| f.write(File.read(file)) }
No, I don't think there is.
The manifest of your module should take care of copying the file to the agent through a file resource, so that the provider can use it from a known location.
Functions run on the server, types in the agent. If you create a function that returns the content of the file at the server, using standard Ruby code, you could use that function to inject the value in your type.
There are some caveats about what you can do with functions though.
Im writing a module for PyroCMS,
I need to get the directory of my module that has been installed so I can load an image on the browser.
The image is stored beneath the libraries folder in my module.
I would like to do something like
$logo = $this->get_addon_path(). '/libraries/myfile.png';
Which should return either of these values
www.mysite.com/addons/mysite/modules/mymodule/libraries/myfile.png
www.mysite.com/shared_addons/modules/mymodule/libraries/myfile.png
I managed to find this solution in the code of another program
Id thought id share it.
$this->module_details['path']
For me I just needed to wrap it up like so
base_url() . $this->module_details['path'].'/libraries/gateways/'.$image_name;
Which returns
www.mysite.com/addons/mysite/modules/mymodule/libraries/gateways/myfile.png
I have a .NET 4.0 class library with a directory called Resources, with an image called Logo.bmp inside it set to be compiled as an embedded resource.
In my main application I add the dll reference and set a Uri to pack://application:,,,/ResourceImages;component/Resources/logo.bmp and then I try to get the resource stream to that resource (using Application.GetResourceStream(myUri)) but it can't find the resource specified.
If however I put the image in the root directory of my dll and take out the Resources/ it can find and return the resource stream without issue.
Any suggestions?
to anyone else who might be having this particular issue, make sure that you build the string to pass into the new uri BEFORE you make the new call, not during. I changed it so that the pack: location string is all created ahead of time and now it works