开发者

OPenFileDialog in win 7

whats wrong with OpenFileDialog in win 7 ? i used to do like this :

        OpenFileDialog file = new OpenFileDialog();

        file.InitializeLifetimeService();

        file.InitialDirectory = Application.StartupPath;

        file.ShowDialog();

b开发者_运维百科ut in win 7, programe goes to "not responding" state. thanks


This is just a guess, but in general, calling ShowDialog without passing the parent window is usually a bad idea: it simply uses the currently active window as the parent in that case which is not always what you want or expect.

Also, you never need to call InitializeLifetimeService manually: that is called for you automatically as part of the cross-domain marshalling stuff.

In addition, you should try breaking in to your program with a debugger and look at the state of the threads: what are the call stacks, what are the threads doing, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜