|
You can do this by using COM interfaces exposed by OutLook.
For example if you use Visual Basic, Visual Basic .NET, C# you can check the language of OutLook by referencing the Type Library of OutLook and getting the value of
Application.LanguageSettings.LanguageID(msoLanguageIDUI) (VB6.0 and VBA in OutLook syntax )
This is a Long data type representing the Language ID. For example 1033 is for English language.
You can see all of the values for language ID in “Object browser” in Visual Basic editor by searching for LanguageID.
In C# syntax is:
Outlook.Application ptlApp=new Outlook.ApplicationClass() ;
System.Diagnostics.Debug.WriteLine(ptlApp.LanguageSettings.get_LanguageID( Microsoft.Office.Core.MsoAppLanguageID.msoLanguageIDUI).ToString());
If You use VC++ you can use #import directive for importing of Type library of OutLook but the syntax will look different.
IKH
|
|
|
|
|
This information is stored in the registry, you shouldn't include a typelib or the Primary Interop Assemblies if that's the only reason you are using them. No reason to make you application weigh more than it needs to be. See my post above for further information.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks for the hints, I will have to have a look, if the registry is accessible in every account here, because there are some very restricted ones, but as far as I do know this shouldn't be a problem reading the registry, does it?
I just wondered if I it is possible to do some further steps, like trying to "talk" to special fields in Outlook (see my other thread importing Outlook data[^]). Because my aim is to read some data out of Outlook contacts, which I do drag&drop into my application. But my application should be able to do this without being dependend on the language. So for example if the user chose the business number to be draged&dropped then there shouldn't be any difference no matter if the language was German, English or French. So my first idea was to access the contacts or the drag&drop item respectively and adress the datafield. But then I realized the drag&drop object is an array of strings and there are just those fields which have been filled in.
So last idea is to check the fieldnames via the Outlook object. Because then I do know what to match it with.
E.g. if my application checked English to be the language and I do want to drag&drop the business number, then I do want to read the fieldname which I have to parse out of my string array. Because then I do not have to store the fieldnames for all of the supported languages e.g. in a file or anywhere else. But I am not sure if I am just able to read data items and not the headers meaning all fieldnames.
So do you have any idea if I had to carry the fieldinfos for every language with me or if I am able to check the fieldnames because then I could switch from just checking the language to checking the fieldnames and so knowing which "token" to look for in my stringarray.
Stephan.
|
|
|
|
|
Hi, I saw your post above and you are absolutely right that reading the value LastUILanguage from registry is more efficient and it is not connected with increasing of weight of the application.
IKH
|
|
|
|
|
One of the features stopping us migrating to C# from VC++ is the limited windows form styles. In a VC++ dialog box we can set the dialog box to have no borders and pop-up style.
I cant seem to find a way setting a windowsform to have no border in C#/MC++, I wonder if this is possible at all?
many thanks
|
|
|
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
You can set it through the properties or in code as above, valid styles are:
Fixed3D :A fixed, three-dimensional border.
FixedDialog : A thick, fixed dialog-style border.
FixedSingle : A fixed, single line border.
FixedToolWindow : A tool window border that is not resizable.
None " No border.
Sizable : A resizable border. (Default)
SizableToolWindow : A resizable tool window border.
Gary
"A fellow with the inventiveness of Albert Einstein but with the attention span of Daffy Duck."
Tom Shales talking about Robin Williams
|
|
|
|
|
Hi Gurus,
I got some kind of unusual program to do...
I am viewing a web page in Internet Explorer 6.0, and I got a flash object in that page. So, I want to ask you if it's technically possible to write program that will send onclick message to the Internet Explorer window? And if it does can you give me some help how to do this thing, please. Or maybe some links would be helpful too...Thanx.
xedom developers team
|
|
|
|
|
Alex Getman (leTaon) wrote:
o, I want to ask you if it's technically possible to write program that will send onclick message to the Internet Explorer window?
Yes, you can P/Invoke SendMessage and pass the BN_CLICKED message. You will need to the HWND (handle) of the button itself for the SendMessage call as well. You can programmatically iterate through each window using FindWindow . Spy++ may also be of some help to you depending on specific implementation.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanx for your answer...Could you please give me some links or code samples
of SendMessage, HWND and FindWindow usage? Or some articles would be helpfull...
xedom developers team
|
|
|
|
|
Alex Getman (leTaon) wrote:
Could you please give me some links or code samples
of SendMessage, HWND and FindWindow usage?
Reading MSDN[^] will be very helpful. In particular, SendMessage is documented here[^], however because it is a native method, you will need to use P/Invoke to gain access to it. Reading about the DllImportAttribute Class[^] will be helpful. Also, you can read about P/Invoke here[^]. In .NET, a HWND or handle is of data type IntPtr . The SendMessage declaration should look like this:
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam,
IntPtr lParam);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi,
I have an application for which I must create a Setup package. The package allows the user to enter some information in a text box (during the installation). I have used Textboxes(A) for this purpose. The textbox must contain a default value when presented to the user during the installation. This default value must be set dynamically. Is there some way this can be done... maybe the Setup Package reading an ini file and putting the value from the file into the text box during the installation?
I don't know if and how ini files can be read during the installation.
|
|
|
|
|
You set the EditNProperty to a property name, typically upper case (so it can be changed on the command-line as a protected property, though, IIRC, VS.NET doesn't use this (it's very limited in functionality when it comes to Windows Installer packages). You can set the initial value using EditNValue .
After compiling the MSI package, you can also use Orca from the Windows Installer SDK (go to http://msdn.microsoft.com/platformsdk[^] to download it, though Orca is a separate install within the downloaded files; in the bin directory, install Orca.msi) to add that same property name to the Property table with the initial value.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I already have used the Edit1Property and have set it to "URL". What I need is to be able to fill the Edit1Value dynamically, read from a text file maybe, and be displayed to the user.
Think of it as evolution in action
|
|
|
|
|
You have to write a custom action for that, and writing a .NET Installer class derivative won't work. You must write a native custom action (see the Windows Installer SDK for details), and VS.NET does not support that.
It can be read from the command-line, though, if you use something like this:
msiexec.exe /i MyPackage.msi URL=http: I suggest you read through the Windows Installer SDK.
The VS.NET Windows Installer project is very limited, as I mentioned before. Trust me - I've been working with Windows Installer since 1.0 beta many years ago and have been a consultant for numerous companies for Windows Installer-related development. VS.NET's Installer project is meant to be quick and simple and does not expose a UI for a majority of what's possible.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hai there,
i need a small openion from your side. i have one project (ERP for Education Institution) in VB. the reprts and database are created by power builder and sybase.
Right now , i planned to upgrade it to dotnet. Before that let me say one thing. I have no intension to update or upgrade my reports and database. i am only to upgrade other phases of this project.
1. According to you, which dotnet language is most perfect match for this senario.
2. Upto how much extend i can make it updated using C#.net ?
3. is there any tutorial or urls that will help me to kick start this upgradation job ?
i am confort in C# than vb.net.
thanks
********************
S r e e j i t h S S N a i r
Bangalore - India
********************
|
|
|
|
|
sreejith ss nair wrote:
. According to you, which dotnet language is most perfect match for this senario.
It doesn't matter which language you use. Whatever your compfortable with.
sreejith ss nair wrote:
Upto how much extend i can make it updated using C#.net ?
What???? This made no sense what-so-ever....
sreejith ss nair wrote:
is there any tutorial or urls that will help me to kick start this upgradation job ?
No. Your rewriting an application. It's up to you to figure out the requirements, design and build. You already have a tempate to work from if you have the PowerBuilder source.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I use MDI form in my C# project,
each MDI child form has a PictureBox on it,
When I load my saved project,
I use
myPicture.PictureBox.Image = Image.FromFile(path);
to set the image show on PictureBox.
But in my project sometimes I need to insert a new Page,
so I write
<br />
for(int i=Page_number-1; i>IntSelectPage; i--)<br />
{<br />
((MyInkPicture)myAL[i]).PictureBox.Image = ((MyInkPicture)myAL[i-1]).PictureBox.Image;<br />
} <br />
to show the correct image of each page,
Now there is a big problem,
When I want to save my changes,
<br />
PictureBox.Image.Save(savepath,System.Drawing.Imaging.ImageFormat.Bmp);<br />
for example,
because original PictureBox[2]'s image now is PictureBox[3]'s image,
if I want to save image by "Picture2.bmp",
it would tell me "Picture2.bmp" is in use...I can't overwrite it!!
Can anyone tell me how to load a picture form a set file path,
and if the image changes, I can overwrite it...??
Thanks a lot !!
|
|
|
|
|
Clone the original image then dispose it so that you have a copy of the image, not an image from a file (which uses an open file handle, leaving the file in use):
using (Image img = Image.FromFile(path))
myPicture.PictureBox.Image = (Image)img.Clone(); The using statement here makes sure that the object is disposed when the block is complete, even in cases when an exception is thrown.
Also - just a suggestion - I'd recommend you encapsulate myPicture.PictureBox.Image , exposing the Image property on your class by defining it like so:
public System.Drawing.Image Image
{
get { return PictureBox.Image; }
set { PictureBox.Image = value; }
} This ensures that callers can directly modify your PictureBox control. This makes for a better object-oriented design.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I add two TextBoxes snd a checkbox to a panel, each time I click on the add button. Each have a unique name. I can add them fine, I need to remove them according to the checkbox's checked property. I first need to know whether a checkbox is selected, then I need to traverse all the checkboxes and if they are seleted, I need to remove the corresponding texboxes.
I use:
if(this.pnl1.Controls.Contains(CheckBox))
{
// how to check each checkbox
}
Help!
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
I just tried to solve the problem logically. May be you get some better solution.
for(int i =0; i < this.Controls.Count; i++)
{
if(this.Controls[i].GetType().ToString() == "System.Windows.Forms.CheckBox")
{
MessageBox.Show(Controls[i].Name);
}
}
Do revert back whether it solves your purpose or not.
Regards,
Jay.
|
|
|
|
|
Thanx bro..
I'll try this later, if you don't mind.
But it looks like it might work. thnx 'gain.
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Or even shorter, without string comparison and getting the cast from Control to CheckBox for free:
foreach (Control c in this.pnl1.Controls)
{
CheckBox cb = c as CheckBox;
if (cb != null)
{
MessageBox.Show("Checkbox "+cb.Name+" checked: "+cb.Checked);
}
}
mav
|
|
|
|
|
But here CheckBox cb variable is created for each round of execution of the loop. I do not know whether this can be said as more optimized.
Regards,
Jay
|
|
|
|
|
Ok, you can take the CheckBox cb and put it outside the loop if that's your only concern...
Or you yould use
if (c is CheckBox)
{
CheckBox cb = c as CheckBox;
}
I found the is keyword very handy instead of fiddling with GetType().ToString() and then comparing to the quite verbose (and thus prone to typos) fully qualified type names.
mav
|
|
|
|
|
I am writing an application to change the inputlanguage and culture using C#. I am trying to find out whether selected language is written left-to-right or right-to-left to set right-to-left property of my control accordingly. Is there any way to find this ? Please Help!!
Naqvi
|
|
|
|