|
Hi all
I'm doing a C# function retrieving a line of text from a Win32 edit box.
Platform SDK says the folowing: before sending the message, set the first
word of this buffer to the size in TCHARs, of the buffer. For ANSI text, this is the
number of bytes; for Unicode text, this is the number of characters.
How to do that with StringBuilder? I tried to set
StringBuilder ItemText = new StringBuilder(256);
//ItemText[0] = 250; //I'm not usre of that!!!!
IntPtr lenOfString =
Win32Api.SendMessage(
_hWnd,
EM_GETLINE,
IntPtr.Zero,
ItemText
);
but it doesn't work even if for example I set ItemTex[0] = 'a'
with a caracter.
How to handle dimension I want into first character of the stringBuilder
so that WinApi read it correctly?
Regards
ManuStone
-- modified at 4:48 Tuesday 27th March, 2007
|
|
|
|
|
C# is Unicode. I believe you'll find it's the length of the string * 2.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I need to export data from a list view in a Windows Form, to an excel sheet or to a notepad..
Can anyone tell me how to do it??
Thanks for your time and help.
-Seema
|
|
|
|
|
Hi,
I have a requirement as follows.
The Page1.aspx page is having the following input controls.
User Name, account number and date of birth.
The user enetered the information in Page1.apsx page and navigated to Page2.aspx. Now the user is coming back to Page1.aspx. How can I prepopulate previously entered data in Page1.aspx. (Where Can I save the data when the first time entered to prepopulate while coming back?)
Please Note: I should not use Sessions.
Thanks in Advance,
Reddy
rr
|
|
|
|
|
Hi
Use Profiles to manage user settings. This is a new feature in ASP.Net 2.0.
Harini
|
|
|
|
|
Is it possible to do in 1.1?
rr
|
|
|
|
|
The easiest way to do this, is to make page1 and page2 controls that exist on the one page. You can then change which page is visible at any time, and both pages will still have viewstate, so when you go back, page1 will not have lost it's values.
The other way to do it, is to pass an Id on the Url and use that to get your values from your database, if they are something that has been saved there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
there is a dll. code below
--------------------------
namespace CommonFunctionLibrary
{
public class ClsMain
{
public string setValue(string a,ref string b)
{
b = a;
return a;
}
}
}
-------------------------------------------------------
and there is a Host
--------------------------------------------------------------------
string filepath = @"E:\VS2005_work\CommonFunctionLibrary\CommonFunctionLibrary\bin\Debug\CommonFunctionLibrary.dll";
string s = string.Empty;
string p = string.Empty;
Assembly myDllAssembly = Assembly.LoadFrom(filepath);
Type dllType = myDllAssembly.GetType("CommonFunctionLibrary.ClsMain");
MethodInfo dllMethod = dllType.GetMethod("setValue");
if (dllMethod != null)
{
Object dllObj = Activator.CreateInstance(dllType);
s=(string)dllMethod.Invoke(dllObj, new object[] {"goldli",p });
MessageBox.Show(s+"\r\n"+p);
}
myDllAssembly = null;
------------------------------------------------------------------------------
question:
1、the Invoke method no need to use "ref" ,why?
2、the "p" parameter has no return value,why?
|
|
|
|
|
Hi..
I'm not sure but:
1. the ref is only valid in method calls and causes a parameter to be passed as pointer so it can be modified.
2. p does not contain the new value because this doesn't work either:
<br />
string s1, s2;<br />
s1 = "Blah";<br />
s2 = s1;<br />
s2 = "foo";<br />
Console.WriteLine(string.Format("{0} {1}",s1,s2));<br />
the output will be "Blah foo" because a new string is a new object.
the way i understand it, you should do the following:
<br />
string filepath = @"E:\VS2005_work\CommonFunctionLibrary\CommonFunctionLibrary\bin\Debug\CommonFunctionLibrary.dll";<br />
string s = string.Empty;<br />
string p = string.Empty;<br />
Assembly myDllAssembly = Assembly.LoadFrom(filepath);<br />
Type dllType = myDllAssembly.GetType("CommonFunctionLibrary.ClsMain");<br />
MethodInfo dllMethod = dllType.GetMethod("setValue");<br />
if (dllMethod != null)<br />
{<br />
Object dllObj = Activator.CreateInstance(dllType);<br />
object[] parameter = new object[] {"goldli",p };<br />
s=(string)dllMethod.Invoke(dllObj, parameter);<br />
p = parameter[1].ToString();<br />
MessageBox.Show(s+"\r\n"+p);<br />
}<br />
myDllAssembly = null;<br />
|
|
|
|
|
|
Hey Guys,
I'm developing a C# application this time i've decided to include crash reporting. I searched CP and found this
See this
Its in C++ though. I know i can call the unmanaged DLL from C# but Id prefer one in managed code. Is there a crash reporting library in managed code? I couldn't find any!
|
|
|
|
|
Hello everyone,
I have a ListView which I am sending some information HH:MM:SS into it everytime the user click a button. I wish to have a column which increments evertime the button is clicked and an item is added to the ListView.
Is there any easy way I can get this one done?
Thank you so much for your help and have a great day.
Khoramdin
|
|
|
|
|
If you have a new column, it's going to appear for every row. You can just add a column, and have the button click find the values there and increment them.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
im developing an application in c# .net 1.1 using VS2k3.
In that app I'm trying to open a System.Windows.Forms.FolderBrowserDialog.
Here is the code:
<br />
System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();<br />
folderBrowserDialog.SelectedPath = System.Environment.CurrentDirectory;<br />
folderBrowserDialog.ShowNewFolderButton = true;<br />
DialogResult res = folderBrowserDialog.ShowDialog(this.maindlg);<br />
if(res == DialogResult.OK)<br />
{<br />
...
}<br />
It works just great, except that when I click on the "Create new directory" button, a new directory will be created, but not shown in the dialog. When I close the dialog and start it again, then the new created dir will be shown. So there is a need to refresh the directory list in the dialog when the user hits the "create new dir" button.
Does anyone know how I can perform this?
thx and best regards
~Humppa
|
|
|
|
|
It works in my VS2003. Try to use only .ShowDialog();
|
|
|
|
|
Hi,
thanks for your reply.
I checked it out with .ShowDialog():
<br />
System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();<br />
folderBrowserDialog.SelectedPath = System.Environment.CurrentDirectory;<br />
folderBrowserDialog.ShowNewFolderButton = true;<br />
DialogResult res = folderBrowserDialog.ShowDialog();<br />
if(res == DialogResult.OK)<br />
{<br />
...
}<br />
Unfortunatelly there is still the same problem.
Please note that I'm running on WindowsXP and that the code is part of an internal class which is not inherited from UserControl or Form.
~Humppa
|
|
|
|
|
Hi,
I just found out that I've the same problem with the System.Windows.Forms.SaveFileDialog.
~Humppa
|
|
|
|
|
Hi again,
I found out that it works, when I start the application outside of VS2k3.
It definitly does not work, when I start it inside of VS2k3 by hitting the "play" button.
Maybe there is something wrong with my VS settings.
Anyway thx
~Humppaman
|
|
|
|
|
Hello everyone,
I have some data "Hour, Minute, second" which I would like to display in the format of "HH:MM:SS". As the digits can be a single and double I would like to put a "0" for a single digit.
Can anyone tell me how I can format this?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Example:
int a = 2;
string a_inOneDigit = a.ToString(); // 2
string a_inTwoDigit = a.ToString("D2"); // 02
|
|
|
|
|
strHours = Hours < 10 ? "0" + Hours.ToString() : Hours.ToString();
strMinutes = Minutes < 10 ? "0" + Minutes.ToString() : Minutes.ToString();
strSeconds = Seconds < 10 ? "0" + Seconds.ToString() : Seconds.ToString();
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Make a DateTime value out of it and format it:
DateTime time = new DateTime(0, 0, 0, hour, minutes, seconds);<br />
string formatted = time.ToString("HH':'mm':'ss");
---
single minded; short sighted; long gone;
|
|
|
|
|
hi,
I am having Form1 and Form2
Form 1 is maximized and From2 is Normal..
Now what I want is Form2 to be inside the Form1 always its boundary limit should be Form1 size..
I should no tin the position take out the Form2 from Form1 if i minimize Form1 the Form2 should be inside the Form1..
Help Me Pls
With Regards
Prasad
|
|
|
|
|
Hello everyone,
I want to know how ti bind data to data grid in c#.net 2005 through coding..
|
|
|
|
|
nivipandit wrote: Expecting the answer
That is a bit presumptious. This is a forum where the help comes from volunteers. No one is paid to answer questions here. If you expect an answer then you should look into paid for support.
Here your question will be answered if you provide good details to solve your problem and evidence that you have at least made an attempt yourself.
|
|
|
|