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
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. ShellExecute

ShellExecute

Scheduled Pinned Locked Moved Managed C++/CLI
c++linuxhelp
2 Posts 2 Posters 3 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.
  • J Offline
    J Offline
    Jerrick7007
    wrote on last edited by
    #1

    Hi, I am using Sumatra in my Visual Basic 6.0 like this Dim cmdline as string Dim ret as integer Dim hwnd As Long Dim gstrPathAndFilename as string gstrPathAndFilename="C:\test.pdf" hwnd = Picture1.hwnd cmdline = "C:\Program Files\SumatraPDF\SumatraPDF.exe -plugin " & hwnd & " " & gstrPathAndFilename ret = Shell(cmdline) The above code works perfectly in VB6. Now I am trying to convert the above code to Visual C/C++ 6.0 like this static HWND hwndPicture ; hwndPicture = GetDlgItem (hwnd, IDC_PIC) ; ShellExecute( hwndPicture, TEXT("open"), TEXT("C:\\Program Files\\SumatraPDF\\SumatraPDF.exe"), "d:\\Test\\test.pdf", TEXT(" d:\\ "), SW_SHOWNORMAL); It works but not inside the form and picture box, it opens a new window. Can someone help me, I new in Visual C++ Thanks, Russell

    Richard Andrew x64R 1 Reply Last reply
    0
    • J Jerrick7007

      Hi, I am using Sumatra in my Visual Basic 6.0 like this Dim cmdline as string Dim ret as integer Dim hwnd As Long Dim gstrPathAndFilename as string gstrPathAndFilename="C:\test.pdf" hwnd = Picture1.hwnd cmdline = "C:\Program Files\SumatraPDF\SumatraPDF.exe -plugin " & hwnd & " " & gstrPathAndFilename ret = Shell(cmdline) The above code works perfectly in VB6. Now I am trying to convert the above code to Visual C/C++ 6.0 like this static HWND hwndPicture ; hwndPicture = GetDlgItem (hwnd, IDC_PIC) ; ShellExecute( hwndPicture, TEXT("open"), TEXT("C:\\Program Files\\SumatraPDF\\SumatraPDF.exe"), "d:\\Test\\test.pdf", TEXT(" d:\\ "), SW_SHOWNORMAL); It works but not inside the form and picture box, it opens a new window. Can someone help me, I new in Visual C++ Thanks, Russell

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      Well, for one thing, you're failing to pass the "-plugin" parameter on the command line in the C++ version.

      The difficult we do right away... ...the impossible takes slightly longer.

      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