.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

How can I...

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :.NET Framework


These are the functions we have to call using P/Invoke because we can't find anything in the .NET library to do this. I'm asking here in case we missed something. So is there a way to do any of the following in managed code? Preferable in .NET 3.5 because a couple fo our DLLs are J# and so we can't go to .NET 4.0.

  1. Get the DPI of the video display - we presently do CreateDC("DISPLAY", ...
  2. Get the 8.3 form of a filename.
  3. Play & stop a MIDI file.
  4. Set a window as the foreground window.
  5. Determine if a string can be displayed with a given font (ie are all the needed glyphs in it) - we use GetGlyphIndices()
  6. Set a Form owner and/or parent to a non .NET Window (ie pass an IntPtr) - we need this because we are on Office AddIn and need to set the parent/owner to be the main Office window at times.
  7. Get the window rectangle of a non .NET window - ie we have an IWin32Window, not a Control.
  8. Make a MessageBox topmost
  9. Get the Icon for a file extension - we fine the default app int he registry and then call ExtractIconEx()
  10. Enum all windows (not just .NET ones) to find one by class and caption? We use this to find the main Word/Excel/PPT window our AddIn is running in.
  11. Read a file from a share that requires a username & password. We presently use LogonUser().

    View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend