Code: Select all
Import "kernel32.lib"
  CompilerIf#PB_Compiler_Processor = #PB_Processor_x86
    GetConsoleWindow_() As "_GetConsoleWindow"
  CompilerElse
    GetConsoleWindow_() As "GetConsoleWindow"
  CompilerEndIf
EndImportCode: Select all
Import "kernel32.lib"
  CompilerIf#PB_Compiler_Processor = #PB_Processor_x86
    GetConsoleWindow_() As "_GetConsoleWindow"
  CompilerElse
    GetConsoleWindow_() As "GetConsoleWindow"
  CompilerEndIf
EndImport
Even with your code FRYQUEZ, i have a polink errorFryquez wrote:You need the "_" prefix for x86.
Code: Select all
Import "kernel32.lib"
  CompilerIf#PB_Compiler_Processor = #PB_Processor_x86
    GetConsoleWindow_() As "_GetConsoleWindow"
  CompilerElse
    GetConsoleWindow_() As "GetConsoleWindow"
  CompilerEndIf
EndImport
Procedure.i SetConsolePosition(X.i,Y.i)
  ProcedureReturn SetWindowPos_(GetConsoleWindow_(),#Null,X,Y,#Null,#Null,#SWP_NOZORDER|#SWP_NOSIZE|#SWP_SHOWWINDOW)
EndProcedure
Procedure.i SetConsolePosition_XP(X.i,Y.i)
  Protected WindowHandle.i
  Protected Buffer.s = Space(1024)
  If GetConsoleTitle_(@Buffer,1024)
    WindowHandle = FindWindow_(#Null,Buffer)
    If WindowHandle
      ProcedureReturn SetWindowPos_(WindowHandle,#Null,X,Y,#Null,#Null,#SWP_NOZORDER|#SWP_NOSIZE|#SWP_SHOWWINDOW)
    EndIf
  EndIf
EndProcedure
If OpenConsole()
  SetConsolePosition(10,10)
  ;SetConsolePosition_XP(10,10)
  Input()
EndIf
The happiness is a road...
Code: Select all
If OpenConsole()
  ;Set console position
  SetWindowPos_(GetForegroundWindow_(), #HWND_TOP, 150, 150, #Null, #Null, #SWP_NOZORDER|#SWP_NOSIZE|#SWP_SHOWWINDOW)
  PrintN("Console is at position 150, 150.")
  Sleep_(1500)  
  ;Center console
  Define.rect ConsoleRect : GetWindowRect_(GetForegroundWindow_(), ConsoleRect)
  SetWindowPos_(GetForegroundWindow_(), #HWND_TOP, 
  (GetSystemMetrics_(#SM_CXSCREEN) - (ConsoleRect\Right  - ConsoleRect\Left)) / 2, 
  (GetSystemMetrics_(#SM_CYSCREEN) - (ConsoleRect\Bottom - ConsoleRect\Top)) / 2, 
  #Null, #Null, #SWP_NOZORDER | #SWP_NOSIZE | #SWP_SHOWWINDOW)
  PrintN("Console is now centered on screen.")
  Input() : CloseConsole()
EndIf

You are too strongfryquez wrote:Hmm, guess I don't have the default lib.
Can you try "_GetConsoleWindow@0"?
The happiness is a road...