Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SHBrowseForFolder 2

Status
Not open for further replies.

sod32

Programmer
Apr 12, 2001
3
IE
Hi all,
I'm trying to get a callback function working with the SHBrowseForFolder dialog in order to set the default folder but I'm not sure how to call it.

// Fill in the BROWSEINFO structure.
bi.hwndOwner = hWnd;
bi.pidlRoot = pidlMyComputer;
bi.pszDisplayName = buf;
bi.lpszTitle = prompt;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS;
bi.lpfn = BrowseCallbackProc; // error???
bi.lParam = (LPARAM)buf;

I've seen similar code working in other projects

 
You do not have to call it. Ths function executes automatically when your window receive a message. You can also use CallWindowProc to call it directly, but usualy you do not need it John Fill

ivfmd@mail.md
 
Like John says, you don't call callback functions directly. What you do is give Windows the name of your function (through another function call) and the OS will call it when it needs/wants to.

On your side, you need to make sure that the OS can see your function. This is typically done through either a __declspec(dllexport) or by putting the name of the function in your .DEF file. I reccomend the latter (I've had fewer problems that way). Don't forget to surround the function with extern "C" { } if your source is a .cpp file!

Chip H.

 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top