|
There is only one part of this question that makes sense, which is that every pixel has R, G and B, all bytes, which is very likely since that's the most common type of pixel these days. The rest may make sense in some parallel universe but not in this one.
|
|
|
|
|
I have a DLL which exports two methods, getSc and releasesSc. The first returns a handle which is a pointer to a class instance. I wish to call the methods on that class instance. Unfortunately that class is not exported as dumpbin proves:
1 0 00001040 ??4CSmartCard@XXXXXDLLNamespace@@QAEAAV01@ABV01@@Z
2 1 00003E40 _getSc@0
3 2 00003E70 _releaseSc@0
4 3 00003E40 getSc
5 4 00003E70 releaseSc
Is there a neat way to call the method on that class instance from C#/.Net?
The only way I can think of is to create an unmanaged DLL which wraps the other DLL. Thus the second DLL would expose functions to call into the class instance.
|
|
|
|
|
If the class methods are not exported then how will you access them from unmanaged code?
|
|
|
|
|
Well, that is the key question isn't it.
I was wondering if there is some equivalent to the manner in which you invoke methods on a COM interface i.e. you effectively tell it the prototype in the code.
|
|
|
|
|
You still need to know the prototype in order to call the methods. So how do you access these methods once you have a handle to the class object?
|
|
|
|
|
At present you add a DllImport with the prototype. So you might hope for something similar for an unmanaged C++ class instance. But apparently not. Ah well.
Incidentally I know that if the DLL exports the class, you can invoke the methods by passing the instance handle as the first argument to the method. But that is not the case I have.
Anyway, the wrapper is written.
|
|
|
|
|
Quote: The only way I can think of is to create an unmanaged DLL which wraps the other DLL
that would be my first guess, nasty as it is - I needed to use it to do the same sort of thing and 'aggregate' lower level (un-exposed) dll calls into something useable
... Im still looking for a better way myself
|
|
|
|
|
Thanks Garth. At least you confirm I am probably on the right track!
|
|
|
|
|
just thinking, have you tried
Quote: [DllImport("some name.dll", EntryPoint = "_getSc@0",
ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
?
|
|
|
|
|
|
Thanks, I hadn't seen that, but it assumes that the C++ class is exported by the DLL which was not the case with my DLL.
(The DLL is going to be modified so I can simply import the class methods.)
|
|
|
|
|
Hello,
I am developing a simple Windows search application. I will pass the all the search filters (Name, size etc) to Windows explorer using my application. But I am not getting commands or codes to select the 'Sort by' type programmatically in the window that will open.
Is it possible to implement that ?
|
|
|
|
|
how are you interacting with Windows explorer ?
I would have thought a better way was to use
string startFolder = @"c:\start dir\";
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(startFolder);
IEnumerable<System.IO.FileInfo> fileList = dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
and then use LINQ to filter fileList
|
|
|
|
|
I am interacting with Windows explorer using "Explorer search-ms:" command.
|
|
|
|
|
Hello. I was reading today that wherever possible, WPF use hardware-acceleration by taking advantage of Windows Display Driver Model (WDDM).
Question is: I am using 3rd party unmanaged library which internally uses GDI+. If I am making my front end in WPF, how much better performance should I expect?
Thanks for anything you share.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
How long is a piece of string?
Seriously, it is impossible to answer such a question. The only way to find out is by running tests on different configurations.
|
|
|
|
|
It depends on so many factors, including how you host the DLL inside WPF. As it's not a native WPF component, I suspect you're using an ElementHost and that has performance implications.
This space for rent
|
|
|
|
|
I have the following View:
<script>
$(document).ready(function () {
$('.profile_boxes').click(function () {
var val = $(this).attr('id');
$('.profile_boxes').css('background', '#fff');
$('.profile_boxes').css('border', '1px solid #ededed');
$("#" + val).css('background', '#f6f6f6');
$("#" + val).css('border', '1px solid #f55');
$.ajax({
url: '@Url.Action("RenderProfilePartials", "NewProfile")',
data: { 'profile': val },
cache: false,
type: "POST",
dataType: "html",
success: function (data, textStatus, XMLHttpRequest) {
console.log(val);
$('#profilePartials').html(data);
},
error: function (data, textStatus, XMLHttpRequest) {
console.log(data);
}
});
});
});
</script>
<div class="centering col-lg-6 logged_in_mainboxes">
<h2>What are you?</h2>
<div id="band" class="col-lg-4 profile_boxes">
<h3>Band</h3>
</div>
<div id="musican" class="col-lg-4 profile_boxes">
<h3>Musican</h3>
</div>
<div id="regular" class="col-lg-4 profile_boxes">
<h3>Regular</h3>
</div>
@Html.ValidationSummary(false)
<div id="profilePartials">
</div>
</div>
When you click on either Band, Musician or Regular, I partial view Is renderd:
<div id="band_info" class="col-lg-9 profileDesc">
<p>Maybe some information about the band profile here.....</p>
@using (Ajax.BeginForm("RegisterBand", "NewProfile", new AjaxOptions() { HttpMethod = "Post" }))
{
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-horizontal">
<div class="form-group">
Bandname
<div class="col-md-10">
@Html.EditorFor(x => x.Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(x => x.Name, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
Coverpicture
<div class="col-md-10">
@Html.EditorFor(x => x.CoverPicture, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(x => x.CoverPicture, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
Description
<div class="col-md-10">
@Html.EditorFor(x => x.Description, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(x => x.Description, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Spara" class="btn btn-success" />
</div>
</div>
</div>
}
</div>
Now I want to validate this forms with Ajaxoptions and unobtrusive. But when I hit Submit, the page Is reloaded and the partial views returned back.
I want it not reload, I want to make the validation without the reload.
Here Is my controller:
[HttpPost]
public ActionResult RegisterBand(BandProfileModel model)
{
if (ModelState.IsValid == false)
{
return PartialView("_BandRegisterPartial", model);
}
return View("Index");
}
I have enabled unobtrusive in web.config and all that stuff.
Anyone who can help me?
|
|
|
|
|
|
Other than manually setting up 64 ‘truth tables’, is there a more efficient method of finding the squares on a chessboard that a queen can not get too, given the queen is placed at random on the chessboard?
|
|
|
|
|
Depends on your interpretation of "efficient" and the whole scenario. If the queen is not the only piece on the board then you would have to check for "collisions" in any case. Calculating the fields that it can get to and then taking the complement of that would be my first approach.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hi Sascha, The good news is if the queen can not get to a certain square, then “collisions” will not be an issue. I really did not want to have to recalculate the fields each time a queen is placed on the chessboard. I am still leaning toward sets of truth tables, but was wondering if there an easier method. Thanks for your post.
|
|
|
|
|
I'd say that the queen can't get to any square that isn't at a 45 degree angle. Meaning any square that isn't on one of these angles 0, 45, 90, 135, 180, 225, or 270 from the current position. Assuming you want to bring some math into the calculation.
Edit: Not sure this is more efficient. I think I'd set up an 8x8 grid and flag where she can get. What is not flagged is where she can't get.
Jack of all trades, master of none, though often times better than master of one.
|
|
|
|
|
Hi Ron, I have no problem with the same file / rank / diagonal for the queen being on. Just wanted to eliminate having to process that scenario if I can quickly eliminate her not being able to get to the square I am currently interested in. Thanks for your reply.
|
|
|
|
|
Member 12357747 wrote: Other than manually setting up 64 ‘truth tables’, is there a more efficient method of finding the squares on a chessboard that a queen can not get too, given the queen is placed at random on the chessboard? It depends on what you want to do with the "truth tables".
Member 12357747 wrote: Other than manually setting up 64 ‘truth tables’ What do you call "manually setting" ?
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|