There are a lot of stuff that goes wrong in your program. This is what happens when I run it on my computer: 1. The call to GetConsoleTitle() fails because the window title does not fit into 40 bytes, but you will not notice it since you don't check the return code. 2. The call to FindWindow() fails since there are no valid window name in pszWindowTitle, but you will not notice it since you don't check the return code. 3. The call to LoadLibrary() works fine, but you don't know that since you don't check the return code. 4. The call to GetProcAddress() fails since there are no function called "SetWindowText". It is called "SetWindowTextA" (ANSI) or "SetWindowTextW" (unicode). You don't notice that since you don't check the return code. 5. The call to SetWindowText() fails since the function pointer is invalid (which causes the access violation) AND because parameter 1 is the handle to USER32.DLL instead of a handle to a window. 6. Your program fails because you post your question in the wrong forum on Codeproject... :-) I have changed your program a little, and it should work better now. ------------------------------------------ #include "stdafx.h" #include "windows.h" #include "iostream.h" typedef BOOL (WINAPI *LPFNDLLFUNC) (HWND hWnd, LPCTSTR lpString); void main() { // I don't know how long a window title can be, but pszWindowTitle // must be large enough to hold it. char pszWindowTitle[4096]; char dwString[] = "Changed Text"; DWORD err = GetConsoleTitle(pszWindowTitle, sizeof(pszWindowTitle)); if(err == 0) cout << "Could not get console title\n"; HWND hConsole = FindWindow(NULL, pszWindowTitle); if(hConsole == NULL) cout << "Could not find console window\n"; HINSTANCE hLibrary = LoadLibrary("USER32.DLL"); if(hLibrary == NULL) cout << "Could not load user32.dll\n"; LPFNDLLFUNC lpfnDllFunc = (LPFNDLLFUNC) GetProcAddress(hLibrary, "SetWindowTextA"); if(lpfnDllFunc == NULL) cout << "Could not find function SetWindowTextA()\n"; BOOL RetVal = lpfnDllFunc(hConsole, dwString); if(RetVal == FALSE) cout << "SetWindowTextA() failed\n"; }