|
I am pretty sure it is the only way if you want to receive Windows Messages,
as was clear from your initial post. Many apps have a window just to be able to receive
such messages.
Luc Pattyn
|
|
|
|
|
OK, i will try!
thank you very much Luc!
|
|
|
|
|
Hello,
I am trying to render a graphical sort of output in a console application.The result is word wrapping on the console.So i want to enable horizontal scrolling for the console window.How do i do it?
rgds,
chax
chax
|
|
|
|
|
In the console you can set "BufferWidth", i.e. the size of the console buffer, to some other value than the default 80, and you will get horizontal scrolling.
Internet - the worlds biggest dictionary
|
|
|
|
|
hello all,
am making a project that has a datagridview that will be filed from a SQL DB,
1) there si a field in the DB that has a data in hexadecimal format, so how i can fill it after converting it to string.
2) what is the process of allowing the user to add, delete and update on the datagridview directly??
sorry for the ones who see that i ask an easy questions but they are not easy 4 all of ones as u see :->
Thanks alot
Hamody
|
|
|
|
|
hi,
when u write the query to retrieve the data, convert the hexadecimal value to a string so that ur table will not have any column with hexadecimal values.
you can use edit, update, cancel and do the required manipulations on the datagrid, write the required logic in few methods and assign these methods accordingly to the datagrid events!!!
Gautham
|
|
|
|
|
thanks, but how i can convert from hexadecimal to string, io dont know the function to do this.
have u an example on add, delete, update on the datagridview
Thanks alot
Hamody
|
|
|
|
|
Hi,
int.Parse(myString, NumberStyles.AllowHexSpecifier);
will do it; I find the style name confusing, it means read-as-hex but does not
allow the 0x specifier !
Luc Pattyn
|
|
|
|
|
i tried it as:
string hhhh;
hhhh=int.Parse("ffff", NumberStyles.AllowHexSpecifier).ToString();
MessageBox.Show(hhhh);
use using System.Globalization; as name space
but it hasnt convert the hex to string
what can i do ???
Thanks alot
Hamody
|
|
|
|
|
Your code seems right.
This code snippet works for me:
public override void Run(int arg) {
hex("12");
hex("1234");
hex("1aBd");
hex("FFFF");
hex("ffff");
}
public void hex(string s) {
int i=int.Parse(s,NumberStyles.AllowHexSpecifier);
log("hex "+s+" = decimal "+i);
}
It produces
hex 12 = decimal 18
hex 1234 = decimal 4660
hex 1aBd = decimal 6845
hex FFFF = decimal 65535
hex ffff = decimal 65535
so I expect your problem is elsewhere.
Luc Pattyn
|
|
|
|
|
datagrid examples:http://www.4guysfromrolla.com/webtech/122300-1.shtml
give me a detailed explaination reg the hexadecimal prblm....
Gautham
|
|
|
|
|
ok thanks first,,,
i mean that i have SQL database table which has a field containg hexadecimal data (arabic converted to hexadecimal) i want 2 show converted data on the datagridview
Thanks alot
Hamody
|
|
|
|
|
Check this link: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1161100&SiteID=1
Gautham
|
|
|
|
|
G'day!
I'm currently writing a program that imports and uses functions from an unmanaged DLL. One of these functions expect as a parameter a struct containing some data (whose types I have previously passed successfully to other functions in the same dll) and an array of a struct containing an LPVOID type and a function pointer(which I have sucessfully passed). I don't understand how marshalling this type should work, if anyone could enlighten me, I'd be most thankful. Heres my current implementation:
<br />
[StructLayout(LayoutKind.Sequential,Pack = 0)]<br />
public struct StructA<br />
{<br />
public StructB[] sBArray;<br />
}<br />
<br />
[StructLayout(LayoutKind.Sequential,Pack = 0)]<br />
public struct StructB<br />
{<br />
[MarshalAs(UnmanagedType.FunctionPtr)]<br />
public aDelegate delegateMember;<br />
public object TheProblemChild;
}<br />
<br />
public class Bleh<br />
{<br />
[DllImport("Unmanaged.dll", EntryPoint = "UnmanagedImport")]<br />
private static extern int UnmanagedImport([MarshalAs(UnmanagedType.Struct)] StructA sA);<br />
public int CallUnmanagedFunc()<br />
{<br />
StructA sA = new StructA();<br />
SA.sBArray = new StructB[7];<br />
<br />
<br />
return UnmanagedImport(sA);
}<br />
The indicated position throws an ArgumentException seemingly no matter what I try. The message is "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))" and the stacktrace points directly to the imported function. In short (;P), I ask: How can I pass, from managed code to unmanaged, a parameter expected to be of type LPVOID?
Sorry if I overwhelmed you, or maybe turned non understandable.
|
|
|
|
|
|
I was gonna say that I've gone through a bunch of interop articles (both here and elsewhere) with a fine-toothed comb without finding anything, when I found that the field should be an IntPtr managed-side. However, when I tried it (And used the Marshal class to place data in the field) I still get the same exception. Down to the stacktrace. Thanks anyway!
|
|
|
|
|
hello,
i've got problems with opacity in my splash.
Informations to the inviroment: When I start my app a splash will shown with slowly fade-in effect.
Like it matters if colordepth is 32bit or 16bit, the transparent/white area of my splash (its an non symmetric pictrue and in that reason i'd set the transparencykey to "white") fades-in in black color.. it should by transparent. when i turn the colordepth to 16bit or lower, and the image opacity is 100%, the unneeded area is transparent, if it is 32bit it's white.. what do i wrong??
greetings from germany and sry of my bad english =))
|
|
|
|
|
Hello,
Combining Transparents and Opacity doesn't work. (.Net 1.1)
Also had a lot of bad days because of that.
What you can do is, after the "fading" is finished (opacity is 100%), you could call a method like that:
using System.Drawing;
public void MakeBackgroundTransparent()
{
Bitmap Img = new Bitmap(this.BackgroundImage);
Img.MakeTransparent(Img.GetPixel(0,0));
this.BackgroundImage = Img;
}
Hope that helps,
Martin
|
|
|
|
|
Hello Martin,
thanks for fast answering. I developing with .Net 2.0 - why dosen't work? Is there a workaround?
The code wouldn't work.. not at 32bit resolution..
greetings
Jerry
|
|
|
|
|
Hello,
b43r_3oo3 wrote: thanks for fast answering. I developing with .Net 2.0 - why dosen't work? Is there a workaround?
I only know the one I told you.
b43r_3oo3 wrote: The code wouldn't work.. not at 32bit resolution..
I'm using 32bit resolution and it works for me.
What I found out is that the TransparencyKey property doesn't work on every hardware with 32 bit. If you google for that problem you will find a lot of people sharing this problem.
All the best,
Martin
|
|
|
|
|
Thanks,
why can't the Microsoft developer make their job correct as most every other developer...
so far.. thanks mutch
Jerry
|
|
|
|
|
I have written a C# application (not a add in) to access outlook. I work with emails in the Inbox folder and also save the attachments to a directory. But when i use the
application I get a Security warning that pops up from outlook stating that -A program is
trying to access email address..Do you want to allow (Yes/No) and also it
asks the time duration for access.
is it possible to remove this or some how work around it?
I know of redemption and some other tools you could use but its expensive to purchase.
I found some code in Delphi 7 and VB6 which automatically presses the buttons on the warning form with api calls could i use this too if its the only option?
Thanks
Kind Regards
|
|
|
|
|
I believe you need to do it in conjunction with an Exchange server. It
involves creating a security settings template in a public folder.
Here's a link to two Microsoft articles on the subject. The first one
explains what needs to be done to set up the template, and the second
one explains what each setting on the template does.
http://office.microsoft.com/en-us/assistance/HA011402931033.aspx
http://office.microsoft.com/en-us/assistance/HA011402951033.aspx
The setting you configure is on the "Programmatic Settings" tab.
It's called "When sending items via Simple MAPI: Automatically approve".
There is also a "Trusted Code" tab on the template. On that tab you can
specify COM addins which can bypass the security blocks in Outlook.
What settings you use depends entirely on the type of application you're
trying to send e-mail from.
Also, I believe there is a registry value on each workstation
which tells Outlook to get its security settings from the public folder
form. It was:
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Security]
"CheckAdminSettings"=dword:00000001
Hope that helps.
Scott...
|
|
|
|
|
i use ATL create a COM.
in IDL:
typedef
[
uuid(C21871A0-33EB-11D4-A13A-BE2573A1120F),
version(1.0),
helpstring("A Demo UDT variable")
]
struct UDTVariable
{
[helpstring("Name of the variable")] BSTR Name;
[helpstring("Value of the variable")] long Value;
[helpstring("Special case variant")] VARIANT Special;
[helpstring("point of pValue")] int *pVal;
} UDTVariable;
interface IImplementable : IDispatch
{
[id(1), helpstring("method GetUDTSequence")] HRESULT GetUDTSequence([in] long start, [in] long length, [out] SAFEARRAY(UDTVariable) *SequenceArr);
[id(2), helpstring("method GetOtherArray")] HRESULT GetOtherArray([out] UDTVariable** pData);
[id(3), helpstring("method GetData")] HRESULT GetData([out] short* pLength, [out] short* pData);
};
in ATL code:
public:
STDMETHOD(GetData)(/*[out]*/ short* pLength, /*[out]*/ short* pData);
STDMETHOD(GetOtherArray)(/*[out]*/ UDTVariable** pData);
STDMETHOD(GetUDTSequence)(/*[in]*/ long start, /*[in]*/ long length, /*[out]*/ SAFEARRAY **SequenceArr);
When i add reference of above COM, the signature will be create autolly:
[DispId(3)]
public virtual void GetData(out short pLength, out short pData);
[DispId(2)]
public virtual void GetOtherArray(IntPtr pData);
[DispId(1)]
public virtual void GetUDTSequence(int start, int length, out Array SequenceArr);
Question1:
About the fuction of GetData, if the data will be send to C#, the data will be movable? If it is movable, how let it fixed?
Question2:
how can I use the function : public virtual void GetUDTSequence(int start, int length, out Array SequenceArr) in C#?
I can't create a instance of Array becaust it is a abstract class.
Question3:how can I use the function : STDMETHOD(GetOtherArray)(/*[out]*/ UDTVariable** pData) in C#?
When I use:
UDTVariable* otherUDTArray;
The compiler tell me: Can't take address of ,get the size of, or declare a pointer to a managed type UDTVariable
Can you help me?
-- modified at 4:08 Wednesday 7th February, 2007
-- modified at 4:10 Wednesday 7th February, 2007
Human knowledge belongs to the world.
|
|
|
|
|
sunssuns wrote: how let it fixed?
You can use the C# fixed keyword. More info here[^].
sunssuns wrote: I can't create a instance of Array becaust it is a abstract class.
Not sure, but have you tried an object[] ?
sunssuns wrote: how can I use the function : STDMETHOD(GetOtherArray)(/*[out]*/ UDTVariable** pData) in C#?
First, make sure UDTVariable is a COM type or interface defined in C# or in some .NET assembly, so that .NET can know about it. Secondly, once in place, you should be able to call the method like this:
UDTVariable instance;
GetOtherArray(out instance)
|
|
|
|