Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Form Width

Form Width

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++databasevisual-studio
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    uus99
    wrote on last edited by
    #1

    Hi, how to set form/control width and height in VC++ IDE or in code? I mean, if i want it to be exactly 100x200pixels, how do i do that in the IDE or by code? Is there anything similar to Visual Basic? I have a simple program that adds two numbers in array using MMX (inline assembly), the program works fine, the code as shown below, The result on screen is : 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 which is correct, however, if i change the line char incamt[]={u,u,u,u,u,u,u,u}; to char *incamt; incamt=new char[8]; for(int j=0;j<8;j++) incamt[j]=u; the program compiles but the result is wrong! Why is that? Output: 9 82 117 68 17 18 19 20 17 90 125 76 25 26 27 28 25 98 -123 84 33 34 35 36 #include "stdafx.h" #include void main() { const u = 5; //an array of increment amounts to aid SIMD-style operation char incamt[]={u, u, u, u, u, u, u, u}; //instr is an array of 24 bytes char instr[]={65,66,67,68,69,70,71,72,73,74,75, 76,77,78,79,80,81,82,83,84,85,86,87,88}; //the following is an embedded assembly code which //uses MMX instructions to add in parallel the //amount u to all the bytes of the array instr __asm { movq mm1,incamt //mm1 has value u in all its 8 bytes mov cx, 3 //initialize loop count mov esi, 0 //initialize index register L: movq mm0, instr[esi] //mm0=next 8 bytes from instr paddb mm0,mm1 //parallel add 8 bytes of mm0 & mm1 movq instr[esi],mm0 //move result to instr add esi, 8 //update index register loop L //loop back emms //empty MMX state } //end of assembly code //C++ code to output the results for verification for (int i=0;i<24;i++) cout<>i; } //end of main

    G 1 Reply Last reply
    0
    • U uus99

      Hi, how to set form/control width and height in VC++ IDE or in code? I mean, if i want it to be exactly 100x200pixels, how do i do that in the IDE or by code? Is there anything similar to Visual Basic? I have a simple program that adds two numbers in array using MMX (inline assembly), the program works fine, the code as shown below, The result on screen is : 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 which is correct, however, if i change the line char incamt[]={u,u,u,u,u,u,u,u}; to char *incamt; incamt=new char[8]; for(int j=0;j<8;j++) incamt[j]=u; the program compiles but the result is wrong! Why is that? Output: 9 82 117 68 17 18 19 20 17 90 125 76 25 26 27 28 25 98 -123 84 33 34 35 36 #include "stdafx.h" #include void main() { const u = 5; //an array of increment amounts to aid SIMD-style operation char incamt[]={u, u, u, u, u, u, u, u}; //instr is an array of 24 bytes char instr[]={65,66,67,68,69,70,71,72,73,74,75, 76,77,78,79,80,81,82,83,84,85,86,87,88}; //the following is an embedded assembly code which //uses MMX instructions to add in parallel the //amount u to all the bytes of the array instr __asm { movq mm1,incamt //mm1 has value u in all its 8 bytes mov cx, 3 //initialize loop count mov esi, 0 //initialize index register L: movq mm0, instr[esi] //mm0=next 8 bytes from instr paddb mm0,mm1 //parallel add 8 bytes of mm0 & mm1 movq instr[esi],mm0 //move result to instr add esi, 8 //update index register loop L //loop back emms //empty MMX state } //end of assembly code //C++ code to output the results for verification for (int i=0;i<24;i++) cout<>i; } //end of main

      G Offline
      G Offline
      gUrM33T
      wrote on last edited by
      #2

      uus99 wrote: how to set form/control width and height in VC++ IDE or in code Use SetWindowPos for this purpose. Ex:

      ::SetWindowPos(hwnd, NULL, 0, 0, 100 /* width */, 200, /* height */, SWP_NOMOVE | SWP_NOZORDER);

      Gurmeet S. Kochar


      If you believe in God, it's because of the Devil

      My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control

      U 1 Reply Last reply
      0
      • G gUrM33T

        uus99 wrote: how to set form/control width and height in VC++ IDE or in code Use SetWindowPos for this purpose. Ex:

        ::SetWindowPos(hwnd, NULL, 0, 0, 100 /* width */, 200, /* height */, SWP_NOMOVE | SWP_NOZORDER);

        Gurmeet S. Kochar


        If you believe in God, it's because of the Devil

        My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control

        U Offline
        U Offline
        uus99
        wrote on last edited by
        #3

        SO there is no way i can resize a control in the IDE like Visual Basic? Hmm.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups