1

im having a similar problem like the solution here Prevent main form from appearing when showing another form . but some of the suggestions were to minimize the main app so it doesnt show, which i cant do because my main app is supposed to be a desktop to be underneath all other apps to replace the windows desktop. And the second forms are supposed to be sticky notes. so i cant minimize the main window cause it has the user background and other controls. i tried making the parent of the notes a Nothing pointer, a pointer to the desktop, creating the form through a dll but i had no success.

My main problem is that when i click a note (form2) form1 comes up, even with form1 having the WS_EX_NOACTIVATE in the createparams. form1 does the form2.show() but they shouldn't be attached.

Another reason im having trouble with the solutions preseted in that post is that they are for delphi and im doing it in vb.net.

All i need is being able to click on the controls and write in the note without bringing the main form behind the note. either making them independent, or making the note not focusing the first form or being able to operate the note without it activating. i dont know. my last resource is to attach my main form to the desktop but i've heard is the worst thing you can do because it can cause problems hanging the system.

Community
  • 1
  • 1
superjugy
  • 301
  • 4
  • 12
  • I'm not 100% sure I'm following you but it appears that form1 is displaying in the background before showing form2? If so, have you tried setting Form1.Visible = False or Form1.Opacity = 0 before calling Form2.Show()? – Michael Minton Jun 20 '11 at 19:31
  • ok, let me clarify. form1 is a maximized borderleess form that sits on the desktop. to do that i used the API setPosition and send it to the back of Zlayer and put the noactivate option. after that i create the form2 from form1 and do .show(). everything goes right until now. but as soon as i click on form2, form1 comes to the foreground with form2. form2 is still over form1 so i can see form2 but form1 is now over all other apps like word. i can alt tab to see them again but i dont want form1 to never come to foreground. i want a AlwaysOnBottom option to stick it to the desktop. – superjugy Jun 20 '11 at 20:59
  • You may want to consider changing your design a bit and have form2 be a separate executable that form1 shells. You can redirect standard input/output to interact with the form2 process. – Michael Minton Jun 21 '11 at 16:49
  • well, i finally decided to attach form1 to desktop and make it an MDI window. this way all form2 are under Form1 and because of form1 being attached to desktop they never come up. to attach it to desktop i used the setParent and FindWindow API functions searching for the desktop handle as Program Manager. – superjugy Jun 21 '11 at 19:56

1 Answers1

0

If you want both forms to co-exist but don't each to interfere with the other: In this case, then you might want to have a third Form that calls both Form1 and Form2 to be opened, and let me suggest and MDI Form with Form1 and Form2 as children forms of the MDI form

'============== my previous post ======================== You can force the user to first dismiss Form2 then allow him to go back to form1 by showing Form2 as Modal form. Here is how to display Form2 as modal

Dim f2 as New Form2
f2.ShowModal()

If that does not work, try this

Dim f2 as New Form2
f2.Show(True)
Ahmad
  • 12,336
  • 6
  • 48
  • 88
  • form2 shouldn't be dismissed, is a sticky note that should hang in the desktop beneath all other programs. im trying to replace the windows desktop with a new one. – superjugy Jun 20 '11 at 20:01
  • i've tried that. i had a mainForm that created a desktopForm and do .show() on it and then created a noteForm and .show() it. the main form was minimized and it had no taskbar botton so it was invisible. and when i cliked the noteForm the desktopForm came to the foreground with the note. it stayed behind the note but still coverred all other apps including the taskbar. – superjugy Jun 20 '11 at 20:17
  • im thinking about the mdi implementation, but then how could i keep the main mdi form or parent window stick to the desktop? – superjugy Jun 20 '11 at 20:26