Author Topic: MASM 64 Desktop mini app.  (Read 622 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4867
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
MASM 64 Desktop mini app.
« on: May 28, 2017, 12:31:01 PM »
The attached zip file contains a small working app that functions as a simple desktop that has programmable menus that can be set in a plain text file. I have used this app as a test piece to develop the 64 bit version of the programmable menus that I use in my editors and it seems to be working well at the moment. It splits the calling of programs between the old but well behaved "WinExec()" and the newer but limited "ShellExecute()". WinExec handles command lines for exe/bat files with no problems where "ShellExecute()" will run non executable files. It supports HLP, CHM and PDF extensions.

The 9k icon blew the size out to 21k but I doubt it will break any hard disks in terms of storage space.  :P

Tested only on Win10 64 but it should run on Win7/8 64 as well.


 :biggrin: One day I will make a post with no typos.  :P
« Last Edit: May 31, 2017, 02:44:03 PM by hutch-- »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

caballero

  • Member
  • ****
  • Posts: 767
    • Abre Ojos Ensamblador
Re: MASM 64 Desktop mini app.
« Reply #1 on: May 28, 2017, 04:56:24 PM »
Hello. Works well on W7 64 bit. It creates a window without frames with WS_VISIBLE+WS_POPUP and paints the desktop with PaintDesktop and the WinExec for the menu entries.
En un lugar de la Mancha de cuyo nombre no quiero acordarme

Raistlin

  • Member
  • **
  • Posts: 246
Re: MASM 64 Desktop mini app.
« Reply #2 on: May 31, 2017, 03:19:00 PM »
Just a quick question / clarification needed. The explanation on technet/ms seems to be implicit, that
the execution of the called application context is independent of caller. The caller has no further control
over the initiated target except the ability to have exit codes passed. RE: Shellexecute(). The thread choice
in which the application context executes is controlled by the OS and cannot be manipulated by the caller
re: Processor Affinity. However it would theoretically be possible to shift the run-time priority of the application
target.


 Is this assumption correct ?

TWell

  • Member
  • ****
  • Posts: 748
Re: MASM 64 Desktop mini app.
« Reply #3 on: May 31, 2017, 05:34:13 PM »
In ShellExecuteEx() it is possible get hProcess with mask SEE_MASK_NOCLOSEPROCESS and then use SetProcessAffinityMask().

Raistlin

  • Member
  • **
  • Posts: 246
Re: MASM 64 Desktop mini app.
« Reply #4 on: June 02, 2017, 03:43:29 PM »
Code: [Select]
SEE_MASK_NOCLOSEPROCESS (0x00000040)
Use to indicate that the hProcess member receives the process handle. This handle is typically used to allow an application to find out when a process created with ShellExecuteEx
terminates. In some cases, such as when execution is satisfied through a DDE conversation, no handle will be returned. The calling application is responsible for closing the handle
when it is no longer needed
Code: [Select]
typedef struct _SHELLEXECUTEINFO {
  DWORD     cbSize;
  ULONG     fMask;
  HWND      hwnd;
  LPCTSTR   lpVerb;
  LPCTSTR   lpFile;
  LPCTSTR   lpParameters;
  LPCTSTR   lpDirectory;
  int       nShow;
  HINSTANCE hInstApp;
  LPVOID    lpIDList;
  LPCTSTR   lpClass;
  HKEY      hkeyClass;
  DWORD     dwHotKey;
  union {
    HANDLE hIcon;
    HANDLE hMonitor;
  } DUMMYUNIONNAME;
 HANDLE    hProcess;
} SHELLEXECUTEINFO, *LPSHELLEXECUTEINFO;

Code: [Select]
(Note: ShellExecuteEx runs on a background thread by default if the caller's threading model is not Apartment.)