There's some evil inconsistency ...

In function.h, you declare:

void input(int* &pi, int& n, ifstream &fin);

whereas, in function.cpp you have:

void input(int* &pi,int& n, fstream &fin)

i.e., ifstream vs. fstream.

How about using the LPARAM lp? (MSDN: An application-defined value to be passed to the callback function.)

I believe your problem(s) have already been pointed out, but ..

anyone know what is this error

Microsoft has documented their compiler/linker error/warning codes, so, you can always look those up on MSDN, for example Compiler Error C2780.

Then again, are you still trying to select a folder using GetOpenFileName() (which is intended for selecting files)?
...
Yes, because the UI is better than any other specific folder dialog, so it would be very nifty to be able to use it.

I was implying that it is highly unlikely that you'd find any kind of solution using GetOpenFileName(), strictly because it is not intended for selecting folders.

I ran the sample from the link you sent me, and it's exactly what it's doing: using the GetOpenFileName() GUI to selecte folders!

The GUI that you're seeing may be alike that of GetOpenFileName(), but the code does not invoke GetOpenFileName(), which (again) is a key point.

I'm still curious to know what I'm doing wrong with the hook function, but I will certainly use your sample instead.

You might post your exact code, maybe someone here might figure out what's wrong with it.

Any idea what I'm doing wrong that prevents pnmh->code from having the real code event?

Not really, except maybe you are still doing some wild stuff ( like say, PostMessage (hdlg, IDCANCEL, 0, lTime); ) and suffering because of it? Or is your switch/case missing a break and you are falling through to CDN_FOLDERCHANGE?

Then again, are you still trying to select a folder using GetOpenFileName() (which is intended for selecting files)?

If you are unhappy with the SHBrowseForFolder(), perhaps have a look at the Show Shell common file dialog sample from MSDN.

In your hook procedure, you need to use the parent of the hdlg in order to make CommDlg_OpenSave_GetFolderPath() work, i.e. CommDlg_OpenSave_GetFolderPath(GetParent(hdlg), ...);

PS. I think attempting to cancel the selection inside CDN_FOLDERCHANGE switch, is frankly a horrendous idea.

Just in case anyone finds the topic interesting enough, somewhat detailed discussion pertaining to Microsoft's implementation can be found at: Mismatching scalar and vector new and delete

.. and Answers to exercises - mismatching new/delete

I know this is solved, but a detail which should not go unnoticed, namely

// Allocate ...
b = new int[1000000];

// ... and delete
delete [] b;

//// instead of
// delete b;

A cast like (LPWSTR)Buffer only silences your compiler but does not correct the problem. I'd suggest reading some tutorials ..

The Complete Guide to C++ Strings, Part I - Win32 Character Encodings

The Complete Guide to C++ Strings, Part II - String Wrapper Classes

This one might be a good candidate Windows console tutorial / by Ben Ryves.

unresolved external symbol "public: __thiscall grid::grid(void)"

This is saying that you have no implementation of the grid class' constructor.

commented: Thanks +0

Hmm ... is anyone else experiencing this?

At least Opera 11.61 / Windows 7 works perfectly well (regardless of zoom levels).

do you have some examples?

You might try the following minimal snippet to see how it works - maybe it will suit you, maybe not.

#include <iostream>
#include <windows.h>

using namespace std;

int main()
{
    // Queue the file c:\temp\foobar.txt for deletion upon next system start up ...
    MoveFileEx("C:\\temp\\foobar.txt", NULL, MOVEFILE_DELAY_UNTIL_REBOOT);

    // If the following displays zero - the operation succeeded, anything else
    // is an error code.
    cout << " GetLastError(): " << GetLastError() << endl;
}

As stated in the MSDN documentation, you need to have write access to a specific part of the system registry.

Oh, and please use the Reply to this Article -button when replying to a post i.e. do not use the Vote & Comment -button for that purpose. ;)

[QUOTE=Rasool Ahmed]what you mean?
is this a script or something?!!!!!:-O[/QUOTE]

It is a Windows API function. It can be used to delete files upon next system startup - which is what you basically seem to be wanting. So, possibly it may be of help to you - though this depends on what exactly your anti-virus thingy is.

commented: do you have some examples? +0

[QUOTE=ThomsonGB]
1>Linking...
1>XorCryt.obj : error LNK2019: unresolved external symbol impCLSIDFromString@8

...it was hard to find the right include file and I am not sure that that is enough.[/QUOTE]

You still need to look up the necessary library (.lib), documentation [URL="

[QUOTE=Rasool Ahmed]I finally found the solution is by removing it in system boot.[/QUOTE]

Are you aware of the regular [URL="

[QUOTE=Ancient Dragon;1773442]Example in [URL="

I believe this happens due to a typo; [ICODE]Theading[/ICODE] vs. [ICODE]Threading[/ICODE].

commented: THANKS! +5

Have a look at [URL="

I believe you are missing an [COLOR="Red"]ampersand[/COLOR] there ...

[CODE]
...
void serialize(Archive [COLOR="Red"]&[/COLOR] ar, const unsigned int version)
...
[/CODE]

commented: oh my goodness! That's it! Thank you! +3
commented: well spotted! +13

This is somewhat off-topic (being about Facebook user's oversight instead of a scam), but anyhow, perhaps something to be aware of.

:| [URL="

[ICODE]string[/ICODE] lives in the [ICODE]std[/ICODE] namespace, so e.g. [ICODE]std::string input;[/ICODE] ought to work.

[QUOTE=techie1991]
This would put the whole code in that file(1.c) as it is to this file(2.c).[/QUOTE]
Yes, hence your [icode]2.c[/icode] will turn into ..

[CODE]
static int y=23;
void abc(int a){
printf("%d\n",a);
}
int main(){
abc(12);
printf("\n");
printf("%d\n",y);
return 0;
}[/CODE]

giving you a file-scope variable [ICODE]y[/ICODE] perfectly accessible everywhere in [ICODE]2.c[/ICODE] but not in any other file -- does this make things any clearer?

So, how is this static variable in 1.c printed here??

What happens when the preprocessor processes your [ICODE]#include "1.c"[/ICODE] directive that you have in [ICODE]2.c[/ICODE]?

It compiles but it won't run.

It doesn't compile cleanly though, GCC spotted a number of things ..
[code]
\main.c:16:6: warning: no previous declaration for 'enter_params'
\main.c:40:6: warning: no previous declaration for 'mapping_addr'
\main.c: In function 'mapping_addr':
\main.c:49:6: warning: declaration of 'rep' shadows a global declaration
\main.c:6:5: warning: shadowed declaration is here
\main.c:54:2: warning: too many arguments for format
\main.c:66:3: warning: format '%d' expects type 'int', but argument 2 has type 'int '
\main.c:66:3: warning: format '%d' expects type 'int', but argument 3 has type 'int
'
\main.c:121:3: warning: format '%d' expects type 'int', but argument 2 has type 'int '
\main.c:121:3: warning: format '%d' expects type 'int', but argument 3 has type 'int
'
\main.c: At top level:
\main.c:135:6: warning: no previous declaration for 'print_pt'
\main.c: In function 'print_pt':
\main.c:145:3: warning: format '%d' expects type 'int', but argument 2 has type 'int '
\main.c:145:3: warning: format '%d' expects type 'int', but argument 3 has type 'int
'
\main.c: At top level:
\main.c:150:6: warning: no previous declaration for 'quit_prog'
\main.c: In function 'main':
\main.c:184:1: warning: control reaches end of non-void function
\main.c: In function 'mapping_addr':
\main.c:63:7: warning: 'i' is used uninitialized in this function
\main.c:64:13: warning: 'pf' may be used uninitialized in this function
\main.c:123:5: warning: 'rep' may be used uninitialized in this function
[/code]

why this doesn't work correctly?

The input stream has the [ICODE]skipws[/ICODE] format flag set, use [URL="

commented: thanks +36

[QUOTE=LevyDee]... the file fails to open.
[/QUOTE]

[URL="

[QUOTE=Tuloa]...Here is the code causing the app crash:
[CODE]
string ReadLine()
{
getline(file, lineread);
if (lineread.find_firstof("WSF") != string::npos)
{
return lineread;
}
}
[/CODE]
[/QUOTE]
The function is basically badly broken -- what will it 'return' if [ICODE]lineread.find_firstof("WSF") == string::npos[/ICODE]?

Aren't you getting any compiler warnings?

Thread ID of the window (what im currently looking to get

So, if you want to know the window's thread identifier then you could give this a try
[CODE]

include <windows.h>

include <tchar.h>

int main()
{
HWND hW = FindWindow(_T("MSBLWindowClass"), _T("Windows Live Messenger"));

if(hW != NULL)
{
// Process identifier.
DWORD PID;
// Thread identifier.
DWORD TID = GetWindowThreadProcessId(hW, &PID);

// ... use PID/TID here ... 

}
}
[/CODE]