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
W

WindowsPistha

@WindowsPistha
About
Posts
19
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Win32: Get message notification of other application's close/exit.
    W WindowsPistha

    Stuart Dootson wrote:

    1. Use WMI, as shown in this message[^]. The sample code is VBScript (and would need to be rewritten as below), but it works well enough.

    Does this required WMI service running in the machine. If it is turned off , will i able to catch this event "__InstanceCreationEvent" Thanks

    C / C++ / MFC question

  • Win32: Get message notification of other application's close/exit.
    W WindowsPistha

    Taran9 wrote:

    Why don't you capture WM_QUIT instead? This is the only message that finally halts the Message Loop. But, you won't be able to track abnormal termination of an application with this.

    But our application needs to handle that case too.

    C / C++ / MFC question

  • Win32: Get message notification of other application's close/exit.
    W WindowsPistha

    Hello , My application needs to monitor all other running applications on the system. Is there some way I could get notified on exit of every application exe? The methods I could find: 1) Use PSAPI functions to get the list of running exes at frequent intervals. At each poll compare with the previous list to find which application/process has exited. Disadvantage: Requires constant polling, will take CPU time. 2) Set a global hook for WM_CLOSE message: Using this I would be able to get a notification when any application gets closed through the close button on the title bar Disadvantage: (-) Not all the applications are generating a WM_CLOSE message (Ex: Total Video Player Exe) (-) If the application was closed through the "Exit" menu or button (e.g. File->Exit) , I can't trap that message Is there any other better way that I missed? Please advise.

    C / C++ / MFC question

  • UAC - Showing fake Shield icon on the Exe
    W WindowsPistha

    Thanks Bob ! rebooting also did not help :(

    C / C++ / MFC help business question workspace

  • UAC - Showing fake Shield icon on the Exe
    W WindowsPistha

    Hello , Even though my application does not have the manifest file,Vista shows shield icon over my exe. Initially I thought it was because of the Installer detection Techniques, such as: 1) Analyzing the Exe name, the OS identifies the required level of Execution. 2) Analyzing the binary content of the application, where the OS identifies the required level of execution. I copied the Exe to the desktop, but it did not put the shield icon over my exe. So I came to a conclusion that the above two scenarios are not the reason for this failure. Environment: Installed OS - Vista Business. Account - Administrator with UAC turned on. The Exe was displayed under Program Files directory. To run the application Admin Rights is not required. Is there a different scenario that we need to try inorder to remove the shield icon which is displayed over the exe file Note: Previously My application had manifest file, but now we have changed the Exe inorder to make it run in the standard user privilege. (Therefore we removed the manifest file) The funniest part was, even though it displays the shield icon, UAC prompt did not pop up, when i am trying to launch the Exe and therefore the Application launched without any problem. Is this a Vista bug? what can i do remove this shield icon. Would really appreciate your help. Thanks, WindowsPistha.

    C / C++ / MFC help business question workspace

  • Cant we develope a dll which can be work in both vista and XP?
    W WindowsPistha

    Thanks Naveen. Here is the code for it.

    typedef HRESULT (WINAPI * SHGetKnownFolderPathFn)(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken,PWSTR *ppszPath);

    PWSTR pszPath\[1\];
    SHGetKnownFolderPathFn shGetKnownFolrPth = NULL ;
    
        HINSTANCE hins = LoadLibrary("Shell32.dll");
    

    if(hins != NULL)
    {

    shGetKnownFolrPth = (SHGetKnownFolderPathFn)::GetProcAddress(hins,"SHGetKnownFolderPath");

     if( shGetKnownFolrPth != NULL) 
    		 {
    		 shGetKnownFolrPth(FOLDERID\_LocalAppDataLow,0,NULL,pszPath);
    		 CString csData=pszPath\[0\]; // converting from wchar to ANSI.
    		}
    }
    
    C / C++ / MFC workspace visual-studio data-structures business tutorial

  • Cant we develope a dll which can be work in both vista and XP?
    W WindowsPistha

    Hi All, We have one dll which can be used in many Exes and different Operating systems. At present i am having one requirement to support to get the LocalLow path in vista. So I have implemented separate function for it. I have used SHGetKnownFolderPath funciton to get the LocalLow path. To compile the workspace , I have to use WINVER value as 0x0600. IF we defined the WinVersion as 6 , DLL is not running in XP. Developement Environment :VS 2005 & Vista Business. //In Vista Expected output : C:\Users\bob\AppData\LocalLow\eGrabber\ //In XP Expceted output: C:\Documents and Settings\Smith\Application Data\eGrabber\ int GetCurrentUserLocalLowAppPath(LPTSTR szProfileDir,int dirlen ) { memset(szProfileDir,0,dirlen); if(IsWinXP() == TRUE) { GetCurrentUserAppPath( szProfileDir, dirlen ); } else if(IsVista() == TRUE) { PWSTR pszPath[1]; SHGetKnownFolderPath(NULL,FOLDERID_LocalAppDataLow,0,NULL,pszPath); //copying the pszPath to szProfileDir array } return 1; } Any idea how to achieve this. Your suggestion welcomed ... Thanks.

    C / C++ / MFC workspace visual-studio data-structures business tutorial

  • How to get currently windows logged on users profile directory.
    W WindowsPistha

    Thanks ! I have red the link. SHGetKnownFolderPath also gives me the admin users appdata path. Not the currently windows logged in users appdata path.

    C / C++ / MFC workspace tutorial

  • How to get currently windows logged on users profile directory.
    W WindowsPistha

    I used SHGFP_TYPE_CURRENT flag that also gives me the elvated users app data path.

    modified on Friday, October 31, 2008 6:36 AM

    C / C++ / MFC workspace tutorial

  • How to get currently windows logged on users profile directory.
    W WindowsPistha

    Both i tried SHGetFolderPath(), or on Vista+ only, SHGetKnownFolderPath(). Both gives administrator profile directory only, if elevated.

    modified on Thursday, October 30, 2008 2:42 PM

    C / C++ / MFC workspace tutorial

  • How to get currently windows logged on users profile directory.
    W WindowsPistha

    Hello friends, I want to develope a software which can run for standard users. My software will be installed for only for current user. My superior wants me to keep read only files(Exe ,Dlls...) in Program files path. Other data files in Appdata path,Since those files required Read & write access. Ex: Lets consider two user accounts in a PC. 1) administrator 2) joe ( standard user) Now the user logged in as a joe and trying to install the software. So my setup file asks for elevation becoz it has to put files in program files path. Once the installer has got elevated ,after that if i am getting Environment variable "AppData" to put the data files. It gives me "C:\users\administrator\Appdata\Roaming\" path, but actually i have to put the files for user joe. I dont know how to get the currently logged in users Profile directory. Note: After the elevation . if I am getting the HKCU profile that also gives me the administrator profile only. Try outs: I was loggin as a Joe ( standard user)and launching the setup file.Setup file asks for elevation. From My setup file(runs in administrator account after elevation), I tried to find "expolrer.exe" (runs in Joe account) and getting it is ProcessToken and CreateEnvironmentBlock fn to create environment block for the Explorer.exe. In Vista it is succeeding but in XP OpenProcess fails if i am elevating the exe and trying to get info from the Explorer.exe which runs in Joe's account.

    HANDLE hProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,dwExploererProcessId);

    if( hProcessHandle == NULL)
    	return -2; 
    
    int nRetVal = OpenProcessToken(hProcessHandle,TOKEN\_QUERY,&hToken);	
    
    
    if(nRetVal == 0 )
    	return -3;
    
    BOOL bval = CreateEnvironmentBlock(&lpData,hToken,FALSE);
    
    if(bval == FALSE)
    	return -4;
    

    Advice me about the correct way to get the Currently logged in users profile directory. Eagerly waiting for your answers. Thanks , WindowsPistha

    C / C++ / MFC workspace tutorial

  • Passing the member function pointer to the AfxBeginThread and its problems.
    W WindowsPistha

    Thank you Mr. David here after i will double check before i posting. Regards, WindowsPistha

    C / C++ / MFC help

  • Passing the member function pointer to the AfxBeginThread and its problems.
    W WindowsPistha

    Yes you are right , I have red the below article before i posting. It did not talk about , why compiler gives error. so i thought of sharing here,I want to give something back to codeproject which gives lot of information to me. http://www.codeproject.com/KB/threads/memberthread.aspx[^] Regards, WindowsPistha

    C / C++ / MFC help

  • Passing the member function pointer to the AfxBeginThread and its problems.
    W WindowsPistha

    Hi I am writing this to help others who will also have the same problem Creating worker thread : CWinThread *pThread = AfxBeginThread(&MyThread,(LPVOID*)ptrParam); MyThread is the member function of CWorker class, and its prototype is UINT MyThread( LPVOID pParam ) ; Now while compiling I am getting this error Error 4 error C2665: ‘AfxBeginThread’ : none of the 2 overloads could convert all the argument types We know the function prototype is correct. MSDN ref : UINT __cdecl MyControllingFunction( LPVOID pParam ); should be the function prototype. We are also having the Exact prototype , so what could be the problem. Solution : All the Class member function will have one hidden parameter ( ie ) this pointer. So Actucal function prototype of MyThread is UINT MyThread(CWorker pthis , LPVOID pParam ) ; becoz of this, compiler gives this error. To Solve the problem 1) Creating one global wrapper funciton around MyThread() UINT wrapper(LPVOID pParam) { CWorker *p = new(std::nothrow) CWorker ; if(!p) return ; p->MyThread(pParam); return 0; } CWinThread *pThread = AfxBeginThread(&wrapper,(LPVOID*)ptrParam); wil work perfectly. 2) Declaring the member function as static static UINT MyThread( LPVOID pParam ) ; Note: static member funciton cant access non static member function and non static data member. Regards, WindowsPistha

    C / C++ / MFC help

  • export
    W WindowsPistha

    Hi , Just try to debug the Exported function through the Exe where your invoking the exported function. I hope there must be a problem with App ptr.

    C / C++ / MFC tools question

  • Find '.' character
    W WindowsPistha

    Hello Manju, I like your approach and your ambition is good. But you have to work hard to get in to the VC++ field. Read Some basic books. 1 ) Let us C++ (which will give confident in c++) This is the base for all. 2 ) Visual Programming by yaswant kanetkar(which will give intro about windows programming) 3 ) Windows Programming by charles petzold 4 ) Read some MFC books. This will help you a lot to get into the VC++ field. Once i was also like this.Anyway all the best. Here is the answer For Your question : Windows API : To split the file name into components void _splitpath( const char *path, // Input file name. char *drive, char *dir, char *fname, char *ext ); http://msdn.microsoft.com/en-us/library/e737s6tf(VS.71).aspx Regards, WindowsPistha

    C / C++ / MFC c++ help career

  • VS2005 IDE : Automatic signature addition for new classes.
    W WindowsPistha

    Hi , Actually i created Add-in for adding signature to all the .cpp and .h files. but the problem with that was , if u r having any third party class in workspace. There also it is adding my signature :laugh: . but it should not , so i thought of creating tool which will add my signature while creating new classes thru Project->Add Class menu. Anyway ,i will try to read the documentation. if you found anyother way ,let me know. Thanks, Karthi

    C / C++ / MFC c++ visual-studio tutorial

  • VS2005 IDE : Automatic signature addition for new classes.
    W WindowsPistha

    Hello led Mike, Do I have to create a macro for adding signature. If I created a macro ,Does that macro triger(invoked) autmatically , when i am clicking Project-> Add Class Menu. Am i clear in explaining the task? Thanks in Advnace, Karthi

    C / C++ / MFC c++ visual-studio tutorial

  • VS2005 IDE : Automatic signature addition for new classes.
    W WindowsPistha

    I am a VC++ pgmmer and using VS2005 IDE. Whenever i am creating the New class through Project -> Add Class Menu. I want to add my signature ( Name, Date of creation, ...) automatically at the top the of that class. I do not have any idea , how to proceed. Please throw some light on it. Thanks in advance Karthi....

    C / C++ / MFC c++ visual-studio tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups