Help me convert this to 4.0

Just starting out? Need help? Post your questions and find answers here.
Brice Manuel

Help me convert this to 4.0

Post by Brice Manuel »

Could somebody more knowledgable than me, please help me convert the following code so it is compatible with 4.0?

Code: Select all

sm.SMALL_RECT 
cinfo.CONSOLE_SCREEN_BUFFER_INFO 

newX = 40 
newY = 25 
co = (newY * 65536) + (newX) 

OpenConsole() 
  handle=GetStdHandle_(#STD_OUTPUT_HANDLE) 
  If handle 
    GetConsoleScreenBufferInfo_(handle,cinfo) 
    oldY = cinfo\dwSize / 65536 
    oldX = cinfo\dwSize & $FFFF 
    
    If(oldX * oldY) > (newX * newY) 
      sm\left = 0 
      sm\top = 0 
      sm\right = newX-1 
      sm\bottom = newY-1 
      SetConsoleWindowInfo_(handle,1,sm)  
      SetConsoleScreenBufferSize_(handle,co) 
      Else  
      SetConsoleScreenBufferSize_(handle,co)  
      sm\left = 0 
      sm\top = 0 
      sm\right = newX-1 
      sm\bottom = newY-1 
      SetConsoleWindowInfo_(handle,1,sm) 
    EndIf  
  EndIf 
  
  PrintN("New console size: "+Str(newX)+"x"+Str(newY)) 
  PrintN("Press any key to close") 
  Input() 
CloseConsole() 
End
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

Whats wrong? I can compile on v4.02 without errors.

Image

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
Brice Manuel

Post by Brice Manuel »

*sighs* very little sleep this week and not thinking too clearly.

Wasn't working because I was coding in 4.0 b4 for Linux :roll:

Rebooted to XP and it works fine.

Feel free to whack me with the idiot stick :?
Post Reply