Q:

Modifying parameter passed by value has no effect on caller's variable

I'm trying to make a function that scales the controls of a window with its parent window when I resize that window, in order to accomplish this I embedded CreateWindowEx() into my own function createscalingwindow
int createscalingwindow (HWND cswpara0,DWORD cswpara1,const CHAR* cswpara2,
const CHAR* cswpara3,DWORD cswpara4,int cswpara5,int cswpara6,int cswpara7,
int cswpara8,HWND cswpara9,HMENU cswpara10,HINSTANCE cswpara11,LPVOID cswpara12)
              {
               cswpara0 = CreateWindowEx (cswpara1, cswpara2, cswpara3, cswpara4,
                                          cswpara5,cswpara6,cswpara7,cswpara8,
                                         cswpara9,cswpara10,cswpara11,cswpara12);
               return 0;
              }

After changing this code in winmain
    mainwin = CreateWindowEx(
       0,                   
       mainclassname,         
       "Mafia Online",       
       WS_OVERLAPPED|WS_CAPTION|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX
      |WS_SYSMENU, 
       CW_USEDEFAULT,       
       CW_USEDEFAULT,       
       544,                 
       375,                 
       NULL,        
       playmenu,                
       hThisInstance,       
       NULL                 
       );

To the following code
createscalingwindow (mainwin, 0, mainclassname, "Mafia Online",
WS_OVERLAPPED|WS_CAPTION|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU, 
CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, NULL, playmenu, hThisInstance, NULL);
ShowWindow (mainwin, nCmdShow);

The main window no longer shows up at all. Calling GetLastError() after the embedded CreateWindowEx() returns error_success. 
After examining both variants of the program in ollydbg, I noticed something strange, the execution of the program using the prototype doesn't work the way I'd expect. The program calls to CreateWindowEx and then returns from the call to an entirely different destination.
Here's how I would expect the program to execute (this is the program that doesn't use createscalingwindow):
(I am not allowed to post images as a new user, so if a mod or someone could fix these for me that would be nice.)
http://s8.postimage.org/qo8tqt5h1/mainnormal.png
Here's how it executes:
http://s8.postimage.org/fa8ytr7qt/mainweird.png
Any effort you put forth into helping me is appreciated, so thanks in advance.

A:

By default, function arguments are passed by value, meaning that the function gets its own copy of the variable, and not a reference to the caller's variable. Any modifications made to the local copy will not affect whatever was passed to the function.
If you want a reference, then pass by reference:
int createscalingwindow (HWND & cswpara0 /* etc. */)
                              ^

Now any modifications you make to the function argument will also modify the caller's variable.

