Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:41:23+00:00 2026-06-16T11:41:23+00:00

I’m trying to make a function that scales the controls of a window with

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:41:24+00:00Added an answer on June 16, 2026 at 11:41 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to select an H1 element which is the second-child in its group
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.