NT API

Question:
I am trying to use the CreateProcessAsUser API function. If I put the declaration found in the win32api.txt, the program responds, “Can’t found DLL entry point” (Lib kernel32 function CreateProcessAsUserA).

Answer:
You didn’t give the declaration you are using, but the following should work:

' Constants used with CreationFlags in CreateProcessPrivate Const NORMAL_PRIORITY_CLASS As Long = &H20&Private Const HIGH_PRIORITY_CLASS As Long = &H80&Private Const IDLE_PRIORITY_CLASS As Long = &H40&Private Const REALTIME_PRIORITY_CLASS As Long = &H100&' Constants used with CreateProcessPrivate Const STARTF_USESHOWWINDOW As Long = &H1&Private Const STARTF_USESIZE As Long = &H2&Private Const STARTF_USEPOSITION As Long = &H4&Private Const STARTF_USECOUNTCHARS As Long = &H8&Private Const STARTF_USEFILLATTRIBUTE As Long = &H10&Private Const STARTF_RUNFULLSCREEN As Long = &H20&Private Const STARTF_FORCEONFEEDBACK As Long = &H40&Private Const STARTF_FORCEOFFFEEDBACK As Long = &H80&Private Const STARTF_USESTDHANDLES As Long = &H100&Private Const CREATE_SEPARATE_WOW_VDM As Long = &H800&' ShowWindow constantsPrivate Enum ShowWindow   SW_HIDE = 0&   SW_NORMAL = 1&   SW_SHOWNORMAL = 1&   SW_SHOWMINIMIZED = 2&   SW_MAXIMIZE = 3&   SW_SHOWMAXIMIZED = 3&   SW_SHOWNOACTIVATE = 4&   SW_SHOW = 5&   SW_MINIMIZE = 6&   SW_SHOWMINNOACTIVE = 7&   SW_SHOWNA = 8&   SW_RESTORE = 9&   SW_MAX = 10&   SW_SHOWDEFAULT = 10&End Enum' Structures used with CreateProcessPrivate Type STARTUPINFO   cb As Long   lpReserved As Long   lpDesktop As Long   lpTitle As Long   dwX As Long   dwY As Long   dwXSize As Long   dwYSize As Long   dwXCountChars As Long   dwYCountChars As Long   dwFillAttribute As Long   dwFlags As Long   wShowWindow As Integer   cbReserved2 As Integer   lpReserved2 As Long   hStdInput As Long   hStdOutput As Long   hStdError As LongEnd TypePrivate Type SECURITY_ATTRIBUTES   nLength As Long   lpSecurityDescriptor As Long   bInheritHandle As LongEnd TypePrivate Type PROCESS_INFORMATION   hProcess As Long   hThread As Long   dwProcessId As Long   dwThreadID As LongEnd TypePrivate Declare Function CreateProcessAsUser _   Lib "kernel32" Alias "CreateProcessAsUserA" _   (ByVal hToken As Long, _    ByVal lpApplicationName As String, _    ByVal lpCommandLine As String, _    ByVal lpProcessAttributes As Long, _    ByVal lpThreadAttributes As Long, _    ByVal bInheritHandles As Long, _    ByVal dwCreationFlags As Long, _    ByVal lpEnvironment As Long, _    ByVal lpCurrentDirectory As String, _    lpStartupInfo As STARTUPINFO, _    lpProcessInformation As PROCESS_INFORMATION) As LongPrivate Declare Function CloseHandle _   Lib "kernel32" _   (ByVal hObject As Long) As Long' API callsPrivate Declare Function LogonUser _   Lib "Advapi32" Alias "LogonUserA" _   (ByVal lpszUsername As String, _    ByVal lpszDomain As Any, _    ByVal lpszPassword As String, _    ByVal dwLogonType As Long, _    ByVal dwLogonProvider As Long, _    phToken As Long) As Long' Constants used by LogonUserPrivate Const LOGON32_PROVIDER_DEFAULT As Long = 0&Private Const LOGON32_PROVIDER_WINNT35 As Long = 1&Private Const LOGON32_LOGON_INTERACTIVE As Long = 2&Private Const LOGON32_LOGON_NETWORK As Long = 3&Private Const LOGON32_LOGON_BATCH As Long = 4&Private Const LOGON32_LOGON_SERVICE As Long = 5&

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a