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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. API Help

API Help

Scheduled Pinned Locked Moved C#
linuxjsonhelptutorialquestion
4 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.
  • T Offline
    T Offline
    tayspen
    wrote on last edited by
    #1

    API Help Posted: 19 Mar 2006 07:25 PM Hi, I use this -- [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowA")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowExA")] private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2); [System.Runtime.InteropServices.DllImport("user32")] private static extern IntPtr ShowWindow(IntPtr hwnd, int nCmdShow); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetWindowTextA")] private static extern bool SetWindowText(IntPtr hWnd, string lpString); [System.Runtime.InteropServices.DllImport("user32")] private static extern int EnableWindow(IntPtr hWnd, bool bEnable); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "GetWindowTextA")] private static extern int GetWindowText(IntPtr hWnd, string lpString, int nMaxCount); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")] private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); private const int WM_LBUTTONDOWN = 513; private const int WM_LBUTTONUP = 514; private const int SW_HIDE = 0; private const int SW_SHOW = 5; private const int SW_MINIMIZE = 6; private const int SW_MAXIMIZE = 3; private const int SW_SHOWMAXIMIZED = 3; private const int SW_RESTORE = 9; public void Changetext() { IntPtr Taskbar = FindWindow("Shell_TrayWnd", null); IntPtr StartButton = FindWindowEx(Taskbar, IntPtr.Zero, "Button", null); SetWindowText(StartButton, "Blah"); EnableWindow(StartButton, false); EnableWindow(StartButton, true); } To change the text on the start button, and it works fine. But it can only have like 5 letters. could i use SetWindowPos to change the width of the start button, to allow for more letters? I have seen code in other langs that do this, And im pretty sire thats the method they take. If so could I see an example please :).

    A 2 Replies Last reply
    0
    • T tayspen

      API Help Posted: 19 Mar 2006 07:25 PM Hi, I use this -- [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowA")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowExA")] private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2); [System.Runtime.InteropServices.DllImport("user32")] private static extern IntPtr ShowWindow(IntPtr hwnd, int nCmdShow); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetWindowTextA")] private static extern bool SetWindowText(IntPtr hWnd, string lpString); [System.Runtime.InteropServices.DllImport("user32")] private static extern int EnableWindow(IntPtr hWnd, bool bEnable); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "GetWindowTextA")] private static extern int GetWindowText(IntPtr hWnd, string lpString, int nMaxCount); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")] private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); private const int WM_LBUTTONDOWN = 513; private const int WM_LBUTTONUP = 514; private const int SW_HIDE = 0; private const int SW_SHOW = 5; private const int SW_MINIMIZE = 6; private const int SW_MAXIMIZE = 3; private const int SW_SHOWMAXIMIZED = 3; private const int SW_RESTORE = 9; public void Changetext() { IntPtr Taskbar = FindWindow("Shell_TrayWnd", null); IntPtr StartButton = FindWindowEx(Taskbar, IntPtr.Zero, "Button", null); SetWindowText(StartButton, "Blah"); EnableWindow(StartButton, false); EnableWindow(StartButton, true); } To change the text on the start button, and it works fine. But it can only have like 5 letters. could i use SetWindowPos to change the width of the start button, to allow for more letters? I have seen code in other langs that do this, And im pretty sire thats the method they take. If so could I see an example please :).

      A Offline
      A Offline
      Ahmad Mahmoud candseeme
      wrote on last edited by
      #2

      Hi I'm very interested in the code in hand here could you send me the code please Thanks in advance Ahmad Shaban

      1 Reply Last reply
      0
      • T tayspen

        API Help Posted: 19 Mar 2006 07:25 PM Hi, I use this -- [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowA")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowExA")] private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2); [System.Runtime.InteropServices.DllImport("user32")] private static extern IntPtr ShowWindow(IntPtr hwnd, int nCmdShow); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetWindowTextA")] private static extern bool SetWindowText(IntPtr hWnd, string lpString); [System.Runtime.InteropServices.DllImport("user32")] private static extern int EnableWindow(IntPtr hWnd, bool bEnable); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "GetWindowTextA")] private static extern int GetWindowText(IntPtr hWnd, string lpString, int nMaxCount); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")] private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); private const int WM_LBUTTONDOWN = 513; private const int WM_LBUTTONUP = 514; private const int SW_HIDE = 0; private const int SW_SHOW = 5; private const int SW_MINIMIZE = 6; private const int SW_MAXIMIZE = 3; private const int SW_SHOWMAXIMIZED = 3; private const int SW_RESTORE = 9; public void Changetext() { IntPtr Taskbar = FindWindow("Shell_TrayWnd", null); IntPtr StartButton = FindWindowEx(Taskbar, IntPtr.Zero, "Button", null); SetWindowText(StartButton, "Blah"); EnableWindow(StartButton, false); EnableWindow(StartButton, true); } To change the text on the start button, and it works fine. But it can only have like 5 letters. could i use SetWindowPos to change the width of the start button, to allow for more letters? I have seen code in other langs that do this, And im pretty sire thats the method they take. If so could I see an example please :).

        A Offline
        A Offline
        Ahmad Mahmoud candseeme
        wrote on last edited by
        #3

        I put it that way

        using System;
        using System.Runtime.InteropServices;

        namespace ChangeText
        {
        public class MainCls
        {
        public MainCls() { }

        	\[DllImport("user32", EntryPoint = "FindWindowA")\]
        	private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        
        	\[DllImport("user32", EntryPoint = "FindWindowExA")\]
        	private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);
        
        	\[DllImport("user32")\]
        	private static extern IntPtr ShowWindow(IntPtr hwnd, int nCmdShow);
        
        	\[DllImport("user32", EntryPoint = "SetWindowTextA")\]
        	private static extern bool SetWindowText(IntPtr hWnd, string lpString);
        
        	\[DllImport("user32")\]
        	private static extern int EnableWindow(IntPtr hWnd, bool bEnable);
        
        	\[DllImport("user32", EntryPoint = "GetWindowTextA")\]
        	private static extern int GetWindowText(IntPtr hWnd, string lpString, int nMaxCount);
        
        	\[DllImport("user32", EntryPoint = "SendMessageA")\]
        	private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
        
        	private const int WM\_LBUTTONDOWN = 513;
        	private const int WM\_LBUTTONUP = 514;
        	private const int SW\_HIDE = 0;
        	private const int SW\_SHOW = 5;
        	private const int SW\_MINIMIZE = 6;
        	private const int SW\_MAXIMIZE = 3;
        	private const int SW\_SHOWMAXIMIZED = 3;
        	private const int SW\_RESTORE = 9;
        
        
        	public void Changetext ( string TextToSet )
        	{
        		IntPtr Taskbar = FindWindow("Shell\_TrayWnd", null);
        
        		IntPtr StartButton = FindWindowEx(Taskbar, IntPtr.Zero, "Button", null);
        
        		SetWindowText(StartButton, TextToSet );
        
        		EnableWindow(StartButton, false);
        
        		EnableWindow(StartButton, true);
        	}
        
        }
        

        }

        But the moment a refresh to the taskbar occur it return to its normal text "Start" how to make it permanent Ahmad Shaban

        T 1 Reply Last reply
        0
        • A Ahmad Mahmoud candseeme

          I put it that way

          using System;
          using System.Runtime.InteropServices;

          namespace ChangeText
          {
          public class MainCls
          {
          public MainCls() { }

          	\[DllImport("user32", EntryPoint = "FindWindowA")\]
          	private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
          
          	\[DllImport("user32", EntryPoint = "FindWindowExA")\]
          	private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);
          
          	\[DllImport("user32")\]
          	private static extern IntPtr ShowWindow(IntPtr hwnd, int nCmdShow);
          
          	\[DllImport("user32", EntryPoint = "SetWindowTextA")\]
          	private static extern bool SetWindowText(IntPtr hWnd, string lpString);
          
          	\[DllImport("user32")\]
          	private static extern int EnableWindow(IntPtr hWnd, bool bEnable);
          
          	\[DllImport("user32", EntryPoint = "GetWindowTextA")\]
          	private static extern int GetWindowText(IntPtr hWnd, string lpString, int nMaxCount);
          
          	\[DllImport("user32", EntryPoint = "SendMessageA")\]
          	private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
          
          	private const int WM\_LBUTTONDOWN = 513;
          	private const int WM\_LBUTTONUP = 514;
          	private const int SW\_HIDE = 0;
          	private const int SW\_SHOW = 5;
          	private const int SW\_MINIMIZE = 6;
          	private const int SW\_MAXIMIZE = 3;
          	private const int SW\_SHOWMAXIMIZED = 3;
          	private const int SW\_RESTORE = 9;
          
          
          	public void Changetext ( string TextToSet )
          	{
          		IntPtr Taskbar = FindWindow("Shell\_TrayWnd", null);
          
          		IntPtr StartButton = FindWindowEx(Taskbar, IntPtr.Zero, "Button", null);
          
          		SetWindowText(StartButton, TextToSet );
          
          		EnableWindow(StartButton, false);
          
          		EnableWindow(StartButton, true);
          	}
          
          }
          

          }

          But the moment a refresh to the taskbar occur it return to its normal text "Start" how to make it permanent Ahmad Shaban

          T Offline
          T Offline
          tayspen
          wrote on last edited by
          #4

          I just need to know how to change the size of it :(. To keep it there, just set the method and call it on a timer...

          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