twain-samples icon indicating copy to clipboard operation
twain-samples copied to clipboard

This application failed to start because it could not find or load the Qt platform plugin "windows" > in ""

Open Elyasin opened this issue 4 years ago • 3 comments

I installed the binaries for the Data Sources in 32 bit and 64 bit. The installation went fine. When I use the Twain App then I can see the data sources; I tested the Twain App on 32 bit and 64 bit architecture. I can also connect to the data sources on both architectures.

However, when I want to perform a scan then I run into an unhandled exception and the following output is displayed (again on both architectures):

This application failed to start because it could not find or load the Qt platform plugin "windows" in "".

Reinstalling the application may fix this problem.

Unfortunately I have no experience with Qt and don't know what the error message means exactly in this case. My guess is that I have to install Qt or part of Qt and set it up in order to make this work.

It would be great if this can be addressed; e.g. explaining in the README file what to install and how to set up so that the virtual Data Sources can perform a scan.

Elyasin avatar Apr 09 '20 08:04 Elyasin

I figured a solution that worked for me on 64 bit architecture, although I feel it is not the best practice to do so.

I installed Qt (the version mentioned in the README, which is 64 bit). In my case I went to the installed Qt directory and looked for the files (qwindows.dll (release) and qwindowsd.dll (debug)) because a search in the internet hinted that the error message means this file cannot be found.

In my case they were located under C:\Qt\5.9.9\msvc2017_64\plugins\platforms and to make it work I copied the folder platforms to the directory of the executable (of the Twain App for example).

I could perform a scan.

I do not have Qt 32bit though, but my feeling is that a similar approach would work.

I still do not really understand the subject. I can use a Twain App command line and I can use a Twain App Qt as far as I could see.

I wonder why I would need Qt in order to run a scan from the command line. This was not the case in a previous version of the command line Twain App as far as I remember.

Elyasin avatar Apr 09 '20 09:04 Elyasin

I had this issue for a long time, this is how I managed to fix it:

  1. Install Qt 5.9.9 with the msvc2017_64 component
  2. Assign the Environment Variable QTDIR=C:\Qt\Qt5.9.9\5.9.9\msvc2017_64
  3. Assign the Environment Variable QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms\

This allows the driver to be invoked from a program that doesn't have the Qt dlls (in my case, a console program)

meoiswa avatar Feb 25 '21 13:02 meoiswa

I have found simpler solution so here it is:

  1. Install data source sample first
  2. Install twain app sample also
  3. Check if you can scan via app sample
  4. Create QT_QPA_PLATFORM_PLUGIN_PATH environment variable pointing at app sample dir with dll.

For example in my case the only thing I did was to set: QT_QPA_PLATFORM_PLUGIN_PATH = C:\Program Files (x86)\TWAIN Working Group\TWAIN 2.4.1 App Sample (32-bit)\win32\platforms

This folder should contain the following dll: qwindows.dll

bb991 avatar May 27 '21 07:05 bb991