|
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace AEXMLAdapterTester
{
internal sealed class NativeMethods
{
private NativeMethods() {}
[DllImport("AEXMLAdapter.dll", EntryPoint="GetAllSettings", SetLastError=true, CharSet=CharSet.Unicode)]
public static extern uint GetAllSettings(StringBuilder lpBuffer, ref uint lpnSize);
[DllImport("AEXMLAdapter.dll", EntryPoint= "SetAllSettings", SetLastError=true, CharSet=CharSet.Unicode)]
public static extern uint SetAllSettings(string lpBuffer);
[DllImport("AEXMLAdapter.dll", EntryPoint= "ReloadSettings", SetLastError=true, CharSet=CharSet.Unicode)]
public static extern uint ReloadSettings();
};
///
/// Summary description for XmlAdapterInterop.
///
///
internal sealed class XmlAdapterInterop
{
private XmlAdapterInterop() {}
public static string GetAllSettings()
{
uint retVal;
StringBuilder buffer = null;
uint size = 0;
retVal = NativeMethods.GetAllSettings(null, ref size);
if (retVal == 122)
{
buffer = new StringBuilder((int)size);
retVal = NativeMethods.GetAllSettings(buffer, ref size);
}
if (retVal != 0)
throw new ApplicationException("Interop Error calling GetAllSettings");
return buffer.ToString();
}
public static void SetAllSettings(string buffer)
{
uint retVal;
retVal = NativeMethods.SetAllSettings(buffer);
if (retVal != 0)
throw new ApplicationException("Interop Error calling SetAllSettings - retVal = " + retVal);
}
public static void ReloadSettings()
{
uint retVal;
retVal = NativeMethods.ReloadSettings();
if (retVal != 0)
throw new ApplicationException("Interop Error calling SetNothing - retVal = " + retVal);
}
}
}
These code running correctly in Windows 2003 server 32Bit
but when use in Windows Server 64Bit when i invoke XmlAdapterInterop.GetAllSettings() an exception occured "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"
Any one can help me, i will thank you a lot
I want to make some friends here
|
|
|
|
|
I have no experience with Win64, but I expect some problems;
in your case "ref size" now becomes a 64-bit pointer, and both parties
should agree on that.
I googled "pinvoke 64bit" and found several hits,
one
says "If you rely on 32-bit libraries you should make sure your app runs with the 32-bit framework" ...
Luc Pattyn
|
|
|
|
|
I have experienced this exception before. I would say the most likely cause is that AEXMLAdapter.dll, or some other library you are using, is not compiled in 64bit mode.
only two letters away from being an asset
|
|
|
|
|
I have get some informations from you guys and i select platform target X86 in build tag
then run again, it is ok.
if the AEXMLAdapter.dll build in x86 machine so the project must build in x86 mode?
As the program is a unit test assembly, when i try to build in x86 mode, the Nunit cannnot open the assembly.
Any body has some experience in this issue?
I want to make some friends here
|
|
|
|
|
How can I create DBF file with 866 code page, and then fill it from SQL table with 1232 codepage.
Apparently I want all values to be transliterated to 866 codepage correctly.
|
|
|
|
|
err
|
|
|
|
|
|
Hi All!
I have this application of mine which works well. It even used to work on Vista. (I work on XP most of the time).
There are some ManagedC++ assemblies in the project.
Now when I try to start the project under vista, when I try to access classes in the ManagedC++ assemblies I get this error:
==========================================
Exception : System.IO.FileLoadException
Message : Could not load file or assembly 'NScribe, Version=1.0.2553.30928, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)
Source : NovaMindEditor
Help :
OSVersion : Microsoft Windows NT 6.0.5600.0
Thread :
Stack :
at NovaQuickStart.Program.StartApp(String[] args)
at NovaQuickStart.Program.Main(String[] args) in C:\Development\Development\Windows\NovaQuickStart\Program.cs:line 59
-------- Caused by Exception --------
Exception : System.Runtime.InteropServices.COMException
Message : The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)
Source :
Help :
Stack :
==========================================
Any ideas?
|
|
|
|
|
I am using the following code snippet to generate a multi frame/page Tiff file from a collection of images of varying sizes and dpi values for a new image viewing web/app control I am writing for the new company web site...
System.Drawing.Imaging.Encoder enc =
System.Drawing.Imaging.Encoder.SaveFlag;
EncoderParameters eParms = new EncoderParameters(1);
eParms.Param[0] = new EncoderParameter(
enc,
(long)EncoderValue.MultiFrame
);
Bitmap image = (Bitmap)this[0].Image.Clone();
image.Save(
PathToImage.AbsolutePath,
GetEncoderInfo("image/tiff"),
eParms
);
for (int index = 1; index < this.Count; index++)
{
eParms.Param[0] = new EncoderParameter(
enc,
(long)EncoderValue.FrameDimensionPage
);
try
{
image.SaveAdd(
(Bitmap)this[index].Image.Clone(),
eParms
);
}
catch (Exception ex)
{
errorMessage.Error(ex);
debug.Info(ex);
}
}
eParms.Param[0] = new EncoderParameter(
enc,
(long)EncoderValue.Flush
);
image.SaveAdd(eParms);
This code basically is a method in an imaging array class. It is designed to iterate through the list of images in the array/collection and add each, in turn, to the end of a Tiff image, forming a multi frame Tiff. The resulting image "seems" valid, since it can correctly be read in the Windows Image and Fax viewer, and I can page to each image in using the next/previous buttons... so I know they are there.
However, when I go to read it back in, the number of images reported by
int Frames = img.GetFrameCount(FrameDimension.Page);
is always 1, no matter how many images I put into it,
so the call to
SelectActiveFrameCount(FrameDimension dim, int FrameNo);
always selects the first frame, regardless of what FrameNo is set to. This code is a varyation of code I have found several times from several sites, including Microsoft's.
I am using .NET 2.0 / Visual Studio 2005 / C#.
Am I leaving something out? Can multi frame Tiffs handle a variety of image sizes in the same Tiff file? What could be wrong? My suspicion is that the call to "SaveAdd()" should be generating a new frame entry for the list of frames along with the image itself, but it only adds the image without adding the related frame information. Is there some extra (unmentioned) code that I should add to get it to create the extra frame entry?
|
|
|
|
|
I am using c# Express and trying to deploy a program that uses an .mdb file. It tries to use the same path that the original was in and the installation fails since that directory does not exist.
How do I get it to place it, and look for it, in the same directory as the program?
David Wilkes
|
|
|
|
|
Using a deployment project? I simply add it to the application folder.
|
|
|
|
|
Thanks for the reply!
I have been beating on this for a while now. When I add the MDB to the project it will not install. I get an error “Can not start the application”. When I look at the details I see this;
COMPONENT STORE TRANSACTION FAILURE SUMMARY
* Transaction at [1/19/2007 11:43:18 AM]
- Staging of a component file (CDMAConverter.mdb) did not succeed.
- Staging of a component file (Gamorrean.ico) did not succeed.
- Staging of a component (CDMA_Converter.exe.genman) did not succeed.
- Staging of a component file (CDMA_Converter.exe) did not succeed.
- Installation of deployment (file:///E:/CDMA_Converter.application#CDMA_Converter.application, Version=1.0.2.0, Culture=neutral, PublicKeyToken=2022ca6c0b1c5b65, processorArchitecture=msil) did not succeed.
- Setting one or more of the deployment metadata did not succeed.
And this in the “Transactions Details”
+ System.Deployment.Internal.Isolation.StoreOperationStageComponentFile
- Status: Failed
- HRESULT: 0x80070057
- File: CDMAConverter.mdb
David Wilkes
|
|
|
|
|
manually creating manifest and application files using mageui.exe.
I had to do it this way in my plugin-like application because the project deployment does't include not referenced files like plugin dlls and I guess it won't include an mdb file..
|
|
|
|
|
|
Hi, everybody.
Could anyone help me with this subtle and foolish question?
My question is: How do you turn on and off the insertion point(blinking cursor)like in TextBox in C#?
Thanks.
|
|
|
|
|
Focus another control. Alternately, you could try P/Invoking the HideCaret[^] method of the Win32 API. No idea if that will work though.
|
|
|
|
|
Are you using a TextBox? Designing your own control? What?
Do you want it off? Or blinking?
|
|
|
|
|
No, I am justing creating a window form and dragged/dropped a TextBox onto the form.
And when the form in running I want to hold the insertion point off until user clicks either (EDIT) or (Add) button is clicked.
At that point I want the user click any Input TextBox to type in any data the user desires in the TextBox.
As you all expect, as soon as the window is running and when you click the TextBox, eventhough no (EDIT) or (ADD) button
is clicked, you will see the cursor (inertion point) is blinking ready to accept the input.
I want the cusor to be off until the user clicks either (EDIT) or (ADD) is clicked.
Is my description clear enough?
Thanks.
|
|
|
|
|
Seems you want TextBox.Enabled=false or even TextBox.Visible=false
until (EDIT) or (ADD) are clicked.
Luc Pattyn
|
|
|
|
|
Not exactly. I know TextBox.Visble=false; and TextBox.Enabled=true;
This is not exactly what I want.
Specifically after you creating a TextBox and when you run the form
you'll see the cursor is blinking in the TextBox. ( when there is only one TextBox in the form for example).
I want to turn off the blinking cursor off or make it disappear for certain period of time
until the user do somthing.
That's all I want. It seems so simple but I could not find anything about it in C#.
Thanks.
|
|
|
|
|
I'd use Enabled=false, while disabled the TextBox won't get Focus.
|
|
|
|
|
I understand you would like to have TextBox.Enabled=true but if you are trying to control the user's actions, you need to make it very clear to them what is expected. Upon loading or clearing the form, set the data entry controls read-only. Then upon clicking the [Add], [Edit] or whatever the button is called, the first thing you do is enable your text boxes, radiobuttons and any other controls the user is to access for data entry.
If you just hide the cursor, the user clicks on the TextBox and says "What's wrong? The cursor disappeared!" If it is disabled, it is pretty clear the only option they have is to tell the program what they want to do such as [Add], [Edit], etc.
I usually have two core methods in most of my forms: Clear() and SetReadOnly(bool value). Upon loading the form or saving a record Clear() is called which sets all the default values for the fields. One of the last lines in Clear() is the call SetReadOnly(true); to disable all the controls. The only option the user has at this point is to click [New] or [Cancel]. If they click [New], I call SetReadOnly(false); and set the focus on the first field I want them to fill in (i.e. TextBox.SetFocus();).
Just a suggestion.
|
|
|
|
|
Suppose your form has 3 controls . one edit box ,and 2 other buttons. put tabindex of one of the buttons to zero in the form load event. So that the button will get focused.
Hopes this helps.
If u can Dream... U can do it
|
|
|
|
|
If you do that way the focus is certainly on one of the buttons.
But at that moment if click the TextBox you will see the blinking cusor in the TextBox.
This is not what I want. I don't want the blicking cursor show up in the TextBox until
I click either (ADD) or (EDIT) button is clicked.
Is this clear to you?
Thanks.
|
|
|
|
|
i understood now. So try changing focus on Textbox1_mouseclick , like below
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
fousButton.Focus();
}
In my case it workd. however it is not a good solution. i am searching for some other good solution with IMessageFilter.
If u can Dream... U can do it
|
|
|
|