|
Gimpy1983 wrote:
What do you think could be the problem?
Your statements above are rather nebulous. If you have a programming question where you can be more specific there are many on here willing to help you out.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi!
The problem is as follow:
I have sockets and I use the async methods (the ones starting with .Begin...() ). This means i need ManualResetEvent (or AutoResetEvent for that matter but I choose Manual one so I have more control).
I can connect to the server with BeginConnect() and the ManualResetEvent works alright but when I try to send with BeginSend the ManualResetEvent is also alright.
The problem begins on the server side. I have a ReceiveCallback method which gets called when data gets send to the listening socket. Sometimes all the data get sent correctly (well the ManualResetEvent.Set() seems to work) BUT no data is received on the server side... where do you think the problem could be between the time the data is sent and received because I really don,t see and it's been like 2 weeks I'm trying to figure it out.
Thanks a lot
----------------------
Be proud. Be yourself.
|
|
|
|
|
What is the best way to capture data received with WM_COPY_DATA in a C# application?
|
|
|
|
|
See this article and accompanying code, Examples written in both C# and VB.net
http://www.vbaccelerator.com/home/NET/Code/Libraries/Windows_Messages/Simple_Interprocess_Communication/article.asp
ERobishaw
|
|
|
|
|
Hi all
Please can someone help me. I'm trying to increase the text size of a third party window.
I currently have the hwnd of the window using the FindWindow function.
Any help in pointing me the right direction will be greatly appreciated.
Dave
|
|
|
|
|
You'd have to enumerate all the windows (controls) in the window and, first, get their current font, change it, then set it again. You'll need to P/Invoke EnumWindows and SendMessage , as well as define WM_GETFONT (0x31) and WM_SETFONT (0x30). You may also need to define various GDI methods for creating an modifying fonts in this way.
Because of all that's required to P/Invoke, you might consider developing a Managed C++ assembly that uses native APIs and exposes this functionality as managed code. This allows you to use native APIs while providing an assembly that other managed languages can use and could potentially save you a lot of time having to P/Invoke lots of methods and defining lots of structs and consts.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey all, I'm trying to programmatically fill RichTextBox's Rtf property, I have an Xml file thats built like
CP breaks the XML, so here's a tree representation:
Paragraphs
Paragraph
Header
Content
I then iterate through all paragraphs and if the header isn't empty, i add it like so:
string rtbContent += "\b" + headerNode.InnerText + "\b0";
but when I set the RichTextBox's Rtf Property to rtbContent, it throws an ArgumentException stating the string is in the wrong format...
Why, the Rtf property is a string, and so is my variable...
|
|
|
|
|
You probably do not have the entire text wrapped with RTF formatting strings. For example, below is just a string of text typed into wordpad then viewed in Notepad.
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.15.1503;}\viewkind4\uc1\pard\f0\fs20 This is RTF text\par
}
|
|
|
|
|
When assigning the Rtf property, you must include all necessary RTF information, including the RTF headers. See the RTF 1.6 Specification[^] on MSDN for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi everyone,
I'm having some serious issues with the Windows ComboBox control. I'm using it inside a 3rd party wizard control (which I found here on CP) and when the page of the wizard where this ComboBox is is loaded, it gets populated with items - using the following code:
<br />
if(md.Topics.Count>0)<br />
{<br />
this.comboBoxTopicsDel.ValueMember="TopicID";<br />
this.comboBoxTopicsDel.DisplayMember="TopicTitle";<br />
this.comboBoxTopicsDel.DataSource=md.Topics;<br />
}<br />
else<br />
{<br />
this.comboBoxTopicsDel.DataSource=null;<br />
}<br />
This works fine everytime the page containing the ComboBox loads, until the moment when an item is deleted from the Topics ArrayList. After that, the ComboBox will only show TopicData for each item, even if its DisplayMember and ValueMember are set correctly.
Am I doing something stupid? What am I supposed to do before re-binding the ComboBox to ist data source when this happens?
Thanks in advance (insert a lot of clueless smileys here)
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
One of my friends suggested to do BindingContext[...].SuspendBinding(); before and BindingContext[...].ResumeBinding after the item is removed from the md.Topics ArrayList and it seems to work fine now!
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Hy everyone!
What I want to do is trying to check the language of Outlook (I don't mean the language Outlook had been written in; I do mean the language of the menues, promts etc.).
Meaning I do want to send a kind of request to Outlook telling it's language, so I am able to do some internationalisation. Because I do not want my code depend on "a special language", meaning my application should check the language and if it is English, it should use the "English style", if it is German it should use the "German style", if French the "French style" etc. (style means the keywords for example or menu items etc.)
So if anyone of you knew how to check this in C# it would help me a lot!
Thanks!
Stephan.
|
|
|
|
|
You do not need to do it this way. You can write you application so it is localized in different languages without the reliance of Outlook. You need to look at the ResourceManager class here[^]. The ResourceManager will extract resources from your assembly. You will specify the CultureInfo based on the current thread, this is what tells the ResourceManager which *language* (i.e., the culture) is used and to extract the appropriate resources. A simple example is as follows:
ResourceManager rsmgr = new ResourceManager("entries", Assembly.GetExecutingAssembly());
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
string msg = rsmgr.GetString("title", ci);
- Nick Parker My Blog | My Articles
|
|
|
|
|
am I also able to check if Outlook is English and the rest of the system is lets say in German?
Because my application should depend on the "language of Outlook" which could differ from the rest of the program languages installed on the system (like described above).
Because as far as I know, the CultureInfo only checks which selection you did in Windows control panel, but it does not check, if you installed a different Outlook version in a different language, or does it?
Because I do also have to be prepared for things like that (difference between cultursetting and Outlook language e.g.).
That's why my first intention was directly checking the language of Outlook.
Stephan.
|
|
|
|
|
Stephan Wright wrote:
am I also able to check if Outlook is English and the rest of the system is lets say in German?
If for some reason you want to specifically rely on Outlook being installed you can check the registry for an Outlook hive (mine was HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook ), you will find a REG_DWORD entry titled LastUILanguage . On my machine the value was 0x00000409, the integer value is 1033 of that which identifies the language as "English - United States" per the Locale ID (LCID) Chart[^].
- Nick Parker My Blog | My Articles
|
|
|
|
|
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
|
|
|
|