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. API Calls from Win2k and Win98

API Calls from Win2k and Win98

Scheduled Pinned Locked Moved C#
helpbeta-testingjsonannouncementcode-review
2 Posts 1 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.
  • J Offline
    J Offline
    Jonathan Austin
    wrote on last edited by
    #1

    Hello, NOTE: This is sort of long/detailed. I know I have been asking a ton of questions lately. Thank you for all of your feedback. I have a custom-drawn listview control that does not highlight the icon while in ListView mode written. I used some of the great painting code provided by Carlos Perez in his UtiltiyLibrary. The problem I am having is that he uses some API SendMessage calls in order to get certain information from the listview. The main thing he is getting is the text of a subitem because when you use Items[1].SubItems[1] (or whatever) you get really weird results. Now the problem I am having is that it doesn't work so well on Win98/ME. I know this is because of the Unicode issue. I have my SendMessage declared as follows: [DllImport("user32.dll", CharSet=CharSet.Auto )] public static extern void SendMessage(IntPtr hWnd, ListViewMessages msg, int wParam, ref LVITEM lParam); Then it is called with: SendMessage(Handle, ListViewMessages.LVM_GETITEMTEXTW, row, ref lvi); ListViewMessages.LVM_GETITEMTEXTW is defined as (LVM_FIRST + 115) This works great on Win2k. But if I run it on Win98/ME, the Text that is return into lvi is just the first letter. If I change the GETITEMTEXTW to (LVM_FIRST + 45), it will work prefectly on Win98/ME but it does not work correctly on Win2k (just get black bars). I have tried changing the CharSet and making EntryPoint="SendMessageA" on the DLLImport, but nothing works. I have a few other SendMessage calls too that use the Unicode message and I'm afraid that they won't work either. I have a list of the non-unicode messages, I just need to know to use the same message number is both the Win2k and 98/ME version. Thanks for reading this really long message. Jonathan

    J 1 Reply Last reply
    0
    • J Jonathan Austin

      Hello, NOTE: This is sort of long/detailed. I know I have been asking a ton of questions lately. Thank you for all of your feedback. I have a custom-drawn listview control that does not highlight the icon while in ListView mode written. I used some of the great painting code provided by Carlos Perez in his UtiltiyLibrary. The problem I am having is that he uses some API SendMessage calls in order to get certain information from the listview. The main thing he is getting is the text of a subitem because when you use Items[1].SubItems[1] (or whatever) you get really weird results. Now the problem I am having is that it doesn't work so well on Win98/ME. I know this is because of the Unicode issue. I have my SendMessage declared as follows: [DllImport("user32.dll", CharSet=CharSet.Auto )] public static extern void SendMessage(IntPtr hWnd, ListViewMessages msg, int wParam, ref LVITEM lParam); Then it is called with: SendMessage(Handle, ListViewMessages.LVM_GETITEMTEXTW, row, ref lvi); ListViewMessages.LVM_GETITEMTEXTW is defined as (LVM_FIRST + 115) This works great on Win2k. But if I run it on Win98/ME, the Text that is return into lvi is just the first letter. If I change the GETITEMTEXTW to (LVM_FIRST + 45), it will work prefectly on Win98/ME but it does not work correctly on Win2k (just get black bars). I have tried changing the CharSet and making EntryPoint="SendMessageA" on the DLLImport, but nothing works. I have a few other SendMessage calls too that use the Unicode message and I'm afraid that they won't work either. I have a list of the non-unicode messages, I just need to know to use the same message number is both the Win2k and 98/ME version. Thanks for reading this really long message. Jonathan

      J Offline
      J Offline
      Jonathan Austin
      wrote on last edited by
      #2

      To Answer my question for the benefit of others. From the information that I gave, it was probably practically impossible to answer. It appears that my structure that I had for LV_ITEM had CharSet.Auto set on it. I removed it so that it would be CharSet.Ansi therefore everything concerning converting between ansi and unicode would be taken care of on NT/2000/XP machines. That solved my problem once I set the Messages to be the non-unicode veresion.

      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