Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Daivd Can you add this to the Top Bar of CF ??

  1. #11
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Posts
    5,040
    Quote Originally Posted by alti
    pass the handle to the panel using the win API (included in the CF SDK ) Win32.SetParent(ChildHandle, ParentHandle)

    get the handle of the panel you create (yourPanel.Handle) and the handle of the GPS program window and add them as arguments to the line above.

    I am not home at the moment, but i will send you the code i am playing with later tonight. (which is embedding fine, but not resizeing yet)
    Here is some code that might help get you going on embedding, resizing, and sending keys...

    It is small examples of each... I did not include the DLLImport's, but you can get those at pinvoke.net.

    IntPtr _Handle;
    Panel containerPanel;
    string windowname = "Notepad";

    private void embedApp()
    {
    int counter = 0;
    _Handle = Win32.FindWindow(null, windowname);

    if(_Handle == IntPtr.Zero)
    {
    Win32.EnumWindowsProc ewp = new Win32.EnumWindowsProc(EvalWindow);
    Win32.EnumWindows(ewp, IntPtr.Zero);

    while(_Handle == IntPtr.Zero && counter < 32)
    {
    counter++;
    System.Threading.Thread.Sleep(250);
    Win32.EnumWindows(ewp, IntPtr.Zero);
    }
    }

    if(_Handle != IntPtr.Zero)
    {
    index = Win32.GetWindowLong(_Handle, Win32.GWL_EXSTYLE);
    Win32.SetWindowLong(_Handle, Win32.GWL_EXSTYLE, index & (~Win32.WS_EX_CLIENTEDGE));
    index = Win32.GetWindowLong(_Handle, Win32.GWL_STYLE);
    Win32.SetWindowLong(_Handle, Win32.GWL_STYLE, index & (~Win32.WS_BORDER));
    m_iParent = Win32.GetParent(_Handle);
    Win32.SetParent(_Handle, containerPanel.Handle);
    }
    }

    private bool EvalWindow(IntPtr hWnd, IntPtr lParam)
    {
    System.Text.StringBuilder title = new System.Text.StringBuilder(256);
    Win32.GetWindowText(hWnd, title, 256);

    if(title.ToString().Trim().ToUpper().IndexOf(windo wname.ToUpper()) != -1)
    {
    _Handle = hWnd;
    return false;
    }

    return true;
    }

    private void resizeWindow(int x, int y, int width, int height)
    {
    containerPanel.Bounds = new Rectangle(x, y, width, height);
    Win32.SetWindowPos(_Handle, IntPtr.Zero, 0, 0, containerPanel.Bounds.Width, containerPanel.Bounds.Height, 0);
    }

    private void sendKeyDown()
    {
    Win32.SendMessage(_Handle, Win32.WM_KEYDOWN, Win32.VK_DOWN, 0);
    }


    good luck

    david
    __________________
    CENTRAFUSE http://www.centrafuse.com
    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  2. #12
    FLAC alti's Avatar
    Join Date
    Sep 2004
    Location
    NY
    Posts
    1,723
    Quote Originally Posted by bishooman
    actuly this is my problem gettign GPS program handel window how can i do that ??
    Davids code above (looking at it quickly) looks like it uses the FindWindow function, all you have to do is add the name of the Gps programs window.

    in mine i started the process (i called p) and then i called the p.MainWindowHandle and inserted it into a IntPtr
    My Install

    Software:
    CFiG v1
    iGuidance Plugin for CF

    CarShell
    Working shell for a CarPC

    StopWatch
    StopWatch plugin remade for centrafuse RC1

  3. #13
    Variable Bitrate bishooman's Avatar
    Join Date
    Jan 2006
    Location
    Kuwait
    Posts
    234
    Quote Originally Posted by alti
    Davids code above (looking at it quickly) looks like it uses the FindWindow function, all you have to do is add the name of the Gps programs window.

    in mine i started the process (i called p) and then i called the p.MainWindowHandle and inserted it into a IntPtr
    ok perfect everything is clear now thanks guys
    We Exist because there is no patch for human Stupidity !!

    We need you ALL Here !!

  4. #14
    FLAC alti's Avatar
    Join Date
    Sep 2004
    Location
    NY
    Posts
    1,723
    David, thank you very much for the code, I think it will be a big help.
    My Install

    Software:
    CFiG v1
    iGuidance Plugin for CF

    CarShell
    Working shell for a CarPC

    StopWatch
    StopWatch plugin remade for centrafuse RC1

  5. #15
    VENDOR - Centrafuse veetid's Avatar
    Join Date
    Apr 2004
    Posts
    5,040
    Quote Originally Posted by alti
    Davids code above (looking at it quickly) looks like it uses the FindWindow function, all you have to do is add the name of the Gps programs window.

    in mine i started the process (i called p) and then i called the p.MainWindowHandle and inserted it into a IntPtr
    I start the process before I run the embed function using the Process class, I just use Win32 for everything else, just to make sure I get the right one.

    I found that the Process class sometimes gave me window handles of parent windows, when the graphic/form window I wanted to embed was actually a child of that parent handle, so I went with FindWindow...

    david
    __________________
    CENTRAFUSE http://www.centrafuse.com
    01 Jeep Cherokee Sport 4x4 Installed
    M10000/512Mb/20GB, Lilliput 7", Holux GM-210

  6. #16
    FLAC alti's Avatar
    Join Date
    Sep 2004
    Location
    NY
    Posts
    1,723
    Quote Originally Posted by veetid
    I found that the Process class sometimes gave me window handles of parent windows, when the graphic/form window I wanted to embed was actually a child of that parent handle, so I went with FindWindow...

    david
    cool, good to know.
    My Install

    Software:
    CFiG v1
    iGuidance Plugin for CF

    CarShell
    Working shell for a CarPC

    StopWatch
    StopWatch plugin remade for centrafuse RC1

  7. #17
    Low Bitrate
    Join Date
    Jun 2005
    Location
    Slovenia
    Posts
    62
    Quote Originally Posted by veetid
    I will look into it, for now you can show it somewhere in your plugin.. I don't show GPS signal everywhere, I don't see the need...
    Hi David,

    I think some sort of a GPS signal icon would be nice to have. I'm having issues with the Destinator GPS plugin that it doesn't find my GPS sometimes since the setup data gets lost somehow (I know this is something the new plugin in RC2 should be better at), and it'd be useful to know whether the plugin has trouble connecting to the GPS or if the GPS just hasn't locked into the satellites yet. Though I figure that if the plugin says 'Satellites locked: 0' this is quite unlikely that the GPS wouldn't see absolutelly anything).

  8. #18
    FLAC ShawJohn's Avatar
    Join Date
    Aug 2004
    Location
    On the edge!
    Posts
    1,790
    Quote Originally Posted by veetid
    I don't show GPS signal everywhere, I don't see the need...

    david

    But it would be nice to have a little indicator on the main screen showing signal strength along side the icon to show battery power remaining in a mobile phone. You show WiFi/Net connection, and battery, but no indication of whether or not we have a satelite lock

    A nice little back and white logo will do, nothing big and fancy required


    John

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 24
    Last Post: 03-14-2006, 11:42 AM
  2. CF 1.4 and MM 1.3.xxx
    By SOS in forum Centrafuse
    Replies: 11
    Last Post: 08-08-2005, 08:20 AM
  3. Auto full screen and no explorer top bar
    By ThEScReW in forum Map Monkey
    Replies: 2
    Last Post: 11-30-2004, 04:01 PM
  4. Frontend 1.1.2 - Info Bar Up Top
    By Headsex in forum Map Monkey
    Replies: 2
    Last Post: 11-29-2004, 03:50 PM
  5. MediaCar Skin Sneak Preview
    By mindtool in forum MediaCar
    Replies: 85
    Last Post: 11-21-2003, 04:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •