Click here to Skip to main content
15,899,937 members
Home / Discussions / C#
   

C#

 
QuestionHow to protect a software from crack Pin
SoftComplete14-Jun-04 0:24
SoftComplete14-Jun-04 0:24 
AnswerRe: How to protect a software from crack Pin
Dave Kreskowiak14-Jun-04 3:28
mveDave Kreskowiak14-Jun-04 3:28 
AnswerRe: How to protect a software from crack Pin
Wackatronic14-Jun-04 6:53
Wackatronic14-Jun-04 6:53 
QuestionHide taskbar and change DPI settings?? Pin
r913-Jun-04 23:47
r913-Jun-04 23:47 
AnswerRe: Hide taskbar and change DPI settings?? Pin
Dave Kreskowiak14-Jun-04 3:47
mveDave Kreskowiak14-Jun-04 3:47 
GeneralRe: Hide taskbar and change DPI settings?? Pin
Heath Stewart14-Jun-04 4:16
protectorHeath Stewart14-Jun-04 4:16 
GeneralRe: Hide taskbar and change DPI settings?? Pin
r914-Jun-04 6:55
r914-Jun-04 6:55 
GeneralRe: Hide taskbar and change DPI settings?? Pin
Heath Stewart14-Jun-04 8:43
protectorHeath Stewart14-Jun-04 8:43 
You should first read about P/Invoke. See Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK. Just jumping into something without understanding is never a good idea.

You can P/Invoke the SHAppBarMessage like so:
[DllImport("shell32.dll")]
[return: MarshalAs(UnmanagedType.SysUInt)]
private static extern IntPtrSHAppBarMessage(
  [MarshalAs(UnmanagedType.U4)] int dwMessage,
  APPBARDATA data);
 
[StructLayout(LayoutKind.Sequential)]
public struct APPBARDATA
{
  [MarshalAs(UnmanagedType.U4)] public int size;
  public IntPtr handle;
  [MarshalAs(UnmanagedType.SysUInt)] public IntPtr callbackMessage;
  [MarshalAs(UnmanagedType.SysUInt)] public IntPtr edge;
  public RECT rc;
  public IntPtr lParam;
}
 
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
  public int left;
  public int top;
  public int right;
  public int bottom;
}
In order to pass the right messages, read about the SHAppBarMessage[^] API.

There is also an example on CodeProject you can take a look at. Read C# does Shell, Part 3[^].

To get the HWND for the task bar, you'll need to also P/Invoke FindWindow and search for the window class "Shell_TrayWnd". That'll give you the IntPtr to assign to the APPBARDATA.handle field.

You can find more P/Invoke signatures for common Windows APIs at http://pinvoke.net[^].

 

Microsoft MVP, Visual C#
My Articles
GeneralDate time format Pin
Member 445055113-Jun-04 23:46
Member 445055113-Jun-04 23:46 
GeneralRe: Date time format Pin
Stefan Troschuetz14-Jun-04 1:12
Stefan Troschuetz14-Jun-04 1:12 
GeneralRe: Date time format Pin
Heath Stewart14-Jun-04 4:12
protectorHeath Stewart14-Jun-04 4:12 
GeneralRe: Date time format Pin
Jon Sagara14-Jun-04 8:02
Jon Sagara14-Jun-04 8:02 
GeneralRe: Date time format Pin
Dave Kreskowiak14-Jun-04 8:07
mveDave Kreskowiak14-Jun-04 8:07 
GeneralRe: Date time format Pin
Jon Sagara14-Jun-04 8:08
Jon Sagara14-Jun-04 8:08 
GeneralRe: Date time format Pin
Dave Kreskowiak14-Jun-04 9:00
mveDave Kreskowiak14-Jun-04 9:00 
GeneralCheckListBox - how to find out which items are checked Pin
tjawed13-Jun-04 23:36
tjawed13-Jun-04 23:36 
GeneralRe: CheckListBox - how to find out which items are checked Pin
Heath Stewart14-Jun-04 4:07
protectorHeath Stewart14-Jun-04 4:07 
Generalon c# delegates Pin
Asim N.13-Jun-04 23:14
Asim N.13-Jun-04 23:14 
GeneralRe: on c# delegates Pin
Serge Lobko-Lobanovsky14-Jun-04 2:11
Serge Lobko-Lobanovsky14-Jun-04 2:11 
GeneralRe: on c# delegates Pin
Heath Stewart14-Jun-04 4:05
protectorHeath Stewart14-Jun-04 4:05 
GeneralProblem with System namespace Pin
Azghar Hussain13-Jun-04 22:25
professionalAzghar Hussain13-Jun-04 22:25 
GeneralRe: Problem with System namespace Pin
Stefan Troschuetz13-Jun-04 22:32
Stefan Troschuetz13-Jun-04 22:32 
GeneralTreeView with Backgroung Image Pin
yonitgil13-Jun-04 22:14
yonitgil13-Jun-04 22:14 
GeneralRe: TreeView with Backgroung Image Pin
Heath Stewart14-Jun-04 4:01
protectorHeath Stewart14-Jun-04 4:01 
GeneralCan't use System.Version in webservice method Pin
Jan R Hansen13-Jun-04 21:37
Jan R Hansen13-Jun-04 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.