AutoCAD doesn't respond to CreateProcess screen size instructions

Discussion in 'AutoCAD' started by TCARPENTER, Mar 2, 2005.

  1. TCARPENTER

    TCARPENTER Guest

    I am using the CreateProcess API call to launch AutoCAD but when I supply the screen dimensions I want AutoCAD to start in, it just comes up at whatever size it was closed in. I can resize the application after it's up and running, so I must be doing something wrong. Any ideas? Here's the chunk of code I'm using:

    Code:
    With sInfo
    .dwFlags = STARTF_USESIZE
    .dwX = (Screen.Width / Screen.TwipsPerPixelX) / 2
    .dwY = ((Screen.Width / Screen.TwipsPerPixelX) / 2) - 8
    .dwXSize = (Screen.Width / Screen.TwipsPerPixelX) / 2
    .dwYSize = (Screen.Height / Screen.TwipsPerPixelY) / 2
    End With
    
    sInfo.cb = Len(sInfo)
    
    ' ActMsg "Launching AutoCAD"
    
    lSuccess = CreateProcess(lpApplicationName:=sNull, _
    lpCommandLine:=strApptoRun, _
    lpProcessAttributes:=ByVal 0&, _
    lpThreadAttributes:=ByVal 0&, _
    bInheritHandles:=1&, _
    dwCreationFlags:=NORMAL_PRIORITY_CLASS, _
    lpEnvironment:=ByVal 0&, _
    lpCurrentDirectory:=strStartDir, _
    lpStartupInfo:=sInfo, _
    lpProcessInformation:=pInfo)
    
    
    TIA
    Todd
     
    TCARPENTER, Mar 2, 2005
    #1
  2. TCARPENTER

    VBA Guest

    AutoCAD does not like to be told what to do in this manner.
     
    VBA, Mar 2, 2005
    #2
  3. TCARPENTER

    TCARPENTER Guest

    Hi VBA,

    Thanks for the info, I figured as much but just thought I'd check!

    Thanks again,
    Todd
     
    TCARPENTER, Mar 3, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.