Skip to main content

Bring MFC dialog window to Top of all Windows

Hello Folks !!!!

Lately i was developing a Windows CE Auto Version check application and i need to warn User before i trigger OS upgrade so Auto close warning dialog is expected to be top-most window. Following code does the magic.

All you need to do is, place this code in OnInitDialog or whereever you want.

CWnd* MainWnd= AfxGetMainWnd();
  MainWnd->SetWindowPos (&MainWnd->wndTopMost ,0,0,0,0, SWP_NOMOVE| SWP_NOSIZE| SWP_SHOWWINDOW);


Thats it!!!!!!! Not a big deal :)

Comments

Popular posts from this blog

What is the Current Directory in Windows CE & Windows Mobile ?

Lately i encountered  a situation where i had to find the current directory from where my application is running and all my config files reside. Question is "How do I find the current directory?" on Windows CE/Mobile devices. Desktop / PC it is just piece of cake but Windows CE / Mobile devices don't have a concept of a current directory.  Which means all pats are absolute and there is no concept called relative path. Due to lack of relative paths most of the files are loaded to the "Windows" directory and that is how Windows directory is crowded. Alternatively you can hard code directory path and insist user to load files always there. But i hate to hard code values or copy files to Windows directory.  So this has triggered to find a solution to identify my current directory. Since there is no concept of a current directory on a Windows CE / Windows Mobile device how would one locate a resource for which only a relative path is known?  That is what following c...

WinCE / PocketPC / Windows Mobile Power Battery Timeout - Solution

Hello Folks, I am back with yet another WinCE / Windows Mobile Solution this time it is something exciting and it is on Power Batter Suspend timeout related stuff. It is really challenging task to optimize battery life of any embedded device. Sometimes we want to control back light and battery suspend related activities through our program. OK .. here is simple question how do you control Back light, suspend timeout .. etc event through program ? To answer this question one has to understand "How WinCE operates w.r.t Power driver and what exactly happens behind the scenes". To simplify things ... i am going to divide whole things in three parts 1. WinCE OS Part whihc include Power / Battery drivers. 2. Application 3. Registry Registry : It is the place where all values gets stored i.e it acts as media for storing and retrieving values. I hope it is clear that Registry is nothing but global storage media and it has NO power to trigger anything. So that means it is of new us...

Kill Process for Windows Mobile / Pocket PC

Lately i was working on Windows CE process view and way to kill particuler process in WIndows Mobile. Interestly there is "Running Programs" option available uder Start -> Settings -> System -> Memory -> Running programs but unfortunately it does not show all system related / critical processes running, so ihave decided to comeup with my own Kill Process application. ToolHelp Library provides APIs which are usefule to handle processes. So we would need following header file and libraries to include in our solution / project. 1. Tlhelp32.h. 2. Kernel32.lib Steps: 1. Take snapshot of currently executing processes in the system using API "CreateToolhelp32Snapshot" which returns a handle to the snapshot for further usage 2. Then walk through the process list using Process32First() to get the details of the first process into a PROCESSENTRY32 predefined and iterate this process using Process32Next(). 3. After getting handle for first process compare ...