Results 1 to 21 of 21

Thread: Elevation

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Elevation

    Hey guys. I have a Twain Control in my app. When I run the App with standard permissions the Twain control can't find the twain devices. Running it with Admin privileges allows the Twain control to find and access the scanner. The vendor of the Twain OCX says this is because the Twain drivers require elevated privileges in order to work properly (?).

    If my program runs in a more secure environment such as a large network it's not likely that I can talk IT into giving the users Admin just to run my app.

    On the other hand, Microsoft Paint and Word can run just fine. They don't need to be run from an Admin account. They can import from scanners just fine.

    What am I missing here? Clearly I need to do something with regards to a manifest or privs or admin stuff. Just a bit in over my head. Any help appreciated.

    Thanks.

  2. #2
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: Elevation

    You don't need a Twain control to use scanners or Cameras. You are better of using Windows Image Acquisition. See these samples:

    http://www.vbforums.com/showthread.p...-Scanning-Demo

    Or if you want to use the old Twain:

    http://www.planet-source-code.com/vb...Twain&lngWId=1

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Quote Originally Posted by qvb6 View Post
    You don't need a Twain control to use scanners or Cameras. You are better of using Windows Image Acquisition.
    Not a fan of WIA. I've never been able to get it to save a profile. Plus everything I own is Twain anyway so I've gone that direction. I'll look at the Twain example. Getting away from 3rd party controls would be nice.

    But with further testing I ran the compatbility trouble shooter and my program runs fine under settings for Windows 8. Is there a simple way to ask Windows to install my program with settings for Windows 8?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Elevation

    Your app may not be the reason for elevation, it may bet the ocx ... just a thought. Regarding "as Windows 8", right click on your executable and see if you have such a setting in the compatibility tab. Easy enough to test.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: Elevation

    Quote Originally Posted by Darkbob View Post
    Is there a simple way to ask Windows to install my program with settings for Windows 8?
    I think there is, but I haven't used PCA(Program Compatibility Assistant).

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Quote Originally Posted by LaVolpe View Post
    Your app may not be the reason for elevation, it may bet the ocx ... just a thought. Regarding "as Windows 8", right click on your executable and see if you have such a setting in the compatibility tab. Easy enough to test.
    Yes that's where found it and where I set it. I install my program, find the EXE, right click, find the compatibility tab then set it to Windows 8. Works fine.

    But I can't ask my customers to do that. I want them to be able to download an install file, run it and have a working program.

    So my question - how do I ask Windows to install a program using a compatibility mode?

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Elevation

    I don't know if this will work, but manifests have a compatibility setting. Worth a try to use a manifest saying that your app is compatible up to Win 8, or Win8.1 if your app works there too.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Quote Originally Posted by LaVolpe View Post
    I don't know if this will work, but manifests have a compatibility setting. Worth a try to use a manifest saying that your app is compatible up to Win 8, or Win8.1 if your app works there too.
    Excellent idea. I don't have a manifest with my program. I downloaded the Manifest Creator from this site but it doesn't work properly at all... just a weird screen of check boxes with no text.

    I looked at the Schema on the Microsoft site but just can't make heads nor tails.

    Would it be something like

    <compatiblity>Windows 8</compatibility>

    Really a bit lost when it comes to manifests.
    Last edited by Darkbob; Jun 20th, 2019 at 03:14 PM.

  9. #9
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: Elevation

    See this post, but keep in mind that you can't write to HKLM unless you are admin. Some of the comments suggest HKCU. You may want to check the key first, if not found, add it then re-Shell your app.

    Edit: Search the web for: "Program Compatibility Assistant" programmatically

  10. #10
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Elevation

    Quote Originally Posted by Darkbob View Post
    Excellent idea. I don't have a manifest with my program. I downloaded the Manifest Creator from this site but it doesn't work properly at all... just a weird screen of check boxes with no text.
    LOL, I wrote that. The checkboxes need to be filled in by you or populated from your vbp file. Not understanding the project (or reading the documentation I provided), shouldn't be interpreted as "it doesn't work at all".
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Quote Originally Posted by LaVolpe View Post
    LOL, I wrote that. The checkboxes need to be filled in by you or populated from your vbp file. Not understanding the project (or reading the documentation I provided), shouldn't be interpreted as "it doesn't work at all".
    Well first off THANKS! I can tell a ton of work has gone into it. And you must be the world expert on Manifests so you are absolutely the right person to be talking to.

    I know I have to check some boxes but that's not what I mean. I mean the contents of the boxes, text and prompts are all missing. I must be missing something major because this is how Manifest looks to me... what am I doing wrong?

    Name:  m.jpg
Views: 354
Size:  39.3 KB

  12. #12
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Elevation

    Now I can see what you mean -- off top of my head, I haven't a clue as to why it displays that way. In fact, I've never seen a treeview like that in my life. Maybe others have & can suggest what went wrong.

    Out of curiosity what O/S are you running it on? I had to open it again on my Win10 and this is what it should look like. My guess is something to do with the version of the common controls library?

    Name:  Oops.png
Views: 338
Size:  26.1 KB
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Just good old Windows 10 Pro. Nothing fancy... no idea what could be wrong but no other controls give any issue. I traced your project as it executes and didn't see any errors. Just nothing displays.

  14. #14
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Elevation

    Here's a manifest you can try, with following caveats

    1. The last <supportedOS> element (red highlight) is for Win8.1, so remove it if it doesn't apply
    2. The first <assemblyIdentity> element should be changed to reflect your project's name
    3. The blue highlighted section is for drawing controls to current O/S. Remove entire section if not wanted
    Code:
    <?xml version="1.0" standalone="yes"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
    	<assemblyIdentity name="Project1" version="1.0.0.0" type="win32" processorArchitecture="x86"/>
    	<dependency>
    		<dependentAssembly>
    			<assemblyIdentity name="Microsoft.Windows.Common-Controls" version="6.0.0.0" type="win32" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"/>
    		</dependentAssembly>
    	</dependency>
    	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    		<security>
    			<requestedPrivileges>
    				<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
    			</requestedPrivileges>
    		</security>
    	</trustInfo>
    	<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    		<application>
    			<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
    			<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    			<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    			<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
    		</application>
    	</compatibility>
    </assembly>
    To add this to your compiled application:
    1. Copy the relevant xml above to a text file
    2. Create a res file if none exists and add it to your project
    3. Create a custom resource in your res file and add that file
    4. Now double click on the newly added resource...
    -- change the Type Field to: #24 and change the Id Field to: 1
    5. Save your changes, compile and see what happens
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  15. #15
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Elevation

    Quote Originally Posted by Darkbob View Post
    Not a fan of WIA. I've never been able to get it to save a profile.
    TWAIN doesn't "save profiles" either, unless you are referring to ICC Color Profiles. But I'd guess you are talking about functionality added within your 3rd party control.

    Saving and loading scanning "profiles" for WIA 2.0 would be trivial to implement anyway, it's just a matter of persisting the Device properties you care about.


    If that manifest makes a difference I'd be surprised, but it won't hurt to try. I don't think those <suportedOS/> entries are the same thing as the Compatibility Mode shimsets though there is probably some overlap. But the Win8RTMVersionLie shim may be the only one requested via <supportedOS/>. There just isn't any documentation of the details.

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Quote Originally Posted by LaVolpe View Post
    To add this to your compiled application:
    1. Copy the relevant xml above to a text file
    2. Create a res file if none exists and add it to your project
    3. Create a custom resource in your res file and add that file
    4. Now double click on the newly added resource...
    -- change the Type Field to: #24 and change the Id Field to: 1
    5. Save your changes, compile and see what happens
    Hummm... well I do have a res file in my project. It's part of a ribbon bar that I found on the interwebz and it's called themes.res. I added a custom item to my res file and then imported my manifest.res text file...
    Last edited by Darkbob; Jun 21st, 2019 at 09:27 AM.

  17. #17
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Elevation

    The problem is bigger than that. You'll have to merge the manifests, which no utility supports. Application manifests are supposed to be custom-generated at build time based on the needs of each particular program.

    You'd need to extract the manifest from that other compiled resource file, then edit it to make any needed changes. Then you can add the new merged manifest to your Project's resources, which creates a new .RES file when you save it. Possible using ResHacker or something but it sounds like you are in over your head already.

    It may be simpler though in this case. Something called "themes.res" sounds pretty caveman, and what LaVolpe posted above should already encompass everything that was in it.

  18. #18
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Elevation

    It gets scarier every day watching kids running around throwing lit matches in a warehouse full of kerosene. Most people should not be using VB6 any more. That's why .Net was created: it takes all of the matches away.

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    564

    Re: Elevation

    Quote Originally Posted by dilettante View Post
    The problem is bigger than that. You'll have to merge the manifests, which no utility supports. Application manifests are supposed to be custom-generated at build time based on the needs of each particular program.

    You'd need to extract the manifest from that other compiled resource file, then edit it to make any needed changes. Then you can add the new merged manifest to your Project's resources, which creates a new .RES file when you save it. Possible using ResHacker or something but it sounds like you are in over your head already.

    It may be simpler though in this case. Something called "themes.res" sounds pretty caveman, and what LaVolpe posted above should already encompass everything that was in it.
    Well I used the Resource Editor in VB6 and looked into themes.res. It has 3 entries Black, Blue and Silver. So I added a "Custom" to that file and imported the mainfest.res... it all compiled OK but in the end, nothing changed. The finished EXE doesn't show any "run as compatible with Windows 8" or anything like that.

    When I remove the themes.res entirely and just use the manifest.res file the ribbon bar won't run.

    I think I'm going to toss out the manifest file (fortunately I made a backup).

    But thanks for trying anyway.

  20. #20
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    706

    Re: Elevation

    If you decide to add a manifest as a resource manually(Without a software like MMM or Manifest Creator II), make sure that you add extra spaces at the end so it becomes multiple of 4 Bytes, otherwise VB adds extra Nulls, which is the OS treats as a bad manifest and ignores it. See Q297112, for details. VB6 compiler pads resources with extra nulls, if they are not a multiple of 4 bytes, and nulls are not valid in XML.

  21. #21
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Elevation

    Quote Originally Posted by Darkbob View Post
    The finished EXE doesn't show any "run as compatible with Windows 8" or anything like that.
    It wouldn't. The two mechanisms are entirely different and don't "know about" each other.


    I don't know what the 3 things in your .RES file might be but they can't be a manifest since there can be only one. So perhaps you can just add the new manifest to that set of resources. But would it help? No idea.

    The normal way to do something like force "Run with Windows 8 Compatibility" would be to have your installation process install a shims database for that. But now we are really talking post-XP development and deployment techniques. You'd need a recent version of the Application Compatibility Toolkit (ACT) and make sure you do your development on Windows 10 (as you are supposed to be doing anyway).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width