Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
GeneralRe: Invisible Winform Pin
Big Daddy Farang7-May-09 10:49
Big Daddy Farang7-May-09 10:49 
GeneralRe: Invisible Winform Pin
jspoonermso7-May-09 11:55
jspoonermso7-May-09 11:55 
GeneralRe: Invisible Winform Pin
Dave Kreskowiak7-May-09 14:22
mveDave Kreskowiak7-May-09 14:22 
GeneralRe: Invisible Winform Pin
jspoonermso7-May-09 14:57
jspoonermso7-May-09 14:57 
GeneralRe: Invisible Winform Pin
EliottA7-May-09 10:51
EliottA7-May-09 10:51 
GeneralRe: Invisible Winform Pin
jspoonermso7-May-09 11:45
jspoonermso7-May-09 11:45 
GeneralRe: Invisible Winform Pin
Big Daddy Farang7-May-09 12:00
Big Daddy Farang7-May-09 12:00 
AnswerRe: Invisible Winform Pin
jspoonermso7-May-09 12:31
jspoonermso7-May-09 12:31 
I found a means to do it on the web. The 'Visible' property stubbornly did not work for me. But I was able to use the win32 ShowWindow Function. Code below.

And yes, you guys are correct its better to have a windows service, and it would be better if my third party dll would work without a message pump but its a legacy application. My guess is it uses netdde which is windows message based.





So the fix was to :
using System.Diagnostics;
using System.Runtime.InteropServices;

Then get access to the Win32 ShowWindow API call:

private const int SW_HIDE = 0;
[DllImport("User32")]
private static extern int ShowWindow(int hwnd, int nCmdShow);




Then when the form loads call a function that goes out, finds the app and hides it.
foreach (Process pr in processRunning)
{
try
{
if ((pr.MainWindowTitle == "mywindowname")||pr.ProcessName.Contains("mywindow.exe"))
{
hWnd = pr.MainWindowHandle.ToInt32();
ShowWindow(hWnd, SW_HIDE);
}
}
catch (Exception)
{
}
}
GeneralRe: Invisible Winform Pin
SimpleData10-May-09 6:11
SimpleData10-May-09 6:11 
QuestionAutorun checker and exception handling Pin
Rajdeep.NET is BACK7-May-09 9:49
Rajdeep.NET is BACK7-May-09 9:49 
AnswerRe: Autorun checker and exception handling Pin
OriginalGriff7-May-09 10:11
mveOriginalGriff7-May-09 10:11 
GeneralRe: Autorun checker and exception handling Pin
Rajdeep.NET is BACK7-May-09 20:23
Rajdeep.NET is BACK7-May-09 20:23 
AnswerRe: Autorun checker and exception handling Pin
fly9047-May-09 10:19
fly9047-May-09 10:19 
AnswerRe: Autorun checker and exception handling Pin
Henry Minute7-May-09 10:27
Henry Minute7-May-09 10:27 
GeneralProbably in vain Pin
Luc Pattyn7-May-09 10:32
sitebuilderLuc Pattyn7-May-09 10:32 
QuestionAccepting user inputs in a console app. Pin
Rajdeep.NET is BACK7-May-09 9:18
Rajdeep.NET is BACK7-May-09 9:18 
AnswerRe: Accepting user inputs in a console app. Pin
Jimmanuel7-May-09 10:02
Jimmanuel7-May-09 10:02 
AnswerRe: Accepting user inputs in a console app. Pin
Dave Kreskowiak7-May-09 10:03
mveDave Kreskowiak7-May-09 10:03 
QuestionBackColor issue with main form and the controls Pin
Blubbo7-May-09 8:50
Blubbo7-May-09 8:50 
AnswerRe: BackColor issue with main form and the controls Pin
buachaill cliste7-May-09 9:17
buachaill cliste7-May-09 9:17 
GeneralRe: BackColor issue with main form and the controls Pin
Blubbo7-May-09 9:26
Blubbo7-May-09 9:26 
GeneralRe: BackColor issue with main form and the controls Pin
Henry Minute7-May-09 10:22
Henry Minute7-May-09 10:22 
AnswerRe: BackColor issue with main form and the controls Pin
Jabbar_espania8-May-09 1:51
Jabbar_espania8-May-09 1:51 
Question[Message Deleted] Pin
Ankit Aneja7-May-09 7:41
Ankit Aneja7-May-09 7:41 
AnswerRe: problem with datatype Pin
Dave Kreskowiak7-May-09 10:01
mveDave Kreskowiak7-May-09 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.