|
-
Jul 11th, 2011, 01:25 AM
#1
Thread Starter
Lively Member
[RESOLVED] How to make my program work in Windows 7 ?
I completed my VB project a while back and it worked great in XP.
Now the same program is needed on computers that have Win7 installed.
The program installs without any problems, but when I open it, it gives me an error saying the database is not accessible.
I used Visual Studio 2008 and SQL Compact to design the project.
The database was included in the project and in the installation file. I also checked the Programs folder and the database was installed correctly into the correct path...
What is the problem with my programs compatibility with Windows 7?
-
Jul 11th, 2011, 01:28 AM
#2
Re: How to make my program work in Windows 7 ?
Is this a writing issue? You are not giving us much information, so we need to guess what's happening.
-
Jul 11th, 2011, 07:07 AM
#3
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by Radjesh Klauke
Is this a writing issue? You are not giving us much information, so we need to guess what's happening.
Sorry about that... My Windows (and error) is in Finnish so it will be a bit difficult to try and explain. But here I'll give it a shot:
Not sure what kind of issue this is... The error in English is as follows:
"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"
There is a lot of information in the error report. But the first lines are as follows:
************** Poikkeuksen teksti **************
System.BadImageFormatException: Yritettiin ladata ohjelma, joka on väärää muotoa. (HRESULT-poikkeus: 0x8007000B)
kohteessa System.Data.SqlServerCe.NativeMethods.CreateErrorInstance(IntPtr& pError)
kohteessa System.Data.SqlServerCe.SqlCeCommand..ctor()
kohteessa MyProject.DB_MyProjectDataSetTableAdapters.ProjektiTableAdapter.InitCommandCollection() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\DB_MyProjectDataSet.Designer.vb:rivillä 28040
kohteessa MyProject.DB_MyProjectDataSetTableAdapters.ProjektiTableAdapter.get_CommandCollection() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\DB_MyProjectDataSet.Designer.vb:rivillä 27878
kohteessa MyProject.DB_MyProjectDataSetTableAdapters.ProjektiTableAdapter.SELECT_Avattujen_Projektien_Määrä () tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\DB_MyProjectDataSet.Designer.vb:rivillä 28725
kohteessa MyProject.Etusivu.Alavalikon_PÄIVITYS() tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\Etusivu.vb:rivillä 187
kohteessa MyProject.Etusivu.Panel3_MouseMove(Object sender, MouseEventArgs e) tiedostossa C:\Documents and Settings\USER\Desktop\MaHa\MyProject\MyProject\Etusivu.vb:rivillä 248
kohteessa System.Windows.Forms.Control.WmMouseMove(Message& m)
kohteessa System.Windows.Forms.Control.WndProc(Message& m)
kohteessa System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
kohteessa System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I guess the above lines are in incorrect format or something?
When I go to the VB project in Visual Studio and look at the lines that are specified above as beeing in icorrect format, I see the following codes:
Row 28040 of DB_MyProjectDataSet.Designer.vb
Me._commandCollection(0) = New Global.System.Data.SqlServerCe.SqlCeCommand
Row 27878 of DB_MyProjectDataSet.Designer.vb
Me.InitCommandCollection
Row 28725 of DB_MyProjectDataSet.Designer.vb
Dim command As Global.System.Data.SqlServerCe.SqlCeCommand = Me.CommandCollection(6)
Row 187 of Form Etusivu.vb
If (ProjektiTableAdapter.SELECT_Avattujen_Projektien_Määrä = 0) Then
Row 248 of Form Etusivu.vb is also referring to the action that includes the code seen above...
-
Jul 11th, 2011, 07:08 AM
#4
New Member
Re: How to make my program work in Windows 7 ?
Try to change the compatibility i properties on the exe file to XP sp 3
-
Jul 12th, 2011, 01:46 AM
#5
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by jackmarrow
Try to change the compatibility i properties on the exe file to XP sp 3
Yep. I did change the compatibility of the .exe but it still gives me the same error.
Any ideas?
-
Jul 12th, 2011, 01:50 AM
#6
Re: How to make my program work in Windows 7 ?
I don't understand most of the error so I started to google: Here's something you may want to look to: http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx
-
Jul 12th, 2011, 02:38 AM
#7
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by Radjesh Klauke
Yep, I took a look at that link already but couldn't figure out what unmanaged code this referred to:
"This exception is thrown when unmanaged code is passed to Load for loading."
-
Jul 12th, 2011, 03:03 AM
#8
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
Also, the target computer has Windows 7, 64 bit.
The program was created on Win XP, 86 bit.
Don't think this should matter as in the 'Compile' options the target CPU is set as 'AnyCPU'...
-
Jul 12th, 2011, 07:26 AM
#9
Addicted Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by Hamsori
Also, the target computer has Windows 7, 64 bit.
The program was created on Win XP, 86 bit.
Don't think this should matter as in the 'Compile' options the target CPU is set as 'AnyCPU'...
86 Bit OMG how's 86 Bit............
really interesting to know about 86Bit.....amazing...........
-
Jul 12th, 2011, 09:43 AM
#10
Re: How to make my program work in Windows 7 ?
 Originally Posted by medsont
86 Bit  OMG how's 86 Bit............
really interesting to know about 86Bit.....amazing........... 
32-bit or x86...
-
Jul 12th, 2011, 09:44 AM
#11
Re: How to make my program work in Windows 7 ?
Is SQL CE installed on the Windows 7 machine?
-
Jul 13th, 2011, 01:06 AM
#12
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by medsont
86 Bit  OMG how's 86 Bit............
really interesting to know about 86Bit.....amazing........... 
Yeah, ment 32bit.
Translated-->
(OMG!!!11 ...amazing!!11.... LOLZZZ....... Ment to say 32 bitz!!!1)
-
Jul 13th, 2011, 01:14 AM
#13
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by mbutler755
Is SQL CE installed on the Windows 7 machine?
Yes, it is.
The .NET Framework is version 4 Client Profile.
Have tried to run the programn in XP compatibility mode.
Also checked the database-file included in my program installation and all the info is there...
-
Jul 13th, 2011, 02:03 AM
#14
Re: How to make my program work in Windows 7 ?
 Originally Posted by Hamsori
Also, the target computer has Windows 7, 64 bit.
The program was created on Win XP, 86 bit.
Don't think this should matter as in the 'Compile' options the target CPU is set as 'AnyCPU'...
Bada-bing! When you compile an executable for 'Any CPU', it will run as a 32-bit process on 32-bit windows and a 64-bit process on a 64-bi windows.
A 64-bit process cannot load a 32-bit-only DLL (and vice-versa). If you try it you get an error saying... (can you guess?)
An attempt was made to load a program with an incorrect format.
In other words, your libraries are the wrong 'bitness'.
Recompiling your app for x86 would be the quickest solution here. That will force it to run as a 32-bit process on your 64-bit box.
This isn't actually a problem, and you may in fact see a performance increase over it running as a 64-bit process.
-
Jul 13th, 2011, 02:45 AM
#15
Thread Starter
Lively Member
Re: How to make my program work in Windows 7 ?
 Originally Posted by Evil_Giraffe
Bada-bing! When you compile an executable for 'Any CPU', it will run as a 32-bit process on 32-bit windows and a 64-bit process on a 64-bi windows.
A 64-bit process cannot load a 32-bit-only DLL (and vice-versa). If you try it you get an error saying... (can you guess?)
An attempt was made to load a program with an incorrect format.
In other words, your libraries are the wrong 'bitness'.
Recompiling your app for x86 would be the quickest solution here. That will force it to run as a 32-bit process on your 64-bit box.
This isn't actually a problem, and you may in fact see a performance increase over it running as a 64-bit process.
I just got a strong urge to kiss you!
I did what you said in VS and created an installation file and suddenly it all worked like a charm on a Win7 64 bit computer! Now it actually seems very logical and simple... 
Thank you!
(These were the most frustrating 2 days ever because of this "problem")
Last edited by Hamsori; Jul 13th, 2011 at 03:11 AM.
-
Jul 5th, 2012, 01:54 PM
#16
New Member
-
Jul 5th, 2012, 01:57 PM
#17
New Member
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|