Click here to Skip to main content
15,925,250 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dynamic control creation Pin
Anonymous26-Feb-03 8:16
Anonymous26-Feb-03 8:16 
GeneralRe: Dynamic control creation Pin
Miguel Lopes27-Feb-03 2:58
Miguel Lopes27-Feb-03 2:58 
GeneralProblem Posting Message In System Hook Pin
Neil scsn26-Feb-03 7:49
Neil scsn26-Feb-03 7:49 
GeneralA Browse Button Pin
Hosam Aly Mahmoud26-Feb-03 7:34
Hosam Aly Mahmoud26-Feb-03 7:34 
GeneralRe: A Browse Button Pin
valikac26-Feb-03 9:09
valikac26-Feb-03 9:09 
GeneralRe: A Browse Button Pin
MAAK26-Feb-03 9:26
MAAK26-Feb-03 9:26 
GeneralRe: A Browse Button Pin
Hosam Aly Mahmoud1-Mar-03 5:22
Hosam Aly Mahmoud1-Mar-03 5:22 
GeneralRe: A Browse Button Pin
MAAK1-Mar-03 8:11
MAAK1-Mar-03 8:11 
1. As i told you in my post you could find a wrapper class for the SHBrowseForFolder() on code project this is its link http://www.codeproject.com/shell/cxsbrowsefolder.asp

2. The best way to get the program path exactly is to use the function GetModuleFileName() this is its declaration:
DWORD GetModuleFileName(<br />
  HMODULE hModule,    // handle to module<br />
  LPTSTR lpFilename,  // path buffer<br />
  DWORD nSize         // size of buffer<br />
);

This function gives you the whole path to your program including the file name. Just remove the file name and you get theabsolute path of the program.

This is an example of how to use it to get the program path:
TCHAR procPath[MAX_PATH];
GetModuleFileName(hInst, procPath, MAX_PATH * sizeof(TCHAR));
CString strPath = procPath;
strPath = strPath.Left(str.ReverseFind('\\'));


But in some cases this is not the working path of the program (i.e. the working path is the path assumed if you just gave the program a file name only). One of this case is if you tried to double click a document to be opened with your program , in this case the working path will be that of the document. Any way to get the working path you may use the funcion GetCurrentDirectory()
DWORD GetCurrentDirectory(<br />
  DWORD nBufferLength,  // size of directory buffer<br />
  LPTSTR lpBuffer       // directory buffer<br />
);

it returns the current working directory of the program. See which one suits your situation and use it.

3. MFC are wrappers for the API functoins, you can call API functions anywhere in your MFC project as any other function, but in some cases an MFC method could have the same name as an API in this case you should preceed the function call with a double scope.
e.g. the method SetWindowText() if you want to call the API SetWindowText() instead of it call it like that
::SetWindowText()

GeneralRe: A Browse Button Pin
Hosam Aly Mahmoud4-Mar-03 8:19
Hosam Aly Mahmoud4-Mar-03 8:19 
Generalfunction* to ring-0 Pin
JYunes26-Feb-03 7:18
JYunes26-Feb-03 7:18 
General#include <stl.h> Pin
Anonymous26-Feb-03 6:38
Anonymous26-Feb-03 6:38 
GeneralRe: #include <stl.h> Pin
Maximilien26-Feb-03 6:45
Maximilien26-Feb-03 6:45 
GeneralRe: #include <stl.h> Pin
Nitron26-Feb-03 7:51
Nitron26-Feb-03 7:51 
GeneralGetting the access token of the logged-on user Pin
Neflyte26-Feb-03 6:22
Neflyte26-Feb-03 6:22 
GeneralRe: Getting the access token of the logged-on user Pin
Garth J Lancaster26-Feb-03 10:32
professionalGarth J Lancaster26-Feb-03 10:32 
GeneralRe: Getting the access token of the logged-on user Pin
Neflyte26-Feb-03 10:42
Neflyte26-Feb-03 10:42 
GeneralRe: Getting the access token of the logged-on user Pin
Garth J Lancaster26-Feb-03 10:58
professionalGarth J Lancaster26-Feb-03 10:58 
GeneralRe: Getting the access token of the logged-on user Pin
Garth J Lancaster26-Feb-03 11:20
professionalGarth J Lancaster26-Feb-03 11:20 
GeneralRe: Getting the access token of the logged-on user Pin
Garth J Lancaster26-Feb-03 12:32
professionalGarth J Lancaster26-Feb-03 12:32 
GeneralRe: Getting the access token of the logged-on user Pin
Neflyte26-Feb-03 16:41
Neflyte26-Feb-03 16:41 
GeneralRe: Getting the access token of the logged-on user Pin
Garth J Lancaster27-Feb-03 2:43
professionalGarth J Lancaster27-Feb-03 2:43 
GeneralGot the token, but can't Impersonate... Pin
Neflyte27-Feb-03 5:19
Neflyte27-Feb-03 5:19 
GeneralRe: Got the token, but can't Impersonate... Pin
Garth J Lancaster27-Feb-03 9:55
professionalGarth J Lancaster27-Feb-03 9:55 
GeneralCWnd * pParent in CReate() Pin
ns26-Feb-03 6:09
ns26-Feb-03 6:09 
GeneralRe: CWnd * pParent in CReate() Pin
Nitron26-Feb-03 7:54
Nitron26-Feb-03 7:54 

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.