|
I've already answered your questions, and I am a professional consultant for several companies (in the past and currently) for Windows Installer, and am currently working on the MSI 3.0 beta testing team.
Notice the emphasized string in 'Microsoft Jet 4.0 OLE DB Provider'? That means that it is an OLE DB provider and that requires the MDAC 2.6 or above to use with ADO.NET. There is simply no way around it.
You need to install the MDAC 2.6 or higher MSM. You can find these all over the 'net and it is easy to make. As I stated before, InstallShield has both MSMs for MDAC 2.7 SP1 (http://saturn.installshield.com/isd/mergemodules/801/MDAC27/MDAC27ENU.msm[^]) and Jet 4.0 SP6 (http://saturn.installshield.com/isd/MergeModules/EnglishMM/Jet40SP6/Jet40.msm[^]). They do have MSMs for MDAC 2.8 and Jet 4.0 SP7, but there's no link to download. See the following page for many more merge modules to download: http://www.installshield.com/downloads/modules.asp?prod=wind&lan=english&xmlUse=y[^]
All you need to do is add these MSMs to your project correctly. That's it. They are called merge modules because the tables that make up the MSM are merged with your installer when your install package is compiled. The only thing you might have to do is specify a target redirect (or default path) for the files in the MSM when you add it. Just specify the Windows\System32 directory ([SystemFolder] in Windows Installer) and that's it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
Im try to get the icq api to work in c# but i trapped into a big problem.
The dll-function:
ICQAPICall_GetOnlineListDetails
BOOL WINAPI ICQAPICall_GetOnlineListDetails(int &iCount, BPSICQAPI_User **ppUsers);
In (Arguments): None
Out (Returns): iCount, ppUsers
iCount - the number of Users to follow
ppUsers - a pointer to the users’ array.
Description: The data returned is in the order of the online list, top to bottom. The users array is initialized with the user’s ICQ# (m_iUIN field) and the Window Handle (m_hFloatWindow) if the user is “floating”. The users array should be freed by calling ICQAPIUtil_FreeUsers to free each user structure and the array itself.
The iCount Parameter i get correctly with passing "out iCount" to the function (it will return the exact count), but the array gets size 1 and consists garbage. I used this:
[MarshalAs(UnmanagedType.LPArray)]
BSICQAPI_User[] ppUsers //its a array of structs.
It doesnt matter if i do ref or not in the function header.
Does somone know how i can get the right parameter for BPSICQAPI_User **ppUsers ?
THX
sorry for my bad english
|
|
|
|
|
Try this:
[DllImport("whatever.dll")]
bool ICQAPICall_GetOnlineListDetails(
[MarshalAs(UnmanagedType.I4),Out]out int iCount,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0),Out]out BPSICQAPI_User[] ppUsers); Then, make sure that your BSICQAPI_User struct is defined to exactly match the structure in C++, meaning that you might even have to use the ManageAsAttribute on various fields in the struct. Since the OutAttribute is specified and the out keyword is used, then make sure you instantiate a large enough array before passing it to the method:
int count = 0;
BSICQAPI_User[] users = new BSICQAPI_User[40];
ICQAPICall_GetOnlineListDetails(out count, out users);
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
thx for i that works but with the array i get an error.
System.Runtime.InteropServices.MarshalDirectiveException'
Additional Information:: SizeParamIndex can not be used for byref-Arrayparameters
when i remove this i get the same garbage like before...
|
|
|
|
|
Are you sure you defined the structure right, even providing all the necessary MarshalAsAttribute values? You could also trying using out IntPtr ppArray as that second parameter and then using Marshal.PtrToStructure(ppArray, typeof(YourStruct)) .
[edit]
Oh, and I forgot, you don't actually need to initialize the array for an out parameter. Sorry about that.
[/edit]
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
my struct conversion:
typedef struct
{
int m_iUIN;
HWND m_hFloatWindow;
int m_iIP;
char m_szNickname[20];
char m_szFirstName[20];
char m_szLastName[20];
char m_szEmail[100];
char m_szCity[100];
char m_szState[100];
int m_iCountry;
char m_szCountryName[100];
char m_szHomePage[100];
int m_iAge;
char m_szPhone[20];
BYTE m_bGender;
int m_iHomeZip;
// Version 1.0001
int m_iStateFlags;
} BSICQAPI_User;
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct BSICQAPI_User
{
public int m_iUIN;
uint m_hFloatWindow;
public int m_iIP;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)]
public char[] m_szNickname ;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)]
public char[] m_szFirstName ;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)]
public char[] m_szLastName ;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=100)]
public char[] m_szEmail;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=100)]
public char[] m_szCity;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=100)]
public char[] m_szState;
public int m_iCountry;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=100)]
public char[] m_szCountryName ;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=100)]
public char[] m_szHomePage ;
public int m_iAge;
[MarshalAs( UnmanagedType.ByValArray, SizeConst=20)]
public char[] m_szPhone ;
public byte m_bGender;
public int m_iHomeZip;
public int m_iStateFlags;
}
|
|
|
|
|
Are you sure you should be specifing a pack size of 1? You didn't show that in the native definition (and I really don't have time to dig through the ICQ APIs). Try this, though:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
{
public int m_iUIN;
public IntPtr m_hFloatWindow;
public int m_IP;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)]
public char[] m_szNNickname;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)]
public char[] m_szFirstName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)]
public char[] m_szLastName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
public char[] m_szEmail;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
public char[] m_szCity;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
public char[] m_szState;
public int m_iCountry;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
public char[] m_szCountryName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=100)]
public char[] m_szHomePage;
public int m_iAge;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)]
public char[] m_szPhone;
public byte m_bGender;
public int m_iHomeZip;
public int m_iStateFlags;
} Basically, you have it right, although I'd use UnmanagedType.ByValTStr instead, and specify your CharSet=CharSet.Ansi in StructLayoutAttribute . Keep in mind that all characters in .NET are stored in Unicode and assumed to be as such. Without specifying this property in the attribute, either CharSet.Unicode or CharSet.Auto (Ansi in Windows, Unicode in NT) would most likely be assumed, which may be why at least your strings are messed up assuming that you're on NT since the .NET SDK requires it (but there's a trick to install it on Windows 98 or ME).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi ,
i have a big fat problem i cant solve and it _should_ be simple!
i want to exacute a quite slow query via an asp.net page , teh query can take everything form 1sec to 10 minutes (its for our inhouse statistics system.. 10 min is very uncommon but i does happend sometimes)
ive set teh "connect timeout=9999" in the connectionstring , and the sqlconnection object says that the timeout is indeed 9999 if i look at the connectiontimeout property.
ive also set the script timeout to 9999 in the global.asax
yet the page dies after 15 sec when i run this query..
WHY???
what other timeout can there be???
//Roger
|
|
|
|
|
Hello,
i think you should try to set the CommandTimeout property of your SQL-Command to 9999.
SqlCommand myCommand = new SqlCommand();
myCommand.CommandTimeout = 15;
myCommand.CommandType = CommandType.Text;
|
|
|
|
|
that worked,
thanks..
//roger
|
|
|
|
|
I am searching for a .NET API capable of converting (encoding/decoding) WAV and MP3 sound files. (WAV->MP3, MP3->WAV).
It has to be freeware.
I have looked at the lame encoder, which can do the converting, but it doesn't come with a .NET wrapper (and I don't have the skills to create one ). I have seen a small .NET wrapper for the lame encoder somewhere, but it doesn't do what I want.
Have anyone made a .NET wrapper for the lame encoder doing both MP3 encoding and decoding?
Are there any other APIs out there?
Øyvind
|
|
|
|
|
You could download the DirectX 9.0 SDK with the managed assemblies that were written from scratch for DirectX 9.0. Then you can change the WAV decoder with the MP3 encoder and a file writer. This is actually what a lot of encoders / decoders do, since it is a flexible system that is very extensible (you can mix and match readers, decoders, mixers, encoders, and writers in practically any way).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Wow, that sounds interesting.
I'm not sure if I understand this: DirectX 9.0 SDK comes with an MP3 encoder and decoder, or do I include a MP3 encoder of my choice?
I have only used the DirectX 9.0 SDK lightly, so I guess I have some reading to do
Thanks,
Øyvind
|
|
|
|
|
It uses decoders, encoders, mixers, and variuos DMOs install on the system. You'll still need an encoder, but you can get those from various places and some programs will install one as well.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Ok, thanks for your help.
Is this DirectSound specifics or do I look other places in the DirectX 9.0 SDK?
Since I am a beginner with all this, would you give me a URL into MSDN or something so that I know where to start?
Sorry if all these are newbe questions
Øyvind
|
|
|
|
|
You can find all the information about DirectX (and links to more information) at http://msdn.microsoft.com/directx[^]. And, yes, I do believe this is a function of the DirectSound APIs, but I'm not exactly sure since I haven't worked much with DirectX. The SDK installs many samples in C++, C#, and VB.NET.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
In an application that I am working on, I have a custom Configuration Section that returns a collection of plug-ins that are held in the .config file. It works fine the first time you try to load the plug-ins. But if you unload the collection, and then try to re-run the procedure to get the list from the configuration file, it returns the collection from cache instead of refreshing the list. Consequently, the collection that is in cache contains a list of plug-ins that are all disposed. Is there anyway around this? Thanks for all your help.
|
|
|
|
|
If you mean like ASP.NET, then you'll actually need an application host to host your AppDomain in which your executable runs. Once an AppDomain is created and your application is executed in it, you can't change the config settings. ASP.NET uses its ISAPI filter to host the CLR. When the ASP.NET application detects changes to the config file, the AppDomain is unloaded and the host recreates it.
Also, if you're doing plug-ins, all you can specify is assemblies or types. Obviously, you cannot specify an instance (though serialized data could help create an instance). In either case - even if the plug-in was originally disposed - you need only re-instantiate the Type to create a new instance of your plug-in. Basically, don't store the objects in a collection - store the types and have a method that creates an instance from that type.
For example, I wrote a custom configuration section that stores such types (like is common in many of .NET's configuration sections) and creates an instance of class that contains not only that collection of types but a static method that creates an object based on a friendly type name that I pass in (searching the collection for that name, creating the type, and returning the object to me). Basically, my section handler and configuration object act like the Windows registry when it comes to COM objects.
One other option is to have a class that is initialized from the configuration object created from your configuration section handler that also watches the config file for changes (you can easily get the path to the .config file from AppDomain.SetupInformation.ConfigurationFile ) and then uses similar code as the section handler to re-read the values into the object. It's a cluge, but it might be better than having to create a CLR host for your application (which can be either native or managed, BTW).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I am creating an app that closly resembles MS Windows Explorer. Thetrouble is, I have no idea how the thumbnail objects were created that represent image files. Also, what oblect are the thumbnails and filenames placed in?
Mr. Mike
|
|
|
|
|
From what I have read somewhere...
With your image item you call some method like, GetThumbnail or CreateThumbNail and Windwos actually stores these thumbnails and when another program calls GetThumbnail or whatever it is, it checks to see if a thumbnail is already present for that image. If so it returns that one, if not it creates a new one.
I also read that there is no way of creating a new thumbnail once one is created, only way is to manually delete the thumbnail image from the disk. Because Windows may create a thumbnail for displaying in Explorer and then its too small for what you want so it stretches it in your app and it looks horrible.
I have only read all this along time ago, never worked with any of it though. Thought this might be of some help to get you started.
Look in the .Net class library for the System.Drawing.Imaging.Image class and see if a Get or Create Thumbnail method is some where there.
Hope that helps.
|
|
|
|
|
It's stored in a system image list, and there is a way to purge the list itself.
Also, the method to which you're referring is System.Drawing.Image.GetThumbnailImage .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
This really is an application-specific problem. Explorer's ListView (the common control 6 ListVew32) uses a system image list and many, many other things to query files type handlers for a certain interface (IThumbnailCapture ) which returns an image that it stores in a cache (in this case, a hidden system file named thumbs.db).
For your application, you could do something similar, although using the default controls leave much to be desired (not everything from Windows' common controls is wrapped in the .NET equivalents).
Get thumbnails for your ListViewItem s, add them to the ListView 's LargeImageList property, and then set the appropriate ListViewItem s' ImageIndex property to the index in which the thumbnail was inserted. In effect, these become the icons for the ListViewItem s.
Unfortunately, if you want the thumbnail view that Explorer boasts, it won't be an easy task. First, you must make sure your application is bound to common controls 6 (in .NET 1.1, call Application.EnableVisualStyles before calling Application.Run in your program's entry point, Main ), or use a manifest file (see my article list for an article that describes it). Then you'll have to P/Invoke lots of Win32 native functions and override a lot of functonality. Not fun.
I hope at least I gave you some idea of what Explorer does for the functionality you want. Again, though, it's really up to you about how to do it since you control the code in your app.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have an application that connects to a database where the user has to log in to access the app. The login screen is the first screen the user encounters and requires the user to enter username/psswd info along with database info (i.e. database name, server name, etc...). I want to set it up so that when the app is run it will pull up the info entered by the user from the last time. What is the best way to approach this? I thought of XML serialization, but as I understand it, this is not a secure method and therefore passwd info should not be stored in passwd file. I already make a database connection in this form, so if I could I would like to store this data in the database, but I cannot make the connection string until the user enters that info. I suppose I could do the mix of the two, but how will that affect performance? Any one have thoughts.
Thanks in advance.
|
|
|
|
|
Why don't you just write it to the registry using an Encryption algorithm?
|
|
|
|
|
Using the registry is not recommended for .NET applications. Instead (to the original poster) you can still encrypt the password and save it to the .config file (named yourappname.exe.config) either in the <appSettings> or to your own section that you can create using an implementation of IConfigurationSectionHandler . Using .config files is far more robust for .NET apps because it centralizes application settings.
The idea would still be the same, though, and there's many ways to accomplish the task.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|