473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to control opening form

Hi .
i wirte a text chat program. in PM mode i have problem .
for first time when one of the client try to send pm to other one everything is fine and it work well. but next time if the same client try to send second line in second client machin the PM form open agine (as long as the first client send pm second one get more open page of PM )
i will put code here plz if anyone can help .

Expand|Select|Wrap|Line Numbers
  1.  
  2. #region PM
  3.         [DllImport("user32.dll", SetLastError = true)]
  4.         internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  5.         [DllImport("user32.dll", SetLastError = true)]
  6.         internal static extern long GetClassName(IntPtr hwnd, [Out] StringBuilder lpString, int nMaxCount);
  7.         public static IntPtr isExist(string title)
  8.         {
  9.             IntPtr hwnd = FindWindow(FormClassName.ToString(), title);
  10.             return hwnd;
  11.         }
  12.         private static PM getPM(IntPtr hwnd)
  13.         {
  14.             PM x = (PM)FromChildHandle(hwnd);
  15.             return x;
  16.         }
  17.         public void OpenPmDel(string all)
  18.         {
  19.             Invoke(new Classes.DLLClient.RecievePm(OpenPm), all);
  20.         }
  21.         public void OpenPm(string All)
  22.         {
  23.             string[] info = All.Split('#');
  24.             string Sender = info[0];
  25.             string Reciever = info[1];
  26.             string Size = info[2];
  27.             string Bold = info[3];
  28.             string Italic = info[4];
  29.             string color = info[5];
  30.             string Text = info;
  31.             Color clrPm = Color.FromName(color);
  32.             GetHtml a = new GetHtml();
  33.  
  34.             string pm = a.PM(Sender, Text, Size, clrPm, bool.Parse(Italic), bool.Parse(Bold));
  35.             pm = a.GetSmily(pm);
  36.             string path = Application.StartupPath + "\\Data\\" + Sender + ".html";
  37.             if (File.Exists(path) == false)
  38.             {
  39.                 FileStream WritePm = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
  40.                 StreamWriter WP = new StreamWriter(WritePm);
  41.                 WP.WriteLine("<body onLoad=\"window.scroll(0,100000)\">");
  42.                 WP.Close();
  43.             }
  44.             File.AppendAllText(path, pm);
  45.             IntPtr myPM = isExist(Sender);
  46.             if (myPM.ToInt64() > 0)
  47.             {
  48.                 PM Opened = getPM(myPM);
  49.                 Opened.Ready();
  50.  
  51.             }
  52.             else
  53.             {
  54.                 PM p = new PM();
  55.                 p.Reciver = Sender;
  56.                 p.Text = Sender;
  57.                 GFX.NotifyWindow.NotifyWindow n;
  58.                 n = new GFX.NotifyWindow.NotifyWindow("Private message", "Private message az " + Sender);
  59.                 n.SetDimensions(200, 100);
  60.                 n.Notify();
  61.                 p.Show();
  62.  
  63.             }
  64.         }
  65.  
  66.    #endregion
  67.  
  68.  
Feb 11 '08 #1
0 707

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: ckerns | last post by:
I want to loop thru an array of controls,(39 of them...defaults = 0). If value is null or non-numeric I want to assign the value of "0". rowString = "L411" //conrol name if (isNaN(eval...
8
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the...
1
by: John M | last post by:
I have a Tab Control on a form which holds all my main data entry forms. It has (at the moment) 7 tabs, most of which have a form with a subform (or 2) on them. Most of the forms involved have some...
6
by: Ken Breit | last post by:
I have an ActiveX control that I would like to make available from any form in my application. I figured the best way was to create a reference to it, and then have a module that will create the...
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
4
by: MLH | last post by:
I have a report and on it, a subreport control Main Report Name: rptInvoiceMain Sub Report Name: rptInvoiceSubReport SubReport Control Name: rptInvoiceSubReportCtl The...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
3
by: ApexData | last post by:
I'm starting a new project. A Personnel System. I have considered opening a single bound form to the main employee table. The user can scroll the records to any individual. I would like to have a...
3
by: EManning | last post by:
I''m having problems getting a form to open while going from one tab to another. I have a tab control: one tab for counties and one tab for cities. Both tabs have multi-select listboxes. If...
5
LAD
by: LAD | last post by:
Using Access 2003 on Windows 2000. My Skill Level: Med Low (Some VBA, okay with Access) Form: Single View - based on Query of single Table to sort by field. Application: Dealers email 'contract...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.