|
hi guys ;
I have couple of Qustion for whom create User Control using C# I want to create a plug for VS 2008 to read the comment and do the spill checker i used the COM Interoperability form MS word Office I used this Article in MSDN
http://msdn2.microsoft.com/en-us/library/ms173188(VS.80).aspx
but I didn't used the text box I used the rich text box control and add a button to check the comment but my main problem is how to make it read the comment after the "// or /* */ " charater can any body guide me to complete task
and thank you
|
|
|
|
|
I need to hide all open active forms in my application (and be able to bring them back later to their exact state). This is a security function for which there is an external requirement, and I can do nothing to manage.
My first test was to use the Application.OpenForms to iterate through all open forms and then hide them (by setting Visible = false). This gives a problem if I have a modal dialog open at the time - it gets closed (with DialogResult getting set to Cancel). I just want to hide it temporarily, and bring it back later, so this doesn't help.
My second idea was, rather than close the forms, to resize them to 0,0, move them off screen, and remove them from the taskbar. If I remove them from the taskbar, then they disappear from the OpenForms collection, and do not get re-added if I add turn the taskbar back on. This appears to be a "known issue" with using OpenForms.
So, has anyone got any ideas how to achieve this?
If I could iterate through all open forms for my process without using Application.OpenForms (any win32 way?) perhaps I could manipulate the showintaskbar without worrying? Or perhaps there is an alternative way to hide the window and restore it that someone can think of that doesn't result in a model dialog form getting closed rather than just becoming invisable
Best wishes
James
|
|
|
|
|
Here are some ideas:
- you could change the window location to large negatives, without changing size
or visibility;
- you can keep your own list of windows together with their original properties;
- if necessary, you can get a complete list of all windows by using P/Invoke to
win32 functions, as in:
public static ArrayList GetVisibleWindowHandles(bool withChildren) {
list=new ArrayList();
int parm=0;
if (withChildren) parm=1;
LP_User32.EnumWindows(new LP_EnumWindowsProc(CollectVisibleWindows), parm);
log(env.DETAIL1, "There are "+list.Count+" visible windows");
return list;
}
private static bool CollectVisibleWindows(IntPtr hWnd, int lParam) {
if(IsWindowVisible(hWnd)) {
list.Add(hWnd);
if (lParam==1) {
EnumChildWindows(hWnd,
new LP_EnumWindowsProc(CollectVisibleChildWindows), 0);
}
}
return true;
}
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern int EnumChildWindows(IntPtr hParent,
LP_EnumWindowsProc ewp, int lParam);
public delegate bool LP_EnumWindowsProc(IntPtr hWnd, int lParam);
BTW: You may want to use a List instead of an ArrayList.
|
|
|
|
|
Luc
I'll give this a go - you have a callback function defined "CollectVisibleChildWindows" which you haven't given the code for.
The only reason I didn't want to just move to an off-screen location was that the windows would still exist within the taskbar, and (probably) users could interact with them through a right click - to maximise them and bring them back on screen for example. If I could remove them from the taskbar as well then this would be solved.
Best wishes
James
|
|
|
|
|
sorry about that, the stuff is spread over several files here.
private static bool CollectVisibleWindows(IntPtr hWnd, int lParam) {
if(LP_User32.IsWindowVisible(hWnd)) {
list.Add(hWnd);
if (lParam==1) {
EnumChildWindows(hWnd,
new LP_EnumWindowsProc(CollectVisibleChildWindows), 0);
}
}
return true;
}
private static bool CollectVisibleChildWindows(IntPtr hWnd, int lParam) {
if(IsWindowVisible(hWnd)) list.Add(hWnd);
return true;
}
[DllImport("user32.dll", CallingConvention=CallingConvention.StdCall)]
public static extern bool IsWindowVisible(IntPtr hWnd);
|
|
|
|
|
I have made some progress with this, but have hit a barrier. My win32 knowledge is probably not good enough
Since hiding a dialog box closes the dialog box, which doesn't allow me to restore state I have looked at moving the windows.
I enumerate through the windows with EnumThreadWindows to get the window handles.
Foreach window:
1. call GetWindowPlacement to get the current details (and store them)
2. change the normal position to off screen
3. call SetWindowPlacement with the showcommand set to SW_RESTORE twice
I have to call SetWindowPlacement to get the window to move properly if it is in a maximised state.
On restore:
I call SetWindowPlacement with the stored details
This is all fine, except the window remains in the taskbar. A user can just right click and move, maximise etc then window to bring it back.
So I need to get it off the task bar - or at very least disable all of these functions.
To remove it from the task bar, I have tried this code to remove the WS_EX_APPWINDOW style and set the WS_EX_TOOLWINDOW style. However, whilst the window changes its style it does not get removed from the taskbar. Any clues?
int istyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
istyle = istyle & (~WS_EX_APPWINDOW);
int lResult = SetWindowLongW(hWnd, GWL_EXSTYLE, istyle);
//istyle = GetWindowLongW(hWnd, GWL_EXSTYLE);
istyle = istyle | WS_EX_TOOLWINDOW;
SetWindowLongW(hWnd, GWL_EXSTYLE, istyle);
Best wishes
James
|
|
|
|
|
Hi James,
FYI: if you develop a .NET app and set Form.ShowInTaskBar false, it works fine, i.e.
that form is not shown in the task bar. Hitting ALT-TAB brings up the task switcher,
which does not show such a form, since it is not shown in the task bar.
However, on XP some alternative task switchers (Such as the one in Microsoft PowerToys)
DO show the apps/windows even if they are not shown in the task bar. It must be a bug in
the task switcher utility, but I have never seen a solution for it.
|
|
|
|
|
Hi Luc
Yes, I know on form creation you can remove the window from the taskbar. But if you recall I'm trying to hide the forms while the application is "locked" then bring them back.
Best wishes
James
|
|
|
|
|
Hi, my previous message was a warning that others, including Microsoft, failed to do
correctly what you intend...
|
|
|
|
|
How to restore a form(say form1) if the form is minimized, by clicking on submenu(say menuform1).
Thanks in advance.
regards,
Niradhip
Niradhip
|
|
|
|
|
Hi Niradhip,
In regards to your query I would suggest you to you set minimized form's WindowState property to Normal or Maximized.
Like:
frm.WindowState = FormWindowState.Minimized
I hope this helps.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Hi fri..
I need coding to Update and delete a row in datagrid control. Can
anyone tell me how do to this. (Iam using .Net winform as
designing tool MS access as backend tool and c# coding...
Plz send coding to my mail id pravinms07@yahoo.co.in
from
Praveen
M.S.Praveen
|
|
|
|
|
Get it![^]
------------------------------------------------------------
"The only true wisdom is in knowing you know nothing." --Socrates
|
|
|
|
|
I have an MDI app;
This app has 2 forms Form1 and Form2
Form1 has a ComboBox, ComboBox1, which is bound programmatically to a database;
Form2 has a textbox that should display the combobox selection in Form1.
Essentially, what I would like working is:
In the Form1 Button1_Click event,
Dim f2 as New Form2
f2 = new Form2
f2.TextBox1.Text = Me.ComboBox1.SelectedItem.Text
But this does not work.
So I used a Shared variable to retrieve the value of the combobox selection and use that as the value for the textbox in Form2.
Public Class Class2
Private Shared meetName As String
Public Sub New(ByVal mName As String)
meetName = mName
End Sub
'Assign Combobox selection to the variable, used in the constructor
'Provide access to NameOfMeet Property
Public Shared Property NameOfMeet() As String
Get
Return meetName
End Get
Set(ByVal value As String)
meetName = value
End Set
End Property
End Class
In Form1 Button_Click event:
Dim obj As Class2
Try
'Instantiate Form2
Dim f2 As New Form2
f2 = New Form2
obj = New Class2(Me.ComboBox1.SelectedText)
‘While I have instantiated the Class2 (obj), I have not used it anyplace. Is this right?
f2.TextBox1.Text = Class2.NameOfMeet
f2.Show()
Catch ex As Exception
MsgBox("Error: " & ex.Message)
End Try
End Sub
With this code, I get the following display in the Textbox in Form2 (where I would like the ComboBox selection from Form1 to display) ..
“System.Data.DataRowView”.
Your help is appreciated.
Thanks,
Gymnast
|
|
|
|
|
It has to do with how you are loading items into your ComboBox control. You must be binding to a DataSource. You may have to set the ComboBox.DisplayMember and ComboBox.ValueMember and then reference the ComboBox.SelectedValue instead of ComboBox.SelectedItem. Perhaps researching these will point you in the right direction.
Hope this helps.
|
|
|
|
|
i am developing a kiosk application,
on the welcome page i want to show advertise which kiosk specific[that mean each kiosk have its paticular advertise]. and it jpg file,
some one help me how i can handdle advertise.
and admin maintain the advertise process.
some one have demo or idea to handdle, then welcome
thank's
prashant.
prashant kr Yadav
modified on Wednesday, January 09, 2008 9:08:56 AM
|
|
|
|
|
Prashant kr Yadav (MEC) wrote: and it may be image,picture and flash,
What's the difference between image and picture ? A picturebox will show an image. I'm not really sure what you're asking for, it seems so straightforward. To show something in your app you add it to the form that is shown.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i am developing a kiosk application,
on the welcome page i want to show advertise which kiosk specific[that mean each kiosk have its paticular advertise]. and it jpg file,
some one help me how i can handdle advertise.
and admin maintain the advertise process.
some one have demo or idea to handdle, then welcome
thank's
prashant.
prashant kr Yadav
|
|
|
|
|
Well thanks for that. I'm obviously far too stupid to click your original bloody link. I really do need you to copy that post down just in case I missed some subtle nuance. I mean, what's the point of clarifying your original post when it's much easier to post the same old crap and hope that the telepathic helpers happen to stumble on your jumbled, inane ramblings. I'm now going to boil my head to remove the despair you've caused.
|
|
|
|
|
With the introduction of Vista, my previous VB script code that registers a dll using regsvr32 now fails.
So I've scanned the blogs on the subject and found that calling shellexecuteex will get round the access (elevation) issue.
I found the following code and modified it to call regsvr32
#include <windows.h>
#include <shellapi.h>
int __cdecl main(int argc, char **argv)
{
if (argc == 3) {
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.fMask = SEE_MASK_FLAG_DDEWAIT;
sei.nShow = SW_SHOWNORMAL; // added 27 Nov
sei.lpVerb = argv[1];
sei.lpFile = argv[2];
ShellExecuteEx(&sei);
}
return 0;
}
so at the Command prompt I type
'executable name' regsvr32 ddlname
and get the following error message (well words to that effect)
"unknown file type. File needs to be associated via Control panel".
If I typed
'executeable name' open filename it works fine and opens the <filename>.
How / what is missing when I run regsvr32 using shellexecuteex?
many thanks,
ian</filename>
|
|
|
|
|
I am working in C++/CLI with Windows Forms and I want to have my compiled html help point to a topic specific to where the mouse is pointing (like as a menu item) but I can't seem to determine which control the mouse is hovering over.
private: System::Void FrmMain_HelpRequested(System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent)
{
Point pt = this->PointToClient(hlpevent->MousePos);
Control^ requestingControl = dynamic_cast(sender);
Control ^ctrl = this->GetChildAtPoint(pt);
Control ^ctrl2 = this->ActiveControl;
if( File::Exists(this->helpProvider->HelpNamespace ) == true)
{
Help::ShowHelp(this, this->helpProvider->HelpNamespace);
}
}
ctrl is the form itself and crtl2 is the last active mdichild in my application.
requestingControl returns the form (same as ctrl)and not the item the mouse is over.
Hope someone can help
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
I work in vb.net, and each control has it's own Help_Requested event...which fires when you click on the control (the textbox or label or whatever...) while you have the help mode activated. Perhaps it is similar in your language.
Hope this helps.
|
|
|
|
|
Got worked out. Here is my final code.
for each ( ToolStripMenuItem ^tmpMS in this->menuMainForm->Items )
{
for each ( ToolStripItem ^tmpCntl in tmpMS->DropDownItems )
{
if (tmpCntl)
{
if ( tmpCntl->Selected )
String ^tmpCntlName = tmpCntl->Name;
OpenHelpForMenuItem(tmpCntlName);
}
}
}
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Hi,
I have one remote method (http) which is placed on server (particular machine).
say http://swserver/MMServer
Now I want to check whether that server's method/service is available or not.
Help me out.
Thank you.
|
|
|
|
|
There's no other way to do it other than to try and call it. If it errors out, it's down.
You can PING the machine, but that only tells you if the TCP/IP stack is working. It doesn't tell you if the service your method is in is running. There's no way to tell that other than trying to call it.
|
|
|
|