p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > C# and C > C# 1.0 > C#
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 22nd, 2004, 10:50 AM
Authorized User
Points: 82, Level: 1
Points: 82, Level: 1 Points: 82, Level: 1 Points: 82, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: xiamen, fujian, China.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to use win32 API?

Hello,
I want to make my winform flash in taskbar or statusbar
if i have to use a win32APi ?
if so ,would flashwindowEx works?
how to use it?
Is there any Example?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 23rd, 2004, 03:12 AM
Friend of Wrox
Points: 914, Level: 11
Points: 914, Level: 11 Points: 914, Level: 11 Points: 914, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Include this namespace

using System.Runtime.InteropServices;

Declare the struct like this in your project namespace

    namespace XYZ
    {
    .
    .
    public struct FLASHINFO
    {
        public Int32 cbSize;
        public IntPtr hwnd;
        public int dwFlags;
        public UInt32 uCount;
        public int dwTimeout;
    }


And declare this function in your class

        [DllImport("user32.dll")]
        public static extern bool FlashWindowEx(
            ref FLASHINFO fInfo);


and then wherever you wanna call FlashWindowsEx use the code similar to this one
            unsafe
            {

                FLASHINFO fInfo = new FLASHINFO();
                fInfo.cbSize = sizeof(FLASHINFO);
                fInfo.dwFlags = 2;
                fInfo.hwnd = this.Handle;
                fInfo.uCount = 2;
                fInfo.dwTimeout = 0;
                bool result = FlashWindowEx(ref fInfo);

                if (result)
                {
                    MessageBox.Show("Called successfully");
                }
            }

Open winuser.h and see the values for different flags


To be able to build this project you will have to go to
Project->YourProject Properties... , Configuration Properties->Build
and turn the option "Allow Unsafe Blocks" in the list on the right side to True

I know... I'm myself not too pleased with the unsafe block that I had to insert in the code, I'm trying to find a way around, but you have got the lead too, so if your strike first, do let me know.

Regards

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between win32 API and FCL adie BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 July 26th, 2007 06:56 PM
How to read C# IntPtr struct in Win32 API Lookie VB How-To 1 February 24th, 2005 07:29 PM
Win32 API Programming visit_anand_it Visual C++ 2 September 8th, 2004 12:46 AM
Fonts going crazy (win32 API GUI) afradley C++ Programming 0 April 10th, 2004 10:09 AM
Need help in writing a C program using win32 API rameshbabumv C++ Programming 0 March 10th, 2004 05:46 AM



All times are GMT -4. The time now is 03:10 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc