Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Help with P/Invoke question in Win NT 4.0!

Help with P/Invoke question in Win NT 4.0!

Scheduled Pinned Locked Moved C#
helpquestioncsharp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CodeFriendly
    wrote on last edited by
    #1

    I have built a .net control which works well in XP and Win 2000, but fails in NT 4.0 and throws an exception FileLoadException. Why would it fail in NT and work well in Win2000 and XP? In my code, where I am declaring P/Invoke functions, I have the following: [DllImport("uxtheme.dll")] static public extern int SetWindowTheme(IntPtr h, string s1, string s2); But the thing is I do not call this unmanaged function in my entire control's source code. Its just declared. That's all. Do you think this could be causing the problem of FileLoadException when I try to run it in NT 4.0 (because there is no uxtheme.dll in NT 4.0). Note that although I have declared it in my code, I never call this function at all. Do you think I need to remove this declaration from my code and rebuild it to run it in NT 4.0 box.

    A 1 Reply Last reply
    0
    • C CodeFriendly

      I have built a .net control which works well in XP and Win 2000, but fails in NT 4.0 and throws an exception FileLoadException. Why would it fail in NT and work well in Win2000 and XP? In my code, where I am declaring P/Invoke functions, I have the following: [DllImport("uxtheme.dll")] static public extern int SetWindowTheme(IntPtr h, string s1, string s2); But the thing is I do not call this unmanaged function in my entire control's source code. Its just declared. That's all. Do you think this could be causing the problem of FileLoadException when I try to run it in NT 4.0 (because there is no uxtheme.dll in NT 4.0). Note that although I have declared it in my code, I never call this function at all. Do you think I need to remove this declaration from my code and rebuild it to run it in NT 4.0 box.

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      Wow! I'm amazed you actually got it to work on windows 2000. uxtheme is a feature for windows xp and newer only. its not possible for it to work on older version of windows

      C 1 Reply Last reply
      0
      • A Alex Korchemniy

        Wow! I'm amazed you actually got it to work on windows 2000. uxtheme is a feature for windows xp and newer only. its not possible for it to work on older version of windows

        C Offline
        C Offline
        CodeFriendly
        wrote on last edited by
        #3

        No need to be amazed at all! I found the answer to my problem. Anyway, for your information, it will work in Win 2000 without any problem because the uxtheme P/Invoke function was "just declared" in the code and "was never actually used" or "called" and hence there is no issue for it to be running properly in Win 2000.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups